Ócáid
Mar 31, 11 PM - Apr 2, 11 PM
An ócáid foghlama SQL, Fabric and Power BI is mó. Márta 31 – 2 Aibreán. Bain úsáid as cód FABINSIDER chun $ 400 a shábháil.
Cláraigh inniuNí thacaítear leis an mbrabhsálaí seo a thuilleadh.
Uasghrádú go Microsoft Edge chun leas a bhaint as na gnéithe is déanaí, nuashonruithe slándála, agus tacaíocht theicniúil.
Applies to:
SQL Server
This topic describes how to restore the database master key in SQL Server by using Transact-SQL.
When the master key is restored, SQL Server decrypts all the keys that are encrypted with the currently active master key, and then encrypts these keys with the restored master key. This resource-intensive operation should be scheduled during a period of low demand. If the current database master key isn't open or can't be opened, or if any of the keys that are encrypted by it cannot be decrypted, the restore operation fails.
If any one of the decryptions fails, the restore will fail. You can use the FORCE option to ignore errors, but this option will cause the loss of any data that cannot be decrypted.
If the master key was encrypted by the service master key, the restored master key will also be encrypted by the service master key.
If there's no master key in the current database, RESTORE MASTER KEY creates a master key. The new master key won't be automatically encrypted with the service master key.
Requires CONTROL permission on the database.
Retrieve a copy of the backed-up database master key, either from a physical backup medium or a directory on the local file system.
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute.
-- Restores the database master key of the AdventureWorks2022 database.
USE AdventureWorks2022;
GO
RESTORE MASTER KEY
FROM FILE = 'c:\backups\keys\AdventureWorks2022_master_key'
DECRYPTION BY PASSWORD = '3dH85Hhk003#GHkf02597gheij04'
ENCRYPTION BY PASSWORD = '259087M#MyjkFkjhywiyedfgGDFD';
GO
Nóta
The file path to the key and the key's password (if it exists) will be different than what is indicated above. Please make sure that both are specific to your server and key set-up.
Ócáid
Mar 31, 11 PM - Apr 2, 11 PM
An ócáid foghlama SQL, Fabric and Power BI is mó. Márta 31 – 2 Aibreán. Bain úsáid as cód FABINSIDER chun $ 400 a shábháil.
Cláraigh inniuOiliúint
Modúl
Back up and restore your Azure SQL database - Training
Learn how to protect the data in your Azure SQL database and recover from data loss or corruption with backup and restore.
Deimhniú
Microsoft Certified: Azure Database Administrator Associate - Certifications
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.
Doiciméadúchán
BACKUP MASTER KEY (Transact-SQL) - SQL Server
BACKUP MASTER KEY (Transact-SQL)
Back Up the Service Master Key - SQL Server
Learn how to back up the service master key in SQL Server by using Transact-SQL. The service master key is the root of the encryption hierarchy.
OPEN MASTER KEY (Transact-SQL) - SQL Server
OPEN MASTER KEY (Transact-SQL)