2018年12月8日 星期六

Create database mirroring without join AD

env: Windows server 2008R2
        SQL Server 2008R2

在沒有AD環境下建立database mirroring
mirror資料庫RESTORE NORECOVERY STANDBYwitnessprincipal不可置於同一SERVER。
Server1:WIN-NWRNBEAWNNP
Server2:WIN-JEA7UQF4MLS


1.調整SQL Server, SQL Agent服務帳號
很多非網域SQL Server建立database mirroring都是用憑證建立
這裡不使用憑證。
將2台SQL Server, SQL Agent服務帳號都使用同一個帳號密碼

2.要做database mirroring的db復原模式設定為full
command:
ALTER DATABASE [DB] SET RECOVERY FULL

3.在SQL Server建立database 端點,port:5024
command:
--On Server1
create endpoint [mirroring]
authorization [WIN-NWRNBEAWNNP\administrator]
state=started
as tcp (listener_port=5024)
for data_mirroring (role=partner,
authentication = windows negotiate,
encryption=required algorithm rc4)
go



--On Server2
create endpoint [mirroring]
authorization [WIN-JEA7UQF4MLS\administrator]
state=started
as tcp (listener_port=5024)
for data_mirroring (role=witness,
authentication = windows negotiate,
encryption=required algorithm rc4)
go


4.建立端點完畢後,分別啟用端點
command:
alter endpoint [mirroring] state=started
go


5.分別在secondary, primary執行database mirroring指令
command:
On secondaey
alter database mirror set partner = 'tcp://WIN-NWRNBEAWNNP:5024'
go


On primary
alter database mirror set partner = 'tcp://WIN-JEA7UQF4MLS:5024'
go


沒有錯誤就是順利完成。


沒有留言:

張貼留言