TDE Cert File | d:\mssql_cert\tde_cert.cert |
---|---|
TDE Private Key | d:\mssql_cert\tde_private.key |
TDE Encryption Password | abcde1 |
Backup File | d:\backup\admin_20160923.bak |
Recovery Directory | d:\MSSQL\ADMIN\ |
Database Name | admindb |
Database User | db_manager |
Database Password | 12345a |
-- Restoring the certificate, but without the private key. CREATE CERTIFICATE TDECert FROM FILE = 'D:\mssql_cert\tde_cert.cert' WITH PRIVATE KEY ( FILE = N'D:\mssql_cert\admin_private.key', DECRYPTION BY PASSWORD = 'abcde1' ); GO
-- We have the correct certificate and we've also restored the -- private key. Now everything should work. Finally! restore DATABASE [admindb] FROM disk= N'D:\backup\admindb_20160923.bak' WITH move 'admindb' TO N'D:\MSSQL\ADMIN\admindb_data.mdf', move 'admindb_log' TO N'D:\MSSQL\ADMIN\admindb_data_log.ldf'; GO
sp_addlogin 'db_manager','12345a','admindb';
create login db_manager with password='12345a', default_database=admindb;
USE admindb go EXEC sp_change_users_login 'Update_One', 'db_manager', 'db_manager'