0

Trying to recover a full backup of a database (Version: Microsoft SQL Server 2014 (SP3-CU4-GDR) (KB4583462)) gives the following error:

Msg 15507, Level 16, State 30, Line 2 A key required by this operation appears to be corrupted.

I have created a master key on the destination server and I copied and created the TDE certificate from the source server.

1 Answer 1

1

When you backup & restore the encryption key, you need to make sure you are backing it up with a private key & password:

BACKUP CERTIFICATE MyDatabaseEncryptionCert
    TO FILE = 'E:\Backup\MyDatabaseEncryptionCert.cer'
    WITH PRIVATE KEY(
        FILE = 'E:\Backup\MyDatabaseEncryptionCert.prvk',
        ENCRYPTION BY PASSWORD = 'NotPassword1!'
        );

And on the target server, you'll use the mirrored statement to create it from that file:

CREATE CERTIFICATE MyDatabaseEncryptionCert
    FROM FILE = 'E:\Backup\MyDatabaseEncryptionCert.cer'
    WITH PRIVATE KEY(
        FILE = 'E:\Backup\MyDatabaseEncryptionCert.prvk',
        ENCRYPTION BY PASSWORD = 'NotPassword1!'
        );

If the encryption certificate is backed up without a private key (which itself is encrypted with a password), then SQL Server considers the encryption certificate backup to be untrusted. As a result, you see a 15507 error when attempting to make use of it.

Moving the cert (again) using the above method should resolve the error when restoring the TDE-encrypted backup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.