首页 > 数据库 > SQL Server > 正文

Microsoft SQL Server 2005数据库镜像语句

2024-08-31 00:52:40
字体:
来源:转载
供稿:网友

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


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表