November 7, 2003 at 6:33 am
I have a domain map drive. I copy my backup files daily and restore off site databases.
I try to automate this by creating bat file to copy the files and starting osql to launch restore. but I get error on the copy command access denied.
What I am doing wrong. I run bat file manually and it works.
RJPATEL
RJPATEL
November 7, 2003 at 9:57 am
It does sounds like permission problem. Have you tried to just schedule your job in sql agent so that it runs from the agent context of permission? I am doing similar things in which I schedule file copy to another server every night as well as every hr for differential backup from one server to another without any problem. You should also be able to run this from query analyser as well.
Here is an example:
declare @strtemp varchar(200), @strtemp varchar(200)
select @strtemp = 'master..xp_cmdshell '+
char(39) +'del \\server\drive$\backupsfolder\database.dmp '+ char(39)+ ' , ' + 'NO_OUTPUT'
select @strtemp2 = 'master..xp_cmdshell '+
char(39) +'copy \\server\drive$\backupfolder\database.dmp '+
' \\newserver\drive$\bacupfolder '+ char(39)'+ '' , ' + 'NO_OUTPUT'
EXEC ( @strTemp)
EXEC ( @strTemp2)
hm... it seem that this posting is stripping plus sign 🙁 you will have to add plus sign between '' when it is next to each other before the script will work.
mom
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply