April 9, 2010 at 3:32 pm
Does anyone know how to run a job from server A that will Backup Databases on Server B?
Appreciate your help
April 9, 2010 at 4:30 pm
Set up a linked server, then
exec <<linkedserver>>.master.dbo.sp_executesql 'BACKUP DATABASE <<DBName> to disk='\\<<Server>>\e$\<<DBName>.bak''
Of course, inserting the proper servername and drive/directories.
/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!
April 9, 2010 at 4:43 pm
You could also use SQLCMD. Just create an operating system job step like this on serverA:
SQLCMD.exe -E -S serverB -Q "BACKUP DATABSE <databasename> TO DISK = 'c:\databasename.bak'"
April 9, 2010 at 4:45 pm
Edogg (4/9/2010)
You could also use SQLCMD. Just create an operating system job step like this on serverA:SQLCMD.exe -E -S serverB -Q "BACKUP DATABSE <databasename> TO DISK = 'c:\databasename.bak'"
Actually, that's probably safer than setting up a linked server, which has many inheirent security risks (especially if your not well versed in it).
/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!
April 12, 2010 at 8:30 am
Thanks. I decided to use the link server with current security context since we need this to run in a job to make sure we get notified if the job fails.
Thanks SQL Gurus!!!
April 19, 2010 at 3:18 am
Alternatively you can create a backup job in the server1 and appropriate notification to operator and the you can invoke the job from any server where sqlcmd is installed
sqlcmd -S server1-U user-P pwd -Q" exec msdb..sp_start_job 'server1backupjob'" .
This will backup and will send notification as you want.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply