gebeurtenis
31 mrt, 23 - 2 apr, 23
De grootste SQL-, Fabric- en Power BI-leerevenement. 31 maart – 2 april. Gebruik code FABINSIDER om $ 400 te besparen.
Zorg dat u zich vandaag nog registreertDeze browser wordt niet meer ondersteund.
Upgrade naar Microsoft Edge om te profiteren van de nieuwste functies, beveiligingsupdates en technische ondersteuning.
Applies to:
SQL Server
This topic explains how to restore a full database backup.
Belangrijk
The system administrator restoring the full database backup must be the only person currently using the database to be restored.
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.
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 Transact-SQL 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 on the database on a nonproduction server and also examine the code, such as stored procedures or other user-defined code, in the database.
The compatibility levels of the tempdb, model, msdb and Resource databases are set to the compatibility level of SQL Server 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 SQL Server 2016 (13.x) and greater.
Notitie
New user databases will inherit the compatibility level of the model database.
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.
Belangrijk
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.
Optionally, specify:
Notitie
If you restore an earlier version database to a newer version of SQL Server, the database is automatically upgraded. Typically, the database becomes available immediately. However, if a SQL Server 2005 (9.x) 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.
This example restores the AdventureWorks2022
full database backup from tape.
USE master;
GO
RESTORE DATABASE AdventureWorks2022
FROM TAPE = '\\.\Tape0';
GO
Complete Database Restores (Full Recovery Model)
Complete Database Restores (Simple Recovery Model)
Full Database Backups (SQL Server)
RESTORE (Transact-SQL)
Backup History and Header Information (SQL Server)
Rebuild System Databases
gebeurtenis
31 mrt, 23 - 2 apr, 23
De grootste SQL-, Fabric- en Power BI-leerevenement. 31 maart – 2 april. Gebruik code FABINSIDER om $ 400 te besparen.
Zorg dat u zich vandaag nog registreertTraining
Certificering
Microsoft Certified: Azure Database Administrator Associate - Certifications
Beheer een SQL Server-databaseinfrastructuur voor cloud-, on-premises en hybride relationele databases met behulp van de relationele Microsoft PaaS-databaseaanbiedingen.
Documentatie
Restore sequences (Full Recovery Model) - SQL Server
Learn how to plan and perform a restore sequence, consisting of RESTORE statements, for a SQL Server database that ordinarily uses the full recovery model.
Complete Database Restores (Full Recovery Model) - SQL Server
Learn about a complete SQL Server database restore, where all data is recovered to a consistent point in time.
Restore and Recovery Overview (SQL Server) - SQL Server
Learn about the operations involved in recovering a SQL Server database from a failure by restoring a set of SQL Server backups in sequence.