Performing the Restore with Management Studio
As with the backup command, you can launch the restore from within Management Studio by following these steps:
1. Select the database to be restored.
2. From the context or Action menu, select Tasks ? Restore ? Database to open the SQL Server Restore database form.
The Restore Database form, as shown in Figure 1,
does a great job of intelligently navigating the potential chaos of the
backup sequences, and it always offers only legal restore options.
The selection you make at the top of the form is the name of the database after the restore.
The Restore Database form can restore database
backups, file backups, or backups from a device (that is, a tape
drive). The Restore Wizard presents a hierarchical tree of backups,
whereas the filegroups or file restore lists the files and must be
manually restored in the correct order.
The Backup Sets to Restore option displays the
available backups. Management Studio uses the backup history in the
msdb system database and creates a restore plan. For example, under the
full recovery model, the restore plan selects the full database backup
followed by the most recent differential database backup (if available)
followed by subsequent log backups.
Note
If the database is in Full or
Bulk-Logged recovery mode and you did not already take a tail-log
backup, the Restore Database form will automatically select the option
for you under the Options page to perform a tail-log backup.
If the backup history, stored in msdb,
is not available — because the server is being rebuilt or the database
is being restored to a different server — then use the Restore: From
Device option to manually select the specific backup disk file and
backup instance within the file.
The process of one full backup, the second
differential backup, and the following 15 transaction-log backups can
be correctly sequenced by selecting the final transaction log to be
restored. Restoring the 17 backup files is performed with a single
click of the OK button.
If one of the backup files being restored is a
transaction log, the Point in Time Restore option becomes available
because only a transaction log can restore some of the transactions.
The point-in-time restore will restore all transactions committed
before the time selected. A new option introduced in the Restore
Database form SQL Server 2012 is the Backup Timeline form, as show in
in Figure 2.
You can access this dialog by clicking on the Timeline button on the
Restore Database (General page) pane. This Backup Timeline dialog gives
you an easy, visual indicator to help select which point-in-time you'd
like to restore the current database to.
The Options page of the Restore Database form is shown in Figure 3.
The Options tab of the Restore Database dialog box offers a few significant options:
- The Overwrite the Existing Database option disables a safety check
that prevents Database A backup from being restored as Database B and
accidentally overwriting an existing Database B.
- The Preserve the Replication Settings option preserves the
replication settings when restoring a published database on a different
SQL Server (other than the SQL Server where the database was created).
This option is available only with the Leave the Database Ready for Use
by Rolling Back the Uncommitted Transactions option.
- The Prompt Before Restoring Each Backup option prompts before
continuing to restore the next backup in the restore sequence. This
option is useful when you restore from tape backups and need to swap
tapes.
- The Restrict Access to the Restored Database option restricts access to the restored database only to the members of db_owner, dbcreator, or sysadmin.
- Because it is possible that the database is restored to a different
file location than the original backup, the Restore the Database Files
As section in the Files page includes a way to assign new file
locations.
- There are three Recovery state options to choose from when restoring a database:
- Use the RESTORE WITH RECOVERY option to restore the final backup.
This option recovers the database and does not allow additional
transaction logs to be restored.
- The RESTORE WITH NORECOVERY option leaves the database
non-operational and enables you to restore additional backups. If you
select this option, the Preserve Replication Settings option is
unavailable.
- The RESTORE WITH STANDBY option leaves the database in a standby
mode in which the database is available for limited read-only access.
If only certain files or filegroups are
restored, select Tasks ? Restore ? File or Filegroups to select the
files or filegroups you want to restore.