Performing a SQL Server database move
Note:
NetBackup only supports a database move of a backup with FileStream enabled if the backup is stream-based.
A database move lets you use a full set of backup images to copy an existing database to a location under a different name. Database move operations can only be carried out when your selection includes a database image. This move can occur either when you directly select the database backup image, or when NetBackup finds a recovery set that contains a database backup image.
For information on redirected restores, see the following topic.
See Redirecting a SQL Server database to a different host.
To perform a database move
- Browse for the backup images you want to restore.
- In the Restore Microsoft SQL Server Objects dialog box, expand the database instance.
- Select the database backup image that you want to restore.
- From the Scripting list, select Create a move template.
When you create a move script, the capability to perform an immediate launch is disabled. You must edit the script to specify certain destination parameters.
- Select the restore options.
- Click Restore.
- Indicate a file name and click Save.
- In the Save Script As dialog box, click Yes to open the template in Notepad.
- Change the database name in the template to the name of the database to restore to.
For example, replace:
# Replace the database name in the following line with the name of the database that you # want to move to. Also remove the hash mark <#> which precedes the keyword <DATABASE>. # # DATABASE "DatabaseA"
with:
# Replace the database name in the following line with the name of the database that you # want to move to. Also remove the hash mark <#> which precedes the keyword <DATABASE>. # DATABASE "DatabaseB"
- Change the path for the database files that you want to restore.
You must uncomment at least one file. For example, replace:
# Replace the file path <C:\Microsoft SQL Server\MSSQL.3\MSSQL\DATA\DBA_FG1_File1.ndf> # with a new file path. Also remove the hash mark <#> which precedes the keyword <TO>. # The target of the MOVE keyword must be "DBA_FG1_File1". MOVE "DBA_FG1_File1" #TO "C:\Microsoft SQL Server\MSSQL.3\MSSQL\DATA\DBA_FG1_File1.ndf"
with:
# Replace the file path <C:\Microsoft SQL Server\MSSQL.3\MSSQL\DATA\DBA_FG1_File1.ndf> # with a new file path. Also remove the hash mark <#> which precedes the keyword <TO>. # The target of the MOVE keyword must be "DBA_FG1_File1". MOVE "DBA_FG1_File1" TO "C:\Microsoft SQL Server\MSSQL.3\MSSQL\DATA\DBB_FG1_File1.ndf"
- Change the database file path.
For example, replace:
# Replace the file path <C:\Microsoft SQL Server\MSSQL.3\MSSQL\DATA\DatabaseA.mdf> # with a new file path. Also remove the hash mark <#> which precedes the keyword <TO>. # The target of the MOVE keyword must be "DatabaseA". MOVE "DatabaseA" #TO "C:\Microsoft SQL Server\MSSQL.3\MSSQL\DATA\DatabaseA.mdf"
with:
# Replace the file path <C:\Microsoft SQL Server\MSSQL.3\MSSQL\DATA\DatabaseA.mdf> # with a new file path. Also remove the hash mark <#> which precedes the keyword <TO>. # The target of the MOVE keyword must be "DatabaseA". MOVE "DatabaseA" TO "C:\Microsoft SQL Server\MSSQL.3\MSSQL\DATA\DatabaseB.mdf"
- Make similar changes to the template for any differential backups or transaction log backups you want to move.
- When you finish modifying the template, save it.
- To run the restore, select File > Manage script files, select the script you created, and click Start.
- Click Yes to launch the restore.
To view the progress of the restore, select File > View status.