authorization sa
state=started
as tcp(listener_port=5022,listener_ip=all)
for database_mirroring(role=all,authentication=windows, ENCRYPTION = REQUIRED ALGORITHM RC4)
go
GRANT CONNECT ON ENDPOINT:: [Hadr_endpoint] TO [数据库服务启动账号,这里设置为service01]
gocreate endpoint [Hadr_endpoint]
authorization sa
state=started
as tcp(listener_port=5022,listener_ip=all)
for database_mirroring(role=all,authentication=windows, ENCRYPTION = REQUIRED ALGORITHM RC4)
go
GRANT CONNECT ON ENDPOINT:: [Hadr_endpoint] TO [service01]
go
GO
BACKUP DATABASE [test] TO DISK = N'D:\dbbackup\test_full.bak' WITH COMPRESSION, NOFORMAT, NOINIT
GO
02:还原数据库备份
go
restore database [test] from disk=N'D:\dbbackup\test_full.bak'
with
move 'test' to 'e:\SQL_Data\test.mdf'
,move 'test_log' to 'e:\SQL_Data\test_log.ldf'
,norecovery,replace,stats=5
go
01:主节点数据库日志备份
BACKUP log [test] TO
DISK = N'D:\dbbackup\test_log.bak' WITH COMPRESSION, NOFORMAT, NOINIT
with norecovery,stats=5
go
01:主节点创建AG
WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY)
FOR DATABASE [test]
REPLICA ON
N'test01' WITH (
ENDPOINT_URL = N'TCP://test01.pousheng.com:5022'
,FAILOVER_MODE = MANUAL
,AVAILABILITY_MODE = SYNCHRONOUS_COMMIT
,BACKUP_PRIORITY = 50
,SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL))
,N'test02' WITH (
ENDPOINT_URL = N'TCP://test02.pousheng.com:5022'
,FAILOVER_MODE = MANUAL
,AVAILABILITY_MODE = SYNCHRONOUS_COMMIT
,BACKUP_PRIORITY = 50
,SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL));
ALTER AVAILABILITY GROUP [test_AlwaysOn]
ADD REPLICA ON 'test01'
WITH (
ENDPOINT_URL = 'TCP://test01.pousheng.com:5022',
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
FAILOVER_MODE = MANUAL,
BACKUP_PRIORITY = 50,
SECONDARY_ROLE(ALLOW_CONNECTIONS = ALL)
);免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。