标签:style blog http color os io strong 文件 for
新添加了一台服务器,做原来服务器的备份机,用交叉线+双网卡配置了内网。
1 select@@version;
1 USE master; 2 ALTER DATABASE <DatabaeName> //<DatabaeName>既为需要配置镜像的数据库名 3 SET RECOVERY FULL;
1 USE master; 2 select sid,name from syslogins;
1 USE master; 2 exec sp_addlogin 3 @loginame=‘<LoginName>‘, 4 @passwd=‘<Password>‘, 5 @sid=<sid>;
1 USE master; 2 CREATE MASTER KEY ENCRYPTION BY PASSWORD =‘证书的密码‘; 3 CREATE CERTIFICATE HOST_A_cert WITH SUBJECT =‘HOST_A certificate‘, 4 START_DATE =‘08/21/2014‘;
1 USE master; 2 CREATE MASTER KEY ENCRYPTION BY PASSWORD =‘证书的密码‘; 3 CREATE CERTIFICATE HOST_B_cert WITH SUBJECT =‘HOST_B certificate‘, 4 START_DATE =‘08/21/2014‘;
1 DROP CERTIFICATE HOST_A_cert 2 drop master key
1 CREATE ENDPOINT Endpoint_Mirroring 2 STATE = STARTED 3 AS 4 TCP ( LISTENER_PORT=5022, LISTENER_IP = ALL ) 5 FOR 6 DATABASE_MIRRORING 7 ( AUTHENTICATION = CERTIFICATE HOST_A_cert , ENCRYPTION = REQUIRED ALGORITHM AES , ROLE = ALL );
1 CREATE ENDPOINT Endpoint_Mirroring 2 STATE = STARTED 3 AS 4 TCP ( LISTENER_PORT=5022, LISTENER_IP = ALL ) 5 FOR 6 DATABASE_MIRRORING 7 ( AUTHENTICATION = CERTIFICATE HOST_B_cert , ENCRYPTION = REQUIRED ALGORITHM AES , ROLE = ALL );
BACKUP CERTIFICATE HOST_A_cert TO FILE =‘D:\SQLBackup\HOST_A_cert.cer‘;
BACKUP CERTIFICATE HOST_B_cert TO FILE =‘D:\SQLBackup\HOST_B_cert.cer‘;
CREATE LOGIN HOST_B_login WITH PASSWORD =‘证书的密码‘; CREATE USER HOST_B_user FOR LOGIN HOST_B_login; CREATE CERTIFICATE HOST_B_cert AUTHORIZATION HOST_B_user FROM FILE =‘D:\SQLBackup\HOST_B_cert.cer‘; GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [HOST_B_login];
CREATE LOGIN HOST_A_login WITH PASSWORD =‘证书的密码‘; CREATE USER HOST_A_user FOR LOGIN HOST_A_login; CREATE CERTIFICATE HOST_A_cert AUTHORIZATION HOST_A_user FROM FILE =‘D:\SQLBackup\HOST_A_cert.cer‘; GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [HOST_A_login];
ALTER DATABASE NewDB SET PARTNER = N‘TCP://hostA:5022‘-- boat主机名 GO
ALTER DATABASE NewDB SET PARTNER = N‘TCP://hostB:5022‘-- boat主机名 GO
无法启用数据库镜像,因为‘NewDB‘数据库在两个伙伴上都不处于完全恢复模式
镜像数据库"pqsys_config"包含的事务日志数据不足,无法保留主体数据库的日志备份链。如果没有从主体数据库进行日志备份或者没有在镜像数据库上还原日志备份,则可能会出现这种情况。
标签:style blog http color os io strong 文件 for
原文地址:http://www.cnblogs.com/mnight/p/90368a202f8d6d3ff31b5b938810a52d.html