Copy Databases With Backup and Restore - SQL Server Microsoft
Copy Databases With Backup and Restore - SQL Server Microsoft
In SQL Server, you can create a new database by restoring a backup of a user
database created by using SQL Server 2005 (9.x) or a later version. However,
backups of master, model and msdb that were created by using an earlier
version of SQL Server cannot be restored by SQL Server. Also, SQL Server
backups cannot be restored by any earlier version of SQL Server.
Important
SQL Server 2016 uses a different default path than earlier versions. Therefore,
to restore backups of a database created in the default location of earlier
versions you must use the MOVE option. For information about the new
default path see File Locations for Default and Named Instances of SQL Server.
For more information about moving database files, see "Moving the Database
Files," later in this topic.
When you use backup and restore to copy a database to another instance of
SQL Server, the source and destination computers can be any platform on
which SQL Server runs.
Optionally, when restoring the database, you can specify the device mapping,
file names, or path for the restoring database.
• You are reusing a database name that exists on the restore destination
and any of its files is named the same as a database file in the backup
set, one of the following occurs:
If the files within the database backup cannot be restored onto the
destination computer, it is necessary to move the files to a new location while
they are being restored. For example:
For more information, see "To restore files and filegroups to a new location,"
later in this topic.
The database name explicitly supplied when you restore a database is used
automatically as the new database name. Because the database name does
not already exist, a new one is created by using the files in the backup.
If the same path does not exist on the destination computer, you have two
alternatives:
• Move the catalog files to a new location during the restore operation, by
using the WITH MOVE clause in your RESTORE DATABASE statement. For
more information, see RESTORE (Transact-SQL).
For information about alternative options for upgrading full-text indexes, see
Upgrade Full-Text Search.
Database ownership
• sp_changedbowner (Transact-SQL)
• ReadFileList
• RelocateFiles
• ReplaceDatabase
• Restore
See also