When you specify a restore task by using SQL Server Management Studio, you can generate the corresponding Transact-SQL RESTORE script by clicking the Script button and then selecting a destination for the script.

Destination for restore

The options of the Destination for restore panel identify the database and restore point.

To database

Enter the database to restore in the list. You can enter a new database or choose an existing database from the drop-down list. The list includes all databases on the server, excluding the system databases master and tempdb.

Note:

To restore a password-protected backup, you must use the RESTORE statement.

To a point in time

Restore the database to the most recent time available in the backups or to a particular point in time. The default is Most recent possible. To specify a specific point in time, click the browse button. For more information, see Restoring a Database to a Point Within a Backup.

The date and time are indicated in the regional setting of the client.

Source for restore

The options of the Source for restore panel identify the location of the backup sets for the database and which backup sets you want to restore.

From database

Select the database to restore from the list box. This list contains only databases that have been backed up according to the msdb backup history.

From device

Select the logical or physical backup devices (tapes or files) that contain the backup or backups you want to restore.

To select one or more logical or physical backup devices, click the browse button which opens the Specify Backup dialog box. There, you can select up to 64 devices that belong to a single media set. Tape devices must be physically connected to the computer that is running the instance of SQL Server. A backup file can be on a local or remove disk device. For more information, see Backup Devices.

When you exit the Specify Backup dialog box, the selected device will appear as read-only values in the From device list.

Select the backup sets to restore

Displays the backup sets available for the specified location. Each backup set, the result of a single backup operation, is distributed across all of the devices in the media set. By default, a recovery plan is suggested to achieve the goal of the restore operation that is based on the selection of the required backup sets. SQL Server Management Studio uses the backup history in msdb to identify which backups are required to restore a database, and creates a restore plan. For example, for a database restore, the restore plan selects the most recent full database backup followed by the most recent subsequent differential database backup, if any. Under the full recovery model, the restore plan then selects all subsequent log backups.

To override the suggested recovery plan, you can change the selections in the grid. Any backups that depend on a deselected backup are deselected automatically.