sqlserver创建修改主密钥---备份数据库用到

1.前言。
  如题。注意,直接删可能删不掉的。创建主密钥后最好备份下脚本或者做好记录,忘记了主密钥就不能再打开了。
2.创建修改主密钥
--(1)创建主密钥

create MASTER KEY ENCRYPTION BY PASSWORD = '123456'; 
---(2)以下为修改主密钥
OPEN MASTER KEY DECRYPTION BY PASSWORD = '123456' 

 
ALTER MASTER KEY DROP ENCRYPTION BY SERVICE MASTER KEY

ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY

 

ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = '123456'



你可能感兴趣的:(sqlserver)