Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Everyone,

I have 2 servers running SQL Server 2014 which are in different location. Server 1 does not see Server 2 and vice versa. I have a shared drive where both servers can access. On server 1, I have created a backup job and the backup file is saved locally. I need to move the backup to the shared drive. And then, on Server 2, take the backup file and restore it. I need to automate the process.

Any help and solution is greatly appreciated.


What I have tried:

I have created the backup job and a batch file to move the file to the shared drive. The backup ran successfully but the Move database does not work using SQL job. If I ran the batch file manually, it does move the backup file.
Updated 17-Dec-16 0:53am

1 solution

A simple solution would be to automate a backup using SQL Agent. Use the BACKUP (Transact-SQL)[^] command to create the backup to desired location. Then have another SQL Agent job on the other server which puts the database in single user mode, restores the backup using RESTORE (Transact-SQL)[^] and then opens the database for normal use (if necessary).

If you're creating a stand-by and have proper licensing then an easier option would be How to: Set Up, Maintain, and Bring Online a Warm Standby Server (Transact-SQL)[^]
Share this answer
Member 12908552 18-Dec-16 18:04pm    
Thanks for your reply. I have already automated the backup and its working fine. I am trying to move the backup from a local folder over to the shared drive. Then restore the backup from the shared drive. Automating the 'Move' database backup is not working. I have created a batch file to move the backup and running the batch file manually does move the file from the local folder over to the network drive but using the batch file in either SQL Server job or Task Scheduler is not working.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900