Thứ Sáu, 21 tháng 6, 2019

Thủ tục switchover Oracle DataGuard

STT
Công việc
Câu lệnh tại máy primay 192.168.0.22
Câu lệnh tại máy standby 192.168.0.11
1
Kiểm tra đồng bộ log giữa 2 máy
ALTER SESSION SET nls_date_format='DD-MON-YYYY HH24:MI:SS';
SELECT sequence#, first_time, next_time
FROM   v$archived_log
ORDER BY sequence#;
kết quả:
3289 29-MAY-2017 16:55:53 29-MAY-2017 17:20:49
ALTER SESSION SET nls_date_format='DD-MON-YYYY HH24:MI:SS';
SELECT sequence#, first_time, next_time, applied
FROM   v$archived_log
ORDER BY sequence#;
kết quả:
3289 29-MAY-2017 16:55:53 29-MAY-2017 17:20:49 YES
2
Nếu trên máy standby trạng thái NO
thì  chuyển về Yes

recover standby database;
3
Tắt database trên máy 11

sqlplus / as sysdba
shutdown immediate
4
Bật lại database máy 11

sqlplus / as sysdba
startup mount
5
apply log trên máy standby 11

alter database recover managed standby database
 disconnect from session;
6
Thực hiện switchover tư máy
22 sáng máy 11 thực hiên trên máy 22
trước sau đó thực thi trên máy 11
sqlplus / as sysdba
alter database commit to switchover to standby;
-- Mount old primary database to standby database
alter database mount standby database;
alter database recover managed standby database
 disconnect from session;
sqlplus  / as sysdba
alter database commit to switchover to primary;
--Shutdown standby database
shutdown immediate
-- Open old standby database to primary
startup;
7
Tắt Database máy 22
sqlplus / as sysdba
shutdown immediate

8
Sau khi thêm tài nguyên thì bật lên
sqlplus / as sysdba
startup mount

9
apply log trên máy standby 22
alter database recover managed standby database
 disconnect from session;

6
Thực hiện switchover từ
máy 11 sáng máy 22 thực hiện trên
máy 22 trước rồi mới thực hiện máy 11
sqlplus  / as sysdba
alter database commit to switchover to primary;
--Shutdown standby database
shutdown immediate
-- Open old standby database to primary
startup;
sqlplus / as sysdba
alter database commit to switchover to standby;
-- Mount old primary database to standby database
alter database mount standby database;
alter database recover managed standby database
 disconnect from session;





ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master