[sql-server-2008] How to restore to a different database in sql server?

For SQL Server 2012, using Sql Server Management Studio, I found these steps from the Microsoft page useful to restore to a different database file and name: (ref: http://technet.microsoft.com/en-us/library/ms175510.aspx)

Note steps 4 and 7 are important to set so as not to overwrite the existing database.


To restore a database to a new location, and optionally rename the database

  1. Connect to the appropriate instance of the SQL Server Database Engine, and then in Object Explorer, click the server name to expand the server tree.
  2. Right-click Databases, and then click Restore Database. The Restore Database dialog box opens.
  3. On the General page, use the Source section to specify the source and location of the backup sets to restore. Select one of the following options:

    • Database

      • Select the database to restore from the drop-down list. The list contains only databases that have been backed up according to the msdb backup history.

        Note If the backup is taken from a different server, the destination server will not have the backup history information for the specified database. In this case, select Device to manually specify the file or device to restore.

    • Device

      • Click the browse (...) button to open the Select backup devices dialog box. In the Backup media type box, select one of the listed device types. To select one or more devices for the Backup media box, click Add. After you add the devices you want to the Backup media list box, click OK to return to the General page. In the Source: Device: Database list box, select the name of the database which should be restored.

        Note This list is only available when Device is selected. Only databases that have backups on the selected device will be available.

  4. In the Destination section, the Database box is automatically populated with the name of the database to be restored. To change the name of the database, enter the new name in the Database box.
  5. In the Restore to box, leave the default as To the last backup taken or click on Timeline to access the Backup Timeline dialog box to manually select a point in time to stop the recovery action.
  6. In the Backup sets to restore grid, select the backups to restore. This grid displays the backups available for the specified location. By default, a recovery plan is suggested. To override the suggested recovery plan, you can change the selections in the grid. Backups that depend on the restoration of an earlier backup are automatically deselected when the earlier backup is deselected.
  7. To specify the new location of the database files, select the Files page, and then click Relocate all files to folder. Provide a new location for the Data file folder and Log file folder. Alternatively you can keep the same folders and just rename the database and log file names.

Examples related to sql-server-2008

Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object How to Use Multiple Columns in Partition By And Ensure No Duplicate Row is Returned SQL Server : How to test if a string has only digit characters Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query Get last 30 day records from today date in SQL Server How to subtract 30 days from the current date using SQL Server Calculate time difference in minutes in SQL Server SQL Connection Error: System.Data.SqlClient.SqlException (0x80131904) SQL Server Service not available in service list after installation of SQL Server Management Studio How to delete large data of table in SQL without log?

Examples related to backup

input file appears to be a text format dump. Please use psql How can I backup a Docker-container with its data-volumes? Backup/Restore a dockerized PostgreSQL database Export MySQL database using PHP only Tar a directory, but don't store full absolute paths in the archive How to extract or unpack an .ab file (Android Backup file) mysqldump with create database line Postgresql 9.2 pg_dump version mismatch How to backup Sql Database Programmatically in C# Opening a SQL Server .bak file (Not restoring!)

Examples related to restore

"No backupset selected to be restored" SQL Server 2012 Opening a SQL Server .bak file (Not restoring!) What does "restore purchases" in In-App purchases mean? SQL Server Restore Error - Access is Denied How to take backup of a single table in a MySQL database? How to restore to a different database in sql server? Restore DB — Error RESTORE HEADERONLY is terminating abnormally. Restore a postgres backup file using the command line? When restoring a backup, how do I disconnect all active connections? Can I restore a single table from a full mysql mysqldump file?