Microsoft SQL Server 2005数据库镜像语句

来源:赛迪网  作者:Osborn
摘要:【赛迪网-IT技术报道】Microsoft SQL Server 2005数据库镜像语句:SERVER 1CREATE ENDPOINT DbMirroringSTATE=STARTEDAS TCP(LISTENER_PORT=5023)F……

【赛迪网-IT技术报道】Microsoft SQL Server 2005数据库镜像语句:

SERVER 1

CREATE ENDPOINT DbMirroring

STATE=STARTED

AS TCP(LISTENER_PORT=5023)

FOR DATABASE_MIRRORING(ROLE=PARTNER,ENCRYPTION=SUPPORTED)

ALTER DATABASE AdventureWorks SET PARTNER='TCP://192.168.5.106:5022'


SERVER 2

CREATE ENDPOINT DbMirroring

STATE=STARTED

AS TCP(LISTENER_PORT=5022)

FOR DATABASE_MIRRORING(ROLE=PARTNER,ENCRYPTION=SUPPORTED)

ALTER DATABASE AdventureWorks SET PARTNER='TCP://192.168.5.106:5023'


见证服务器

CREATE ENDPOINT DbMirroring

STATE=STARTED

AS TCP(LISTENER_PORT=5033)

FOR DATABASE_MIRRORING(ROLE=WITNESS,ENCRYPTION=SUPPORTED)

ALTER DATABASE AdventureWorks SET PARTNER='TCP://192.168.5.106:5033'


执行下面的代码就可以将镜像服务器设为主体服务器,主体服务器设置为镜像服务器:

USE MASTER

Go

ALTER DATABASE AdventureWorks SET PARTNER FAILOVER

Go

【相关文章】好搜一下
SQL SERVER数据库备份/恢复测试报告

SQL SERVER数据库备份/恢复测试报告

为避免因火灾或软硬件故障等特殊原因而导致的数据丢失,数据库管理员通常需要制定一个…