91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Sqlserver關于TDE透明數據加密的使用總結

發布時間:2020-08-05 02:14:37 來源:ITPUB博客 閱讀:446 作者:lusklusklusk 欄目:關系型數據庫

官方文檔https://docs.microsoft.com/zh-cn/sql/t-sql/statements/create-certificate-transact-sql?view=sql-server-2017


TDE:Transparent Data Encryption透明數據加密


master key XX:SSMS圖形界面工具中見master-security-symmetric key或見sys.symmetric_keys

CERTIFICATE YY:SSMS圖形界面工具中見master-security-certificates或見sys.certificates


數據庫啟用TDE:

大致步驟

在master數據庫里創建主密匙。

創建/使用受主密匙保護的證書。

對某個受證書保護的數據庫加密密匙。

對某個數據庫啟用TDE。


1、先drop master key主秘鑰

drop master key

如果報錯,說明有certificate在使用它,需要先把certificate刪除再刪除master key

Cannot drop master key because certificate 'C_databaseXX' is encrypted by it.


2、創建master key主秘鑰

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'XX';

示例create master key encryption by password = 'TD_123456';


3、創建certificate證書,名稱一般為certdbname

create certificate certtificatename with subject ='XX';

示例create certificate certSSRSTEST with subject ='SSRSTEST database certificate data encription';


4、備份上面第3步創建certificate證書

BACKUP CERTIFICATE certtificatename TO FILE = 'XX'

WITH PRIVATE KEY ( FILE = 'XXkey' ,

ENCRYPTION BY PASSWORD = 'XX' );

示例

BACKUP CERTIFICATE certSSRSTEST TO FILE = '\\testdb1\mirror\certSSRSTEST'

WITH PRIVATE KEY ( FILE = '\\testdb1\mirror\certSSRSTESTkey' ,

ENCRYPTION BY PASSWORD = '654321_DT' );


5、對某個數據庫使用上面第3步的certificate進行加密,并啟用這個加密

create database encryption key with algorithm = XX encryption by server certificate certtificatename

alter database databasename set encryption on

示例

use SSRSTEST;

go

create database encryption key with algorithm = AES_128 encryption by server certificate certSSRSTEST

go

alter database SSRSTEST set encryption on

go



異機恢復一個TDE備份的數據庫

1、備份TDE數據庫庫

backup database SSRSTEST to disk = '\\testdb1\mirror\SSRSTEST.bak'


2、異機恢復這個數據庫

2.1、異機創建master key,這個密碼可以隨便

create master key encryption by password = '999_TD999';

2.2、異機創建CERTIFICATE證書,這個 密碼必須和源端備份CERTIFICATE時的密碼一致(即上面第4步) ,否則會報錯

CREATE CERTIFICATE certClientData

FROM FILE='\\testdb1\mirror\certSSRSTEST'

WITH PRIVATE KEY(

FILE='\\testdb1\mirror\certSSRSTESTkey',

DECRYPTION BY PASSWORD='654321_DT')

2.3、

restore database SSRSTEST from disk = '\\testdb1\mirror\SSRSTEST.bak'



異機恢復這個數據庫時如果直接恢復,有報錯,說明需要在異機創建certificate證書

restore database SSRSTEST from disk = '\\testdb1\mirror\SSRSTEST.bak'

報錯Cannot find server certificate with thumbprint '0x1640C78B8E4C6DCFA2DB4D2E97E3B206F2672FAB'.


異機創建certificate證書,有報錯說明DECRYPTION BY PASSWORD必須等于上面第4步的ENCRYPTION BY PASSWORD = '654321_DT'

use master;

go

CREATE CERTIFICATE certClientData

FROM FILE='\\testdb1\mirror\certSSRSTEST'

WITH PRIVATE KEY(

FILE='\\testdb1\mirror\certSSRSTESTkey',

DECRYPTION BY PASSWORD='TD_123456')

go

報錯The private key password is invalid


異機創建certificate證書,正確密碼還有報錯,說明需要先在異機建立master key

use master;

go

CREATE CERTIFICATE certClientData

FROM FILE='\\testdb1\mirror\certSSRSTEST'

WITH PRIVATE KEY(

FILE='\\testdb1\mirror\certSSRSTESTkey',

DECRYPTION BY PASSWORD='654321_DT')

go

報錯Please create a master key in the database or open the master key in the session before performing this operation.


創建master key隨便設置密碼password = '999_TD999',創建證書輸入正確密碼PASSWORD='654321_DT',一切正常

use master;

create master key encryption by password = '999_TD999';

CREATE CERTIFICATE certClientData

FROM FILE='\\testdb1\mirror\certSSRSTEST'

WITH PRIVATE KEY(

FILE='\\testdb1\mirror\certSSRSTESTkey',

DECRYPTION BY PASSWORD='654321_DT')

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

武乡县| 合作市| 阳泉市| 扎兰屯市| 湾仔区| 驻马店市| 新邵县| 仲巴县| 河南省| 新平| 乡城县| 外汇| 繁峙县| 开阳县| 陵水| 东丽区| 泗阳县| 南澳县| 南充市| 井研县| 定安县| 马公市| 阳原县| 庄浪县| 华蓥市| 淮阳县| 庆安县| 乌鲁木齐市| 永顺县| 右玉县| 兴仁县| 建平县| 雅江县| 汾阳市| 怀集县| 富平县| 延寿县| 郸城县| 景东| 松原市| 上杭县|