SQL 2008 Agent - run batch file not working

Hello,
I am having some strange issues with a batch file running out of SQL agent I'm hoping I can get some help with.
The batch file's purpose is to send some log files to a SFTP server.
The job has been working great for the past 3 weeks, however this morning it stopped working. The job doesn't error out, however the entire job completes in 00:00:00 duration and I'm given the following message 
Date 4/7/2014 3:38:00 PM
Log Job History (***Log Transfer)
Step ID 1
Server *******
Job Name **** Log Transfer
Step Name run batch
Duration 00:00:00
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
Executed as user: USERNAMERemoved . The step did not generate any output.  Process Exit Code 0.  The step succeeded.
The batch file looks like 
echo  *********************************
echo  ** JOB EXECUTED %date% %time%  ** 
if %errorlevel% neq 0 exit /b
C:
cd "C:\Program Files (x86)\WinSCP"
winscp /console /script=G:\Batch\LogTransfer.txt
call G:\Batch\LogTransfer2.bat
echo ** COMPLETED %date% %time%  ** 
echo  *********************************
I have numerous other batch jobs running on this server, no other job has had this issue.  I have deleted and recreated both the job step and the entire job.  I have recreated the batch files from scratch.   I have also deleted the entire
contents of the batch file and just simply put in echo **** and still received the message so I'm near positive it has nothing to do with the actual batch file.  
I have reset SQL Agent, as well rechecked that the SQL Agent account has run batch rights granted to it.
I moved the batch files to another folder, and they worked for about 4 runs until the same issue happened!!!
The job does execute 100% perfect if I run it manually via batch or if I kick it off starting the job out of SQL.
I am out of options here, does anyone have any ideas that could help me out?
Thanks,
Ryan

Hello,
Try to edit the step, and on the Advanced page of that step try to configure the job to create a log on the location you specify (Output file). Try to run the step again and examine the log created.
Could you try to change the owner of the job to “sa” or to your Windows account? Maybe the SQL Server Agent account does not have access
to the following folders:
G:\Batch\
C:\Program Files (x86)\WinSCP
Alternatively, you can try to create a proxy account.
http://technet.microsoft.com/en-US/library/ms190698(v=SQL.105).aspx
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com

Similar Messages

  • Batch file not working with Scheduler

    I have written a simple batch file which copies contents of one directory to another directory on second server. Both the servers are Windows 2008 R2 and are member servers in the same domain. It is a simple .bat file which copies contents to another folder
    which is mounted as a network drive . 
    This script when I run it from COmmand Prompt window, it works file. But If I schedule it run at a particular time, it does not run. The scheduler starts the batch file and within a second reports it as complete. The copy does not happen.
    I have also tried robocopy command instead of xcopy. But same result.  It works from the command prompt but scheduler cannot run it. But there is no error reported by scheduler.  e.g. task triggrred 11:43:15  completed 11:43:15. 
    Any suggestions? Inputs?
    From :
    shekhar-nsk

    Hi Shekhar,
    I don't think this issue is related to your script. If you run any other simple script then also you may face the same issue.If yes,
    1) Make sure you are using appropriate credential on task schedular. Change User Or Group if require.
    2) Try to run task with "Run with highest privileges"
    3) Ensure you gave the arguments and parameters properly without missing even quotes.
    Can refer below link for more information on scheduling a PS script and replace the same per your requirement for batch file (.bat).
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/43e19576-476d-4735-85ef-c508c18f11e8/executing-powershell-scripts-via-task-scheduler
    Please remember to mark your question as answered & Vote helpful,if this solves/helps your problem.
    Best Regards,
    Pavan Kumar Sapara
    s p kumar

  • Startup batch file not working on WinXP S.P.2

    I have Oracle database release 10.1.0.2.0. And until recently, it started up and shut down easily from 2 batch files that I used. Luckily, although they don't work now, I can still open Oracle by using the [ Administration Tools | Services ] tabs and manually start the required services. When I click on my startupOracle.bat file now - the dos window that appears seems to zoom by so fast - and nothing gets started. So, of course, I'm relieved that I can still operate
    Oracle software. I'm wondering if the fact that the batch files aren't working is a symptom of another ( general computer ) problem I might have. Here is the startup batch file which used to work , but not now
    startupOracle.bat
    @echo off
    %systemdrive%
    REM #
    echo.
    echo You are about to start Oracle Services and Database
    echo.
    set /p Input=Do you want to continue? (Y=Yes N=No) =
    IF /i "%Input%"=="Y" (goto Proceed)
    exit /b
    :Proceed
    echo Oracle Instance and Services Startup in progress
    echo.
    Net start OracleCSService
    Net start OracleDBConsoleorcldata
    Net Start OracleOraDb10g_home1iSQL*PLUS
    Net Start OracleOraDb10g_home1TNSListener
    Net Start OracleServiceORCLDATA
    echo.
    echo Oracle ORCL Instance and Services Startup completed Successfully
    echo Good Bye
    echo on
    EXIT /B

    Hi there,
    Thanks for getting back to me.
    Suddenly everything started working and I hadn't pushed out any fixes to users and it just started to work again.
    Anyway I am just relieved.
    Thanks
    John
     John Mackay | Support Services Manager
     HISTORIC HOUSES TRUST OF NSW
     The Mint | 10 Macquarie Street | Sydney NSW 2000
     t. 02 8239 2347 | f. 8239 2422| www.hht.net.au
      Please consider the environment before printing this email.

  • Can't run batch file in Windows 2008 R2

    Trying to run batch file (manually first) with powershell commands.
    Powershell commands work fine thru powershell but the batch file will not execute manually.
    I am trying to run as administrator.
    Is there a permission  or policy I may be missing?
    Thanks
    Dave
    Dave Kozlowski

    Hi,
    Some bat type command can't run in the powershell environment, you must confirm you have choiced the correct lunch tools.
    Hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Can't run Batch files or Devnev (visual studio) - is not recognized .. command

    Getting the famous error :
    ... is not recognized as an internal or external command`*
    When & Where :
    not sure about the total range of the problem,
    Here I can't run batch files and "devneve.exe"
    sample Batch could be :
    @echo off   
    clr
    'clr' is not recognized ...
    **Here are the keynotes:**
     1. I run it as an admin (cmd)
     2. The Path variable seems to have anything needed, Powershell's path is also there sys32..v1
     3. I'm going into the current directory of devnev.exe ...
     4. ran also "devnev.exe"
     5. I don't have 2 cmd s in a known folder
     6. the autorun registries for command prompt were deleted
     7. the cmd extensions were disabled and re-enabled
     8. Avast IS 9 is running,
     9. The system seems to be fine
     10. all .Net frameworks are installed
     11. for a test jetAudio or ILDasm could be executed from the cmd
    Win 8.1 Pro , CPU i7, VS 2013 upd2

    thanks,
    this was one of the silliest problems I've ever encountered, my bad fault,
    the file is DevEnv not DevNev...!
    but about the clr, don't know from when I added them to my batches, but I'm sure the scripts were working correctly a time ago, maybe by a mistake I changed them, I thought it is the most known command, but I was wrong, there is a long time gap between me
    and DOS.

  • Does SQL 2008 r2 DB backup file will run in SQL 2008

    Shifting my Data base need to confirm does SQL 2008 r2 DB backup file will run in SQL 2008

    It's not possible as they have different version numbers and there is not backword compatibility.
    Please refer similar thread:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4daae3e5-15ab-4929-a122-e1bab420310e/backup-sql-server-2008-r2-restore-on-sql-2008
    Blog:
    http://www.mssqltips.com/sqlservertip/2810/how-to-migrate-a-sql-server-database-to-a-lower-version/
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]

  • How to run batch file from oracle forms 9i

    Hi everyone.
    i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
    i have made a batch file which run the sql loader and transfer my data to database.
    How to run batch file from oracle forms 9i.
    when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
    here is my code
    Begin
    HOST('C:\temp\batchfile.bat');
    message('done');
    end;
    Thanks in advance
    regards
    sajid

    this is my log file, when i run manually.
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: file_to_upload.ctl
    There are 2 data files:
    Data File: sk.csv
    Bad File: sk.bad
    Discard File: none specified
    (Allow all discards)
    Data File: sk1.csv
    Bad File: sk1.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table KHAN, loaded from every logical record.
    Insert option in effect for this table: APPEND
    Column Name Position Len Term Encl Datatype
    SR FIRST * , O(") CHARACTER
    DATES NEXT * , O(") CHARACTER
    AGENT NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    TRANSACTIONS NEXT * , O(") CHARACTER
    PKR NEXT * , O(") CHARACTER
    USD NEXT * , O(") CHARACTER
    BANK NEXT * , O(") CHARACTER
    Table KHAN:
    11088 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 132096 bytes(64 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 11088
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Jul 01 23:27:53 2010
    Run ended on Thu Jul 01 23:27:54 2010
    Elapsed time was: 00:00:00.63
    CPU time was: 00:00:00.17

  • Getting SQL Server Agent running

    I am trying to get my SQL Server Agent running, and no conventional means thus far have worked.
    I set it to run automatically in the Services window of the Control Panel. Attempting to run it from there yields the error "The SQL Server Agent (BENTLEYECAD) service on Local Computer started then stopped. Some services stop automatically if they
    are not in use by services or programs"
    Attempting to start the Server agent in the Server configuration manager yields the error "The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details"
    The resulting error log in SQLAGENT.OUT is
    2015-02-19 15:58:44 - ? [100] Microsoft SQLServerAgent version 10.50.1600.1 (x86 unicode retail build) : Process ID 6064
    2015-02-19 15:58:44 - ? [101] SQL Server HFC-RND-104-D\BENTLEYECAD version 10.50.1600 (0 connection limit)
    2015-02-19 15:58:44 - ? [102] SQL Server ODBC driver version 10.50.1600
    2015-02-19 15:58:44 - ? [103] NetLib being used by driver is DBNETLIB.DLL; Local host server is HFC-RND-104-D\BENTLEYECAD
    2015-02-19 15:58:44 - ? [310] 4 processor(s) and 4096 MB RAM detected
    2015-02-19 15:58:44 - ? [339] Local computer is HFC-RND-104-D running Windows NT 6.1 (7601) Service Pack 1
    2015-02-19 15:58:44 - ! [000] This installation of SQL Server Agent is disabled.  The edition of SQL Server that installed this service does not support SQL Server Agent.
    2015-02-19 15:58:44 - ? [098] SQLServerAgent terminated (normally)
    I have installed this version of SQL alongside Promise V8i (M). Any advice on how to get this server agent running is welcome
    -Eugene

    I see.
    I'm not sure if it's Express or not, how can I tell? The start-up for the server management studio just says "Microsoft SQL Server 2008 R2"
    If this is the case, will any other version of SQL besides Express work? or is it only specific ones?
    Thanks,
    Eugene O'Donnell

  • Using 10g SQL Plus from a batch file

    I installed the Oracle Database 10g Express Client and configured my ODBC and tnsnames.ora settings, and I think I have it all right, because when I open the SQL Command Line I can connect to the database just fine using:
    connect <username>/<password>@<database>
    However, when I try to log in through a non-SQL command line or batch file using the syntax:
    sqlplus <username>/<password>@<database>
    I get the error "ORA-12154: TNS:could not resolve the connect identifier specified." That syntax used to work for me with 9.2. Does the functionality still exist in 10.2?
    Update #1:
    The sqlplus login works from a normal command widow if I first CD C:\XEClient\bin. I still can't get it to work from a batch file, even when I specify the path. Does this mean the batch file command can't find my tnsnames.ora? If so, what environment variable do I need to set? I already have the client directory in the Path and ORACLE_HOME variables.
    Update #2:
    I started randomly trying every Oracle environment variable I could find a reference to, and found that setting TNS_ADMIN to the C:\XEClient\bin directory worked.
    I don't need any responses to this post, so it can be deleted by an admin.
    Edited by: user11241849 on Jan 13, 2010 12:05 PM

    Hi Toni,
    It is my first post here and I though telepathy already operated here :)
    it is Oracle 9 I am talking about.
    actually, I have 2 batch files
    File 1, lets say the file name is batch1.bat and the contents are
    sqlldr user/pwd@tnsname control='Control.ctl'  data='data.txt'
    File 2, batch2.bat and the contents are
    Batch1.bat
    Sqlplus user/pwd@tnsname @callproc.sql
    Now if I run Batch2.bat, then only the first line to be executed which calling the batch1.bat , the second line (sqlplus) never executed!
    Best Regards,
    Yousef
    Edited by: yousef_bayyari on 10-Nov-2009 06:25

  • HOST IN 10g to run batch file on application server

    Hi,
    I am trying to deploy a form from 6i to 9i. the form use Host builtin to run batch file on machine. this works fine when i run form on client server environment. but when i run the same form after compiling in 9i and run on 3 tier model and try to run batch file from form it give me error that
    'ftp' is not recognized as an internal or external command,
    operable program or batch file.
    any suggestion?

    It could be because the Host session doesn't have any environment variables set i.e. there is no PATH variable, so it simply doesn't know where to look to find the 'ftp' executable. You could try supplying the explicit path of the ftp executable and see if that works. (This was a problem I had running Host commands on a Unix application server.)
    James

  • Running batch files thraugh java by passing parameters

    Hi
    I want to run a batch file by passing some parameters.
    Eg: copy.bat "D:\live\hoe.txt" "D:\test"
    while doing this from command prompt its working and i have written some java code for running this batch file.
    String live="D:\\live\\how.txt";
    String test="D:\\test";
    String bat="D:\\copy.bat";
    String[] command = new String[3];
    command[0] = bat;
    command[1] = live;
    command[2] = test;
    try {
    Runtime.getRuntime().exec(command);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    but this time its not copying the file;
    Please help.

    Just another cross poster.
    [http://www.java-forums.org/new-java/15005-running-batch-files-thraugh-java-passing-parameters.html]
    db

  • PDQ - run batch file on user current folder...

    Hi,
    I'm running batch file:
    cd %USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files\
    but it's not opening the current logged on user
    how to deploy it on current logged on user?
    thanks,,,
    This topic first appeared in the Spiceworks Community

    This is not working for me in Windows 8.  I have a shortcut to an EXE file located in"C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup".  If I set the shortcut to run as administrator (screenshot attached) then it does
    not run at all on startup.  If I uncheckmark "Run as Administrator" then it starts fine (but does not have enough privileges to do what it needs to do).  In Windows 7 this was not an issue since the current user was a local administrator and did
    not need to elevate its privileges further.
    Any ideas how I can work around this problem?  Thanks!
    Ugh... it won't let me attach a screenshot until my "account is verified", whatever that means.

  • Error running batch files from java source file???

    Dear Friends,
    hi,
    this is with response to a doubt i had earlier ,
    i want to run batch files from the java source file ,i tried using this code (here batrun is the batch file name that contains commands to run other java files)
    try
    String [] command = {"c:\\vishal\\finalmain\\batrun"};
    Runtime.getRuntime().exec(command);
    catch(Exception e)
    but i got the following error.
    java.io.IOException: CreateProcess: gnagarrun error= 2
    plz. help me, i tried all combination w/o success,
    in anticipation(if possible give the code after testing)
    Vishal.

    hello there,
    i solved the prob. by using
    cmd /c start filename ,but i need to pass parameters ie
    cmd /c start java "c:/vishal/runfile a b" where a and b are the parameters. but it is not accepting this in Runtime.getRuntime.exec(),
    any solutions ?????????
    regards,
    Vishal

  • Bridge CC Tools - Photoshop - Batch does not work in Photoshop CC 2014.

    in Bridge CC Tools - Photoshop - Batch does not work in Photoshop CC 2014. At first I didn't even see the option but I reinstalled Photoshop CC and now I see the menu option but when I try it there is a message that I need to use Photoshop CC. So I open Photoshop CC and the same thing happens? I can't seem to make it work.

    Kitty,
    Your screen shot is in the virus scanning queue, where it can linger for minutes, hours, days or weeks.
    If you use the camera icon in the reply editor's formatting bar, you can embed your image in your post, where it will be viewable instantly.
    then:
    As for your issue, make sure all applicable scripts are checked in Bridge preferences:

  • Out of Memory Error in Java Agents running in lotus notes

    I have a java agent running inside lotus notes jvm. It runs fine for some days but after some days start giving out of memory error and terminates.
    I need to restart agent manager in notes to enable java agent running. Is there a way to catch out of memory error so that on its catch i could restart agent manager.
    Regards,
    Saitu

    Dear Peter,
    The agent is written in java and
    I need to know a way to enter catch block of 'OUTOFMEMORYERROR'.
    My whole code is in a try block with two catches, one for outofmemoryerror and another for exception. When outofmemory error occurs control passes to the exception catch and not outofmemoryerror catch.
    Since out of memory is an error and not an exception, is there a way to catch it or run some code when out of memory occurs.
    Regards,
    Saitu

Maybe you are looking for

  • IPhone 4 no longer automatically launches iTunes

    My iPhone 4 no longer automatically launches iTunes. In iTunes, the box is checked that says "Open iTunes when this iPhone is connected." I've checked and unchecked that box, restarted the computer, etc., but nothing I've done has fixed the problem.

  • How to play MPEG4 music files using Creative Media Source

    I use iTunes store for buying music pretty much and receive files in MPEG4 format. Instead of converting to MP3 I would prefer that my Creative Media Source player/organiser could handle the MPEG4 format. I'm using the Media Source player with an Aud

  • HT5312 How can I reset my security questions if I don't have a rescue email address

    How can I reset my security questions if I don't have a rescue email address. Because i just put an itunes card on my account but can't use it because I dont know my security questions. Please help

  • Function module to get detials of blocked stock of Material

    Hi al..... I like to know the function module to get details of blocked stock of material for particular plant.... like blocked by sales order or damaged material ..etc.. Thanks...

  • Lost an entire roll on import

    Plugged in my camera (Canon Powershot S2) and import stuff appeared as usual, selected delete after import, clicked import, looked OK, so I turned off the camera, unplugged the cord, and hilighted lastroll in iPhoto. No pictures. Turn camera back on