For example, consider the following scenario:
- You have two instances of SQL Server, InstanceA and InstanceB.
- You have a database that has the same name, SQLDB, on each instance of SQL Server.
- On InstanceA, the SQLDB database data file name is DB1_InstanceA.mdf and the log file name is DB1_InstanceA.ldf.
- On InstanceB, the SQLDB database data file name is DB1_InstanceB.mdf and the log file name is DB1_InstanceB.ldf.
- You try to restore a backup of the SQLDB database from InstanceA over the SQLDB database from InstanceB by using the WITH REPLACE option of the RESTORE command.
In this scenario, the physical file names on SQLDB on InstanceB are changed to DB1_InstanceA.mdf and DB1_InstanceA.ldf.
Note The WITH MOVE option provides an option to change the physical file name.
- If there is a match, the backup set continues to use the file names of the target database.
- If the values are different, the backup set replaces the physical file names of the target database by using the names from the backup set.
- A new recovery fork is created on the target server.
- On the next restore operation, the recovery fork IDs from the backup set are matched with the IDs of the target server.
- A RESTORE command that is used together with the WITH REPLACE option keeps the physical names on the target server.
Article ID: 2839722 - Last Review: Apr 22, 2013 - Revision: 1