SQL Server 2008的透明数据加密
2008-08-09 09:55:09 来源:WEB开发网第一个步骤备份了这个数据库。第二部分需要运行在一个不同的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'
)
- ››sql server自动生成批量执行SQL脚本的批处理
- ››sql server 2008亿万数据性能优化
- ››SQL Server 2008清空数据库日志方法
- ››sqlserver安装和简单的使用
- ››SQL Sever 2008 R2 数据库管理
- ››SQL SERVER无法安装成功,sqlstp.log文件提示[未发...
- ››Sql Server中通过父记录查找出所有关联的子记录
- ››SqlServer触发器、存储过程和函数
- ››SQL Server 中的事务(含义,属性,管理)
- ››Sqlite数据库插入和读取图片数据
- ››Sql server 2005拒绝了对对象 'xx表' (数...
- ››Sql server 2005拒绝了对对象 'xx表' (数...
更多精彩
赞助商链接