Well, this is a common question, which is asked frequently on MSDN forums, so think of writing a quick note on how to do the same. The scenario is as follows:
Scenario: Say we have two database servers, ServerA and ServerB. On ServerA, we have a database called DB01. We need to backup DB01 from ServerA and restored it on ServerB. How should we do it?
Solution: We can achieve it in the following ways:
- Backup the database DB01 on ServerA.
- Copy the backup files from ServerA to ServerB.
- Restored the database DB01 on ServerB.
Solution B: Say we have a shared folder on ServerB named Backup. We need to verify that the folder is accessible through the UNC name (\\ServerB\Backup). The SQL Server Database Engine Service account of ServerA should have both Read and write access on the folder \\ServerB\Backup and the SQL Server Agent Service on ServerB has read access to the shared folder \\ServerB\Backup. By following Solution B, we are reducing one step of copy the backup files from source to destination server as it is done automatically.
So we can execute the following command on ServerA, to initiate a backup of DB01 and copy the same to ServerB.
Once, the backup is completed, we can initiate a restore of the backup file on ServerB by using the following command:
From the above command, we need to understand that the backup is located on the “D:” drive of the destination server, i.e. ServerB. Also, we need to remember that the logical data file and logical log file name of the destination database should be same as of source database.