本文基于整庫複制的(warm standby):
複制服務器名字 : HRB_REP
主數據庫服務器和主庫HRB_HB.maindb to 備份數據庫服務器和備份庫HRB_HB_REP.maindb
◆1. 複制服務器和ASE數據庫的interfaces中都要包括上面三個server的接口信息
◆2. 用複制服務器安裝的用戶登錄。
◆3. 使用/repsrv/REP-12_5/install/rs_init 安裝複制服務器
(ctrl-a 接受 ctrl-b 向後 ctrl-x 退出)
1>; Configure a Server product
2>; Replication Server
3>; Install a new Replication Server
3.1>; Replication Server Information
3.1.1 輸入複制服務器的名字 HRB_REP
3.1.2 Is this Replication Server the ID Server 選擇Yes
3.2>; Replication Server System Database
3.2.1 RSSD SQL Server Name: 輸入安裝複制服務器系統庫的數據庫服務器名字HRB_HB_REP
3.2.2 Create RSSD : 如果沒有建過這個庫,選Yes
3.2.3 SA password : 輸入sa口令
3.3>; RSSD Device Information
3.3.1 Size of the RSSD Database: 輸入HRB_REP_RSSD數據庫的大小(30-50M)
3.3.2 RSSD device name : 輸入數據庫設備的名字
3.3.3 如果數據庫中沒有建立設備,選擇 Create the RSSD device 並輸入設備文件名和大小
3.3.4 Size of the RSSD Database: 輸入HRB_REP_RSSD日志的大小(30-50M)
3.4>; Disk Partition
3.4.1 Partition文件必須存在,可以使用 >;filename(或touch filename) 創建
3.4.2 Disk Partition Path: 輸入partition文件的文件名
3.4.3 Logical Identifier for Disk Partition: 輸入partition在複制服務器中的邏輯名
3.4.4 Size of Disk Partition: 輸入Partiton的大小(一定要分配足夠大的空間,否則在大的事務複制時會因爲partition滿而出錯)
3.5>; 如果所有選項全部爲complete狀態,按ctrl-a創建複制服務器
創建完後不要退出rs_init,後面還要用
◆4. 在主點數據庫和備份點數據庫服務器中分別執行
設置數據庫服務器可以複制
isql -Usa -P; -S;
1>; use master
2>; go
1>; sp_configure 'enable rep agent threads',1
2>; go
如果maindb沒有設置select into 選項,需要如下設置
1>; use master
2>; go
1>; sp_dboption maindb,'select into',true
2>; go
1>; use maindb
2>; go
1>; checkpoint
2>; go
◆5. 在複制服務器中執行
isql -Usa -P -S;
1>; create logical connection to HRB_HB.maindb
2>; go
◆6. 在rs_init中增加主庫到複制中,選擇 add a database to the replication system
6.1>; Replication Server Information
6.1.1>; 輸入複制服務器名字HRB_REP
6.2>; Database Information
6.2.1>; SQL Server Name: 輸入主數據庫服務器名HRB_HB
6.2.2>; SA password : 輸入sa口令
6.2.3>; Database name: 輸入主庫名maindb
6.2.4>; Will database be replicated : 選擇Yes
6.2.5>; Is this a Physical Connection for Existing Logical Connection: 選擇Yes
6.2.6>; Logical DB Setup
6.2.6.1>; Is this an Active Connection or Standby Connection: 選擇active
6.2.6.2>; Logical DS Name : 輸入主服務器名HRB_HB
6.2.6.3>; Logical DB Name : 輸入主數據庫名maindb
6.3>; 如果所有選項全部爲complete狀態,添加數據庫
◆7. 在主數據庫服務器中執行
isql -Usa -P; -SHRB_HB
1>; use maindb
2>; go
1>; sp_reptostandby maindb,"ALL"
2>; go
1>; grant role sa_role to maindb_maint
2>; go
在備份數據庫服務器中執行
isql -Usa -P; -SHRB_HB_REP
1>; use master
2>; go
1>; sp_addlogin maindb_maint,maindb_maint_ps,@defdb="maindb"
2>; go
1>; use maindb
2>; go
1>; sp_adduser maindb_maint
2>; go
1>; grant role sa_role to maindb_maint
2>; go
◆8. 同步主庫HRB_HB和備份庫HRB_HB_REP的login和role、權限等,要保證兩台機器的login id一致
◆9. 在rs_init中增加備份庫到複制中,選擇 add a database to the replication system
9.1>; Replication Server Information
9.1.1>; 輸入複制服務器名字HRB_REP
9.2>; Database Information
9.2.1>; SQL Server Name: 輸入備份數據庫服務器名HRB_HB_REP
9.2.2>; SA password : 輸入sa口令
9.2.3>; Database name: 輸入主庫名maindb
9.2.4>; Will database be replicated : 選擇Yes
9.2.5>; Is this a Physical Connection for Existing Logical Connection: 選擇Yes
9.2.6>; Logical DB Setup
9.2.6.1>; Is this an Active Connection or Standby Connection: 輸入standby
9.2.6.2>; Logical DS Name : 輸入主服務器名HRB_HB
9.2.6.3>; Logical DB Name : 輸入主數據庫名maindb
9.2.6.4>; Active DS Name : 輸入主服務器名HRB_HB
9.2.6.5>; Active DB Name : 輸入主數據庫名maindb
9.2.6.6>; Active Db sa password : 輸入主數據庫sa口令
9.3>; 如果所有選項全部爲complete狀態,添加數據庫
◆10. 從主庫dump到備份庫load&online
◆11. 在複制服務器中恢複連接
isql -Usa -P -SHRB_REP
1>; resume connection to HRB_HB.maindb
2>; go
1>; resume connection to HRB_HB_REP.maindb
2>; go
◆12. 修改備份庫HRB_HB_REP的參數與主庫HRB_HB一致,鎖的數量最好要大于主庫。