title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | helpviewer_keywords | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Copy databases to other servers |
Learn how to copy a SQL Server database from one computer to another for testing, to make it available to remote-branch operations, or for other reasons. |
WilliamDAssafMSFT |
wiassaf |
randolphwest |
07/19/2024 |
sql |
backup-restore |
conceptual |
|
[!INCLUDE SQL Server]
Sometimes you might find it useful to copy a database from one computer to another. Reasons include testing, checking consistency, developing software, running reports, creating a mirror database, or possibly to make the database available to remote-branch operations.
There are several ways to copy a database:
-
Use the Copy Database Wizard
You can use the Copy Database Wizard to copy or move databases between servers or to upgrade a [!INCLUDE ssNoVersion] database to a later version. For more information, see Use the Copy Database Wizard.
-
Restore a database backup
To copy an entire database, you can use the BACKUP and RESTORE [!INCLUDE tsql] statements. Typically, restoring a full backup of a database is used to copy the database from one computer to another for various reasons. For information on using backup and restore to copy a database, see Copy Databases with Backup and Restore.
[!NOTE]
To set up a mirror database for database mirroring, you must restore the database onto the mirror server by usingRESTORE DATABASE <database_name> WITH NORECOVERY
. For more information, see Prepare a Mirror Database for Mirroring (SQL Server).