Link to home
Start Free TrialLog in
Avatar of krishna_harik
krishna_harik

asked on

error in moving a file using Operating System[CmdExec], sql agent service account

I am trying to move a .bak file from one folder to another folder using Operating System(CmdExec), sql agent service account in configuring job step properties. In the command line, i have written move command like
ex: move "E:\foldername\*.bak" "F:\foldername"
but the job fails with the error "The process could not be created for step 1 of job 0xEA5D4EF4E6D063791FB533167 (reason: The system cannot find the file specified).
The same move command work's fine in dos command prompt.
What should i check to make sure that the system can find the file location path? or any settings to be changed to share these folders?
 
Thanks,
hari.
Avatar of reb73
reb73
Flag of Ireland image

Are the drives E: and F: local non-removable drives in the server (or in other words network shares mapped as E: or F:)?

Run the following command in SQL Query window to see if the E: and F: drives appear in the list of results -

exec master..xp_fixeddrives

If they don't appear, then you have to use the full UNC path reference (\\server\share\filename.bak) in your job command.. You may also need to ensure that the SQL Agent Service account has full rights on these shares..

Avatar of krishna_harik
krishna_harik

ASKER

These drives E: and F: are of local non-removable drives. i have run the command
exec master..xp_fixeddrives -- > i could see all the list of drives with available space in it.

how to check whether SQL Agent Service account has full rights on these shares?
Before doing this in production server, i want to test it in my desktop system.
Actually try using the command 'move "E:\foldername\*.bak" "F:\foldername"' within a command batch file (test.bat) and call this batch file from the job step to see if it works..

reb,

Thank you very much for your assistance, this worked perfectly!
please, write the commands which i need to add in creating a batch file to move the files,  like
ex:
:START
move "E:\foldername\*.bak" "F:\foldername"
IF errorlevel 1 GOTO MKFILE
GOTO :END

:MKFILE
ECHO file text>file.txt
GOTO START

:END
ECHO Quitting
PAUSE

because, this is the first time i created a batch file.
ASKER CERTIFIED SOLUTION
Avatar of reb73
reb73
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial