Udostępnij za pośrednictwem


How to: Restore a Database Backup (Transact-SQL)

This topic explains how to restore a full database backup.

Important

The system administrator restoring the full database backup must be the only person currently using the database to be restored.

To restore a full database backup

  1. Execute the RESTORE DATABASE statement to restore the full database backup, specifying:

    • The name of the database to restore.
    • The backup device from where the full database backup is restored.
    • The NORECOVERY clause if you have a transaction log or differential database backup to apply after restoring the full database backup.
  2. Optionally, specify:

    • The FILE clause to identify the backup set on the backup device to restore.

Example

This example restores the AdventureWorks full database backup from tape.

USE master
GO
RESTORE DATABASE AdventureWorks
   FROM TAPE = '\\.\Tape0'
GO

See Also

Tasks

How to: Apply a Transaction Log Backup (Transact-SQL)

Concepts

Performing a Complete Database Restore (Full Recovery Model)
Performing a Complete Database Restore (Simple Recovery Model)
Full Database Backups
Setting Database Options
Viewing Information About Backups
Optimizing Backup and Restore Performance in SQL Server
Considerations for Rebuilding the master Database
Considerations for Restoring the model and msdb Databases

Other Resources

RESTORE (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance