--- title: "Restore database: simple recovery model (Transact-SQL)" ms.custom: seo-lt-2019 ms.date: "12/17/2019" ms.prod: sql ms.prod_service: backup-restore ms.reviewer: "" ms.technology: backup-restore ms.topic: conceptual helpviewer_keywords: - "full backups [SQL Server]" - "database restores [SQL Server], full backups" - "backing up databases [SQL Server], full backups" - "database backups [SQL Server], full backups" - "restoring databases [SQL Server], full backups" ms.assetid: a928fa36-e285-476f-9a7b-6840a8bb7283 author: MikeRayMSFT ms.author: mikeray --- # Restore a database backup under the simple recovery model (Transact-SQL) [!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md](../../includes/appliesto-ss-xxxx-xxxx-xxx-md.md)] 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. ## Prerequisites and Recommendations - To restore a database that is encrypted, you must have access to the certificate or asymmetric key that was used to encrypt the database. Without the certificate or asymmetric key, the database cannot be restored. As a result, the certificate that is used to encrypt the database encryption key must be retained as long as the backup is needed. For more information, see [SQL Server Certificates and Asymmetric Keys](../../relational-databases/security/sql-server-certificates-and-asymmetric-keys.md). - For security purposes, we recommend that you do not attach or restore databases from unknown or untrusted sources. Such databases could contain malicious code that might execute unintended [!INCLUDE[tsql](../../includes/tsql-md.md)] code or cause errors by modifying the schema or the physical database structure. Before you use a database from an unknown or untrusted source, run [DBCC CHECKDB](../../t-sql/database-console-commands/dbcc-checkdb-transact-sql.md) on the database on a nonproduction server and also examine the code, such as stored procedures or other user-defined code, in the database. ## Database Compatibility Level After Upgrade The compatibility levels of the **tempdb**, **model**, **msdb** and **Resource** databases are set to the compatibility level of [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] after upgrade. The **master** system database retains the compatibility level it had before upgrade, unless that level was less than 100. If the compatibility level of **master** was less than 100 before upgrade, it is set to 100 after upgrade. If the compatibility level of a user database was 100 or higher before upgrade, it remains the same after upgrade. If the compatibility level was 90 before upgrade, in the upgraded database, the compatibility level is set to 100, which is the lowest supported compatibility level in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]. > [!NOTE] > New user databases will inherit the compatibility level of the **model** database. ## Procedures #### 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. > [!IMPORTANT] > To restore a database that is encrypted, you must have access to the certificate or asymmetric key that was used to encrypt the database. Without the certificate or asymmetric key, the database cannot be restored. As a result, the certificate that is used to encrypt the database encryption key must be retained as long as the backup is needed. For more information, see [SQL Server Certificates and Asymmetric Keys](../../relational-databases/security/sql-server-certificates-and-asymmetric-keys.md). 2. Optionally, specify: - The FILE clause to identify the backup set on the backup device to restore. > [!NOTE] > If you restore an earlier version database to [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)], the database is automatically upgraded. Typically, the database becomes available immediately. However, if a [!INCLUDE[ssVersion2005](../../includes/ssversion2005-md.md)] database has full-text indexes, the upgrade process either imports, resets, or rebuilds them, depending on the setting of the **upgrade_option** server property. If the upgrade option is set to import (**upgrade_option** = 2) or rebuild (**upgrade_option** = 0), the full-text indexes will be unavailable during the upgrade. Depending the amount of data being indexed, importing can take several hours, and rebuilding can take up to ten times longer. Note also that when the upgrade option is set to import, the associated full-text indexes are rebuilt if a full-text catalog is not available. To change the setting of the **upgrade_option** server property, use [sp_fulltext_service](../../relational-databases/system-stored-procedures/sp-fulltext-service-transact-sql.md). ## Example ### Description This example restores the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] full database backup from tape. ### Example ``` USE master; GO RESTORE DATABASE AdventureWorks2012 FROM TAPE = '\\.\Tape0'; GO ``` ## See Also [Complete Database Restores (Full Recovery Model)](../../relational-databases/backup-restore/complete-database-restores-full-recovery-model.md) [Complete Database Restores (Simple Recovery Model)](../../relational-databases/backup-restore/complete-database-restores-simple-recovery-model.md) [Full Database Backups (SQL Server)](../../relational-databases/backup-restore/full-database-backups-sql-server.md) [RESTORE (Transact-SQL)](../../t-sql/statements/restore-statements-transact-sql.md) [Backup History and Header Information (SQL Server)](../../relational-databases/backup-restore/backup-history-and-header-information-sql-server.md) [Rebuild System Databases](../../relational-databases/databases/rebuild-system-databases.md)