WEB开发网
开发学院数据库MSSQL Server SQL Server 2008的透明数据加密 阅读

SQL Server 2008的透明数据加密

 2008-08-09 09:55:09 来源:WEB开发网   
核心提示: 第一个步骤备份了这个数据库,第二部分需要运行在一个不同的SQL Server 2008实例上,SQL Server 2008的透明数据加密(4),当你尝试在一个不同的SQL Server 2008实例中恢复这个备份时,你将得到一个类似于下面所示的错误信息:10percentprocesse

第一个步骤备份了这个数据库。第二部分需要运行在一个不同的SQL Server 2008实例上。当你尝试在一个不同的SQL Server 2008实例中恢复这个备份时,你将得到一个类似于下面所示的错误信息:  

10percentprocessed.
20percentprocessed.
31percentprocessed.
41percentprocessed.
52percentprocessed.
62percentprocessed.
73percentprocessed.
83percentprocessed.
94percentprocessed.
100percentprocessed.
  Msg33111,Level16,State3,Line1
  Cannotfindservercertificatewiththumbprint'0x8AD8C0A89476752FCC3D7A7005A2DCF546C38C58'.
  Msg3013,Level16,State1,Line1
  RESTOREDATABASEisterminatingabnormally.

当你尝试将这个数据库附加到另一个实例中去时你将面对相同的问题。

USE [master]
GO
CREATE DATABASE [TestDatabase] ON
( FILENAME = N'D:TestTestDatabase.mdf'),
( FILENAME = N'D:TestTestDatabase_log.ldf')
FOR ATTACH
GO

上面代码的结果是:

Msg 33111, Level 16, State 3, Line 1

Cannot find server certificate with thumbprint '0x8AD8C0A89476752FCC3D7A7005A2DCF546C38C58'.

它起作用了。我们的数据库是安全的了。恢复或附加TestDatabase 到另一个实例中去的唯一方法是在第二个实例中添加相同的证书。学习下面的代码:

-- backup the certificate
-- The private key will be encrypted by the password specified
BACKUP CERTIFICATE DEKCertificate TO FILE = 'E:DEKCertificate.cert'
     WITH PRIVATE KEY
     (
         FILE = 'E:Instance1PrivateKey.key',
         ENCRYPTION BY PASSWORD = 'Pa$$w0rd5454'
     )
-- create the certificate in the second instance by using the backup
-- Private key will be loaded from the saved file.
USE [master]
GO
CREATE CERTIFICATE DEKCertificate
     FROM FILE = 'E:DEKCertificate.cert'
     WITH PRIVATE KEY (
         FILE = 'E:Instance1PrivateKey.key'
         , DECRYPTION BY PASSWORD = 'Pa$$w0rd5454'
         )

上一页  1 2 3 4 5 6  下一页

Tags:SQL Server 透明

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接