没错,就是标题党,5分钟就想精通Oracle DG切换了吗?恐怕原理知识都掌握不了,更别说实操部分了,不要相信这些鬼话,太容易得到的知识你也不会去珍惜。
先看几个思考题?
1.主库切换为备库,成功执行如下命令后,原主库实例是什么状态?
alter database commit to switchover to physical standby with session shutdown;
A.shutdown B.nomount C.mount D.read only
2.备库切换为主库,成功执行如下命令后,原备库实例是什么状态?
alter database commit to switchover to primary with session shutdown;
A.shutdown B.nomount C.mount D.oread write
3.配置了dg broker以后,没有开启FSFO,是否还可以正常通过之前的SQL语句进行dg切换呢?
A.可以 B.不可以
4.配置了dg broker并且启用了FSFO,是否还可以正常通过之前的SQL语句进行dg切换呢?
A.可以 B.不可以
5.配置了dg broker并且启用了FSFO,主库执行shutdown immediate后,会自动进行主备切换吗?
A.会 B.不会
本篇文章主要讲解如下内容:
一:通过sqlplus进行switchover二:通过dg broker进行switchover三:通过dg broker进行自动failover四:通过keepalived进行vip自动切换
一:通过sqlplus工具进行switchover
主机信息
172.16.6.137 cjc-db-01172.16.6.138 cjc-db-02OS:Redhat 7.9DB:Oracle 11.2.0.4.0 单机
切换前检查
1.检查数据库基本信息
set lin 200 pages 100col FLASHBACK_ON for a10col current_scn for 99999999999999col open_mode for a10col SWITCHOVER_STATUS for a20col PROTECTION_MODE for a20col name for a10select name,current_scn,protection_mode,database_role,force_logging,FLASHBACK_ON,open_mode,switchover_status from v$database;
主库:
NAME CURRENT_SCN PROTECTION_MODEDATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS---------- --------------- -------------------- ---------------- --- ---------- ---------- --------------------CJC 978784 MAXIMUM PERFORMANCEPRIMARY YES NO READ WRITE TO STANDBY
从库:
NAME CURRENT_SCN PROTECTION_MODEDATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS---------- --------------- -------------------- ---------------- --- ---------- ---------- --------------------CJC 971317 MAXIMUM PERFORMANCEPHYSICAL STANDBY YES NO READ ONLY NOT ALLOWED
从库的OPEN_MODE为READ ONLY,切换前需要开启MRP。
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
SWITCHOVER_STATUS说明:
NOT ALLOWED 当前的数据库不是带有备用数据库的主数据库PREPARING DICTIONARY 该逻辑备用数据库正在向一个主数据库和其他备用数据库发送它的重做数据,以便为切换做准备PREPARING SWITCHOVER 接受用于切换的重做数据时,逻辑备用配置会使用它RECOVERY NEEDED 备用数据库还没有接收到切换请求SESSIONS ACTIVE 在主数据库中存在活动的SQL会话;在继续执行之前必须断开这些会话SWITCHOVER PENDING 适用于那些已收到主数据库切换请求但是还没有处理该请求的备用数据库SWITCHOVER LATENT 切换没有完成并返回到主数据库TO LOGICAL STANDBY 主数据库已经收到了来自逻辑备用数据库的完整的字典TO PRIMARY 该备用数据库可以转换为主数据库TO STANDBY 该主数据库可以转换为备用数据库
2.检查DG参数
set linesize 500 pages 100col value for a70col name for a30select name, valuefrom v$parameterwhere name in ('db_name','db_unique_name','log_archive_config','log_archive_dest_1','log_archive_dest_2','log_archive_dest_state_1', 'log_archive_dest_3','log_archive_dest_state_3','log_archive_dest_state_2','remote_login_passwordfile','log_archive_format','log_archive_max_processes','fal_server','db_file_name_convert','log_file_name_convert','standby_file_management');
主库:
NAME VALUE------------------------------ ----------------------------------------------------------------------db_file_name_convert cjc2, cjc1log_file_name_convert cjc2, cjc1log_archive_dest_1 LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=cjc1log_archive_dest_2 SERVICE=cjc2 ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=cjc2log_archive_dest_3log_archive_dest_state_1 ENABLElog_archive_dest_state_2 ENABLElog_archive_dest_state_3 enablefal_server cjc2log_archive_config DG_CONFIG=(cjc1,cjc2)log_archive_format cjc_%t_%s_%r.arclog_archive_max_processes 4standby_file_management AUTOremote_login_passwordfile EXCLUSIVEdb_name cjcdb_unique_name cjc116 rows selected.
从库:
NAME VALUE------------------------------ ----------------------------------------------------------------------db_file_name_convert cjc1, cjc2log_file_name_convert cjc1, cjc2log_archive_dest_1 LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=cjc2log_archive_dest_2 SERVICE=cjc1 ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=cjc1log_archive_dest_3log_archive_dest_state_1 ENABLElog_archive_dest_state_2 ENABLElog_archive_dest_state_3 enablefal_server cjc1log_archive_config DG_CONFIG=(cjc2,cjc1)log_archive_format cjc_%t_%s_%r.arclog_archive_max_processes 4standby_file_management AUTOremote_login_passwordfile EXCLUSIVEdb_name cjcdb_unique_name cjc216 rows selected.
3.检查DG进程状态
col dest_name for a30col error for a20set lin 200 pages 100col applied_scn for 9999999999999select dest_id,error,status,log_sequence,applied_scn,MAX_CONNECTIONS,NET_TIMEOUT,COMPRESSION from v$archive_dest where dest_id<5;
主库:
DEST_ID ERRORSTATUS LOG_SEQUENCE APPLIED_SCN MAX_CONNECTIONS NET_TIMEOUT COMPRES---------- -------------------- --------- ------------ -------------- --------------- ----------- -------1VALID 18 0 10 DISABLE2VALID 19 9713171 30 DISABLE3INACTIVE 0 0 10 DISABLE4INACTIVE 0 0 10 DISABLE
从库:
DEST_ID ERRORSTATUS LOG_SEQUENCE APPLIED_SCN MAX_CONNECTIONS NET_TIMEOUT COMPRES---------- -------------------- --------- ------------ -------------- --------------- ----------- -------1VALID 18 0 10 DISABLE2VALID 0 0 1 30 DISABLE3INACTIVE 0 0 10 DISABLE4INACTIVE 0 0 10 DISABLE
4.检查进程状态
select INST_ID,process,status,thread#,sequence#,block#,blocks from gv$managed_standby order by INST_ID ;
主库:
INST_ID PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS---------- --------- ------------ ---------- ---------- ---------- ----------1 ARCH CLOSING 1 19 20480 8311 ARCH CLOSING 1 17 1 751 LNS WRITING 1 20 168 11 ARCH CLOSING 1 18 1 221 ARCH CLOSING 1 14 1 2404
从库:
INST_ID PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS---------- --------- ------------ ---------- ---------- ---------- ----------1 ARCH CONNECTED 0 0 0 01 ARCH CONNECTED 0 0 0 01 ARCH CLOSING 1 18 1 221 ARCH CLOSING 1 19 20480 8311 MRP0 APPLYING_LOG 1 20 152 1024001 RFS IDLE 1 20 152 11 RFS IDLE 0 0 0 01 RFS IDLE 0 0 0 01 RFS IDLE 0 0 0 09 rows selected.
5.检查从库应用状态
set lines 200col dest_name for a30select DEST_ID,DEST_NAME,RECOVERY_MODE from gv$archive_dest_status where RECOVERY_MODE <>'IDLE';
DEST_ID DEST_NAME RECOVERY_MODE---------- ------------------------------ -----------------------1 LOG_ARCHIVE_DEST_1 MANAGED REAL TIME APPLY
6.gap检查
主库:
SELECT LOG_ARCHIVED-LOG_APPLIED+1 LOGGAP FROM (SELECT MAX(SEQUENCE#) LOG_ARCHIVEDFROM V$ARCHIVED_LOG WHERE DEST_ID=1 AND ARCHIVED='YES' AND RESETLOGS_CHANGE#=(SELECT MAX(RESETLOGS_CHANGE#)FROM V$ARCHIVED_LOG)), (SELECT MAX(SEQUENCE#) LOG_APPLIEDFROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND APPLIED='YES'AND RESETLOGS_CHANGE#=(SELECT MAX(RESETLOGS_CHANGE#) FROM V$ARCHIVED_LOG)) ;LOGGAP----------1
7.主库创建测试数据,检查数据是否正常同步
SQL> col name for a50SQL> select name from v$dbfile;NAME--------------------------------------------------/oradata/cjc/users01.dbf/oradata/cjc/undotbs01.dbf/oradata/cjc/sysaux01.dbf/oradata/cjc/system01.dbfSQL> select * from cjc.t1;ID----------1
8.主切备
sqlplus as sysdbaSELECT trim(DATABASE_ROLE) DBROLE FROM v$DATABASE;DBROLE----------------PRIMARY
alter system switch logfile;alter system flush SHARED_POOL;ALTER SYSTEM SET log_archive_trace=8191 sid='*';
执行命令后,原主库自动关闭实例
alter database commit to switchover to physical standby with session shutdown;
对应切换日志如下:
Tue Sep 06 14:15:08 2022alter database commit to switchover to physical standby with session shutdownALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY [Process Id: 21460] (cjc1)krss_find_arc: Selecting ARC2 to receive message as last resortWaiting for all non-current ORLs to be archived...All non-current ORLs have been archived.Waiting for all FAL entries to be archived...All FAL entries have been archived.Waiting for potential Physical Standby switchover target to become synchronized...Tue Sep 06 14:15:08 2022OCISessionBegin with PasswordVerifier succeededClient pid [10698] attached to RFS pid [21661] at remote instance number [1] at dest 'cjc2'Active, synchronized Physical Standby switchover target has been identifiedTue Sep 06 14:15:10 2022Process (ospid 10671) is suspended due to switchover to physical standby operation.Switchover End-Of-Redo Log thread 1 sequence 21 has been fixedSwitchover: Primary highest seen SCN set to 0x0.0xf62e8ARCH: Noswitch archival of thread 1, sequence 21ARCH: End-Of-Redo Branch archival of thread 1 sequence 21ARCH: Evaluating archive log 3 thread 1 sequence 21ARCH: LGWR is actively archiving destination LOG_ARCHIVE_DEST_2ARCH: Beginning to archive thread 1 sequence 21 (988339-Infinity) (cjc1)ARCH: Creating remote archive destination LOG_ARCHIVE_DEST_2: 'cjc2' (thread 1 sequence 21) (cjc1)ARCH: Transmitting activation ID 0xdfebe7b0OCISessionBegin with PasswordVerifier succeededClient pid [21460] attached to RFS pid [21665] at remote instance number [1] at dest 'cjc2'ARCH: Standby redo logfile selected for thread 1 sequence 21 for destination LOG_ARCHIVE_DEST_2ARCH: Standby redo logfile selected for thread 1 sequence 21 for destination LOG_ARCHIVE_DEST_2ARCH: Creating local archive destination LOG_ARCHIVE_DEST_1: '/arch/cjc_1_21_1114613364.arc' (thread 1 sequence 21) (cjc1)ARCH: Closing remote archive destination LOG_ARCHIVE_DEST_2: 'cjc2' (cjc1)ARCH: Closing local archive destination LOG_ARCHIVE_DEST_1: '/arch/cjc_1_21_1114613364.arc' (cjc1)Committing creation of archivelog '/arch/cjc_1_21_1114613364.arc'Archived Log entry 25 added for thread 1 sequence 21 ID 0xdfebe7b0 dest 1:Archived Log entry 26 added for thread 1 sequence 21 ID 0xdfebe7b0 dest 2:ARCH: Completed archiving thread 1 sequence 21 (988339-1008360) (cjc1)ARCH: Archiving is disabled due to current logfile archivalPrimary will check for some target standby to have received alls redoFinal check for a synchronized target standby. Check will be made once.ARCH: Transmitting activation ID 0xdfebe7b0LOG_ARCHIVE_DEST_2 is a potential Physical Standby switchover targetActive, synchronized target has been identifiedTarget has also received all redo-----------------------------------------------------------| Target Standby Status || LOG_ARCHIVE_DEST_1 : NOT ACTIVE || LOG_ARCHIVE_DEST_2 : HAS RECEIVED ALL DATA || LOG_ARCHIVE_DEST_3 : NOT ACTIVE || LOG_ARCHIVE_DEST_4 : NOT ACTIVE || LOG_ARCHIVE_DEST_5 : NOT ACTIVE || LOG_ARCHIVE_DEST_6 : NOT ACTIVE || LOG_ARCHIVE_DEST_7 : NOT ACTIVE || LOG_ARCHIVE_DEST_8 : NOT ACTIVE || LOG_ARCHIVE_DEST_9 : NOT ACTIVE || LOG_ARCHIVE_DEST_10 : NOT ACTIVE || LOG_ARCHIVE_DEST_11 : NOT ACTIVE || LOG_ARCHIVE_DEST_12 : NOT ACTIVE || LOG_ARCHIVE_DEST_13 : NOT ACTIVE || LOG_ARCHIVE_DEST_14 : NOT ACTIVE || LOG_ARCHIVE_DEST_15 : NOT ACTIVE || LOG_ARCHIVE_DEST_16 : NOT ACTIVE || LOG_ARCHIVE_DEST_17 : NOT ACTIVE || LOG_ARCHIVE_DEST_18 : NOT ACTIVE || LOG_ARCHIVE_DEST_19 : NOT ACTIVE || LOG_ARCHIVE_DEST_20 : NOT ACTIVE || LOG_ARCHIVE_DEST_21 : NOT ACTIVE || LOG_ARCHIVE_DEST_22 : NOT ACTIVE || LOG_ARCHIVE_DEST_23 : NOT ACTIVE || LOG_ARCHIVE_DEST_24 : NOT ACTIVE || LOG_ARCHIVE_DEST_25 : NOT ACTIVE || LOG_ARCHIVE_DEST_26 : NOT ACTIVE || LOG_ARCHIVE_DEST_27 : NOT ACTIVE || LOG_ARCHIVE_DEST_28 : NOT ACTIVE || LOG_ARCHIVE_DEST_29 : NOT ACTIVE || LOG_ARCHIVE_DEST_30 : NOT ACTIVE || LOG_ARCHIVE_DEST_31 : NOT ACTIVE |------------------------------------------------------------Backup controlfile written to trace file oracle/app/oracle/diag/rdbms/cjc1/cjc1/trace/cjc1_ora_21460.trcClearing standby activation ID 3756779440 (0xdfebe7b0)The primary database controlfile was created using the'MAXLOGFILES 16' clause.There is space for up to 13 standby redo logfilesUse the following SQL commands on the standby database to createstandby redo logfiles that match the primary database:ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 52428800;ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 52428800;ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 52428800;ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 52428800;Archivelog for thread 1 sequence 21 required for standby recoverySwitchover: Primary controlfile converted to standby controlfile succesfully.Switchover: Complete - Database shutdown requiredUSER (ospid: 21460): terminating the instanceInstance terminated by USER, pid = 21460Completed: alter database commit to switchover to physical standby with session shutdownShutting down instance (abort)License high water mark = 6Tue Sep 06 14:15:11 2022Instance shutdown complete
启动实例
startup mount
9.备切主
su - oraclesqlplus as sysdbashow parameter instance_nameSELECT trim(DATABASE_ROLE) DBROLE FROM v$DATABASE;DBROLE----------------PHYSICAL STANDBY
ALTER SYSTEM SET log_archive_trace=8191 sid='*';
执行命令后,原备库自动启动到mount
alter database commit to switchover to primary with session shutdown;
切换日志如下:
Tue Sep 06 14:18:05 2022alter database commit to switchover to primary with session shutdownALTER DATABASE SWITCHOVER TO PRIMARY (cjc2)Maximum wait for role transition is 15 minutes.Switchover: Media recovery is still activeRole Change: Canceling MRP - no more redo to applyTue Sep 06 14:18:06 2022MRP0: Background Media Recovery cancelled with status 16037Errors in file oracle/app/oracle/diag/rdbms/cjc2/cjc2/trace/cjc2_pr00_20372.trc:ORA-16037: user requested cancel of managed recovery operationManaged Standby Recovery not using Real Time ApplyRecovery interrupted!Errors in file oracle/app/oracle/diag/rdbms/cjc2/cjc2/trace/cjc2_pr00_20372.trc:ORA-16037: user requested cancel of managed recovery operationTue Sep 06 14:18:07 2022Errors in file oracle/app/oracle/diag/rdbms/cjc2/cjc2/trace/cjc2_mrp0_20358.trc:ORA-10877: error signaled in parallel recovery slaveMRP0: Background Media Recovery process shutdown (cjc2)Role Change: Canceled MRPAll dispatchers and shared servers shutdownCLOSE: killing server sessions.CLOSE: all sessions shutdown successfully.Tue Sep 06 14:18:08 2022SMON: disabling cache recoveryBackup controlfile written to trace file oracle/app/oracle/diag/rdbms/cjc2/cjc2/trace/cjc2_ora_20276.trcSwitchOver after complete recovery through change 1008360Online log oradata/cjc/redo01.log: Thread 1 Group 1 was previously clearedOnline log oradata/cjc/redo02.log: Thread 1 Group 2 was previously clearedOnline log oradata/cjc/redo03.log: Thread 1 Group 3 was previously clearedStandby became primary SCN: 1008358Switchover: Complete - Database mounted as primaryCompleted: alter database commit to switchover to primary with session shutdownTue Sep 06 14:18:29 2022ARC2: Becoming the 'no SRL' ARCHTue Sep 06 14:18:48 2022idle dispatcher 'D000' terminated, pid = (17, 1)
重启实例
shutdown immediate;startup;
9.切换后检查
set lin 200 pages 100set lin 200 pages 100col FLASHBACK_ON for a10col current_scn for 99999999999999col open_mode for a20col SWITCHOVER_STATUS for a20col PROTECTION_MODE for a20select current_scn,protection_mode,database_role,force_logging,FLASHBACK_ON,open_mode,switchover_status from v$database;
CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODESWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- ---------- --------------------1008736 MAXIMUM PERFORMANCE PRIMARY YES NO READ WRITE RESOLVABLE GAP
ALTER SYSTEM SET log_archive_trace=0 sid='*';
10.新备库启动mrp
sqlplus as sysdbaalter database open;ALTER SYSTEM SET log_archive_trace=0 sid='*';###recover managed standby database using current logfile disconnect from session;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
从库
CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODESWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- ---------- --------------------1009025 MAXIMUM PERFORMANCE PHYSICAL STANDBY YES NO READ ONLYNOT ALLOWEDWITH APPLY
主库:
CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODESWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- ---------- --------------------1008800 MAXIMUM PERFORMANCE PRIMARY YES NO READ WRITE TO STANDBY
主库:
SQL> insert into cjc.t1 values(2);SQL> insert into cjc.t1 values(3);SQL> commit;
从库:
SQL> select * from cjc.t1;ID----------123
回切:
主切备
alter database commit to switchover to physical standby with session shutdown;startup mount
备切主
alter database commit to switchover to primary with session shutdown;shutdown immediate;startup;
备库启动MRP
alter database open;###ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
二:通过dg broker进行switchover
手动进行DG switchover,步骤有些麻烦,是否有更简单的方式呢,可以试试dg broker。
Oracle DataGuard Broker分为Client Side和Server Side。
Client Side可以通过EM和DGMGRL两种工具对服务端进行管理和维护。
Server side会有一个配置文件和一个后台进程叫Data Guard Broker monitor process(DMON)。
DMON:它是一个用来管理Broker的后台进程,这个进程负责本地数据库与standby数据库的DMON进程进行通讯,当主库上接收到一个请求的时候,它会协调其他数据库上的DMON进程处理相应的请求,比如switchover。
同时会更新本地系统中的配置文件,并与standby数据库上的DMON进程进行通信,更新Standby上的配置文件。
1.启用dg broker
主库、从库:
配置DG_BROKER_START参数
show parameter dg_broker_start;NAME TYPE VALUE------------------------------------ ----------- ------------------------------dg_broker_start boolean FALSE
启用dg_broker_start,启用后oracle会自动启动一个dmon进程
alter system set dg_broker_start = true;
对应日志:
Tue Sep 06 15:04:40 2022ALTER SYSTEM SET dg_broker_start=TRUE SCOPE=BOTH;Tue Sep 06 15:04:40 2022DMON started with pid=31, OS id=3206Starting Data Guard Broker (DMON)Tue Sep 06 15:04:48 2022INSV started with pid=32, OS id=3215
2.调整监听文件
在监听文件中加入DGMGRL静态监听
主库
SID_LIST_LISTENER =(SID_LIST =(SID_DESC =(GLOBAL_DBNAME = cjc1)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc1))(SID_DESC =(GLOBAL_DBNAME = cjc1_DGMGRL)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc1)))LISTENER =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.6.137)(PORT = 1521))))
从库
SID_LIST_LISTENER =(SID_LIST =(SID_DESC =(GLOBAL_DBNAME = cjc2)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc2))(SID_DESC =(GLOBAL_DBNAME = cjc2_DGMGRL)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc2)))LISTENER =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.6.138)(PORT = 1521))))
监听状态
lsnrctl reloadlsnrctl status
主库:
Services Summary...Service "cjc1" has 2 instance(s).Instance "cjc1", status UNKNOWN, has 1 handler(s) for this service...Instance "cjc1", status READY, has 1 handler(s) for this service...Service "cjc1_DGMGRL" has 1 instance(s).Instance "cjc1", status UNKNOWN, has 1 handler(s) for this service...Service "cjcXDB" has 1 instance(s).Instance "cjc1", status READY, has 1 handler(s) for this service...The command completed successfully
从库:
Services Summary...Service "cjc2" has 2 instance(s).Instance "cjc2", status UNKNOWN, has 1 handler(s) for this service...Instance "cjc2", status READY, has 1 handler(s) for this service...Service "cjc2_DGMGRL" has 1 instance(s).Instance "cjc2", status UNKNOWN, has 1 handler(s) for this service...Service "cjcXDB" has 1 instance(s).Instance "cjc2", status READY, has 1 handler(s) for this service...The command completed successfully
3.配置broker
[oracle@cjc-db-01 ~]$ dgmgrl sys/oracleDGMGRL for Linux: Version 11.2.0.4.0 - 64bit ProductionCopyright (c) 2000, 2009, Oracle. All rights reserved.Welcome to DGMGRL, type "help" for information.Connected.DGMGRL>
显示配置
DGMGRL> show configurationORA-16532: Data Guard broker configuration does not existConfiguration details cannot be determined by DGMGRL
添加配置
DGMGRL> create configuration 'cjcdgbroker' as primary database is 'cjc1' connect identifier is cjc1;Configuration "cjcdgbroker" created with primary database "cjc1"
显示配置
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databaseFast-Start Failover: DISABLEDConfiguration Status:DISABLED
新增备库配置
DGMGRL> add database 'cjc2' as connect identifier is 'cjc2' maintained as physical;Database "cjc2" added
显示配置
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:DISABLED
启用配置
DGMGRL> enable configurationEnabled.
显示配置
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:SUCCESS
4.测试switchover
DGMGRL> switchover to cjc2Performing switchover NOW, please wait...Operation requires a connection to instance "cjc2" on database "cjc2"Connecting to instance "cjc2"...Connected.New primary database "cjc2" is opening...Operation requires startup of instance "cjc1" on database "cjc1"Starting instance "cjc1"...ORACLE instance started.Database mounted.Database opened.Switchover succeeded, new primary is "cjc2"
检查配置
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc2 - Primary databasecjc1 - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:SUCCESS
SQL检查
set lin 200 pages 100set lin 200 pages 100col FLASHBACK_ON for a10col current_scn for 99999999999999col open_mode for a20col SWITCHOVER_STATUS for a20col PROTECTION_MODE for a20select current_scn,protection_mode,database_role,force_logging,FLASHBACK_ON,open_mode,switchover_status from v$database;
新备:
CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1052426 MAXIMUM PERFORMANCE PHYSICAL STANDBY YES NO READ ONLY WITH APPLY NOT ALLOWED
新主
CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1052498 MAXIMUM PERFORMANCE PRIMARY YES NO READ WRITE SESSIONS ACTIVE
5.回切
DGMGRL> switchover to cjc1;Performing switchover NOW, please wait...Operation requires a connection to instance "cjc1" on database "cjc1"Connecting to instance "cjc1"...Connected.New primary database "cjc1" is opening...Operation requires startup of instance "cjc2" on database "cjc2"Starting instance "cjc2"...ORACLE instance started.Database mounted.Database opened.Switchover succeeded, new primary is "cjc1"
检查配置
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:SUCCESS
思考:配置了dg broker以后,是否还可以通过之前的SQL语句进行dg切换呢?
此时,通过SQL命令仍然可以进行切换
主切备
alter database commit to switchover to physical standby with session shutdown;startup mount
备切主
alter database commit to switchover to primary with session shutdown;shutdown immediate;startup;
备库启动MRP
alter database open;###recover managed standby database using current logfile disconnect from session;###ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
可以使用,既然已经启动了dg broker,建议通过broker进行切换。
三:通过dg broker进行自动failover
启动自动故障转移FSFO
Fast-Start Failove
FSFO允许代理在主库故障的情况下自动故障转移到先前选择的备库,无需手动执行任何步骤,以便快速可靠地恢复业务。
FSFO只能在代理配置中使用,并且只能通过DGMGRL或OEM进行配置。
FSFO支持在最高可用性与最高性能模式下使用。
最大可用性模式保证不会丢失任何数据,最高性能模式可保证丢失的数据量不超过FastStartFailoverLagLimit属性指定的数据量(单位为秒)。
思考:何时会进行FSFO?
配置完成后,FSFO将在以下情况下起作用:
1.主库与 Observer和目标备库 失联时间均超过FastStartFailoverThreshold属性配置阈值(单位为秒)2.单实例数据库中主实例崩溃3.RAC中所有主实例崩溃4.shutdown abort主库5.应用程序通过调用DBMS_DG.INITIATE_FS_FAILOVER函数启动FSFO6.Oracle 错误:可以指定启动 FSFO 故障切换的 ORA 错误列表(默认为空)
Broker 可配置为遇到以下任一条件时启动FSFO
1.Datafile Offline 数据文件由于写错误脱机Yes2.Corrupted Dictionary关键数据库对象的字典损坏,该状态可在数据库open时被检测到Yes3.Corrupted Controlfile控制文件由于写入错误永久损坏Yes4.Inaccessible Logfile由于IO错误,LGWR无法写入日志组的任何成员No5.Stuck Archiver 由于设备已满或不可用,归档进程无法归档redo log
设置保护模式与LogXptMode
LOGXPTMODE属性在最大可用性模式下应为SYNC,在最大性能模式下应为ASYNC,主备库LOGXPTMODE设置必须相同
###DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MaxAvailability;DGMGRL> edit database cjc1 set property 'LogXptMode'='ASYNC';Property "LogXptMode" updatedDGMGRL> edit database cjc2 set property 'LogXptMode'='ASYNC';Property "LogXptMode" updated
设置FSFO阈值
如果主库与 Observer和目标备库 失联时间均超过FastStartFailoverThreshold属性配置阈值(单位为秒),将启动FSFO。
换句话说,FastStartFailoverThreshold表示,Observer和目标备库 在检测到主库不可用后、希望等多少秒才启动FSFO。再此期间,它们会尝试重连主库。
默认值为30秒,最小6秒。
DGMGRL> edit configuration set property faststartfailoverthreshold=20;Property "faststartfailoverthreshold" updated
设置最大可接受延迟时间
FastStartFailoverLagLimit表示,自动故障转移允许的最大数据丢失量(单位为秒),仅在最高性能保护模式时才可使用。
FastStartFailoverLagLimit作为DG可接受的最大延迟时间,备库的apply lag只有在此限制之内,才允许FSFO。
如果无法维持已配置的数据丢失保证,主库上的redo生成将停止。
为了避免长时间停顿,Observer或者目标备库可能会在第一次记录到无法发生FSFO之后,允许主库继续生成redo。
此时若主库故障,将无法发生FSFO。
默认值为30秒,最小值为10秒。
DGMGRL> edit configuration set property faststartfailoverlaglimit=60;
设置自动恢复数据库属性
如果FastStartFailoverAutoReinstate属性设置为TRUE,在原主库故障修复后,会自动尝试将其恢复为新主库的备库。
DGMGRL> EDIT CONFIGURATION SET PROPERTY FASTSTARTFAILOVERAUTOREINSTATE=TRUE;Property "faststartfailoverautoreinstate" updated
启动Observer
创建脚本
[oracle@cjc-db-02 dg]$ pwd/home/oracle/dg[oracle@cjc-db-02 dg]$ mkdir observer[oracle@cjc-db-02 dg]$ cd observer/vi observer.shnohup dgmgrl sys/oracle@cjc2 "start observer file=FSFO.dat">>fsfo.log 2>&1 &
执行脚本
[oracle@cjc-db-02 observer]$ sh observer.sh
启动FSFO,报错ORA-16651
DGMGRL> enable fast_start failover;Error: ORA-16651: requirements not met for enabling fast-start failover
检查报错信息,发现主从库必须开启闪回
[oracle@cjc-db-02 observer]$ oerr ora 1665116651, 0000, "requirements not met for enabling fast-start failover"// *Cause: The attempt to enable fast-start failover could not be completed// because one or more requirements were not met:// - The Data Guard configuration must be in either MaxAvailability// or MaxPerformance protection mode.// - The LogXptMode property for both the primary database and// the fast-start failover target standby database must be// set to SYNC if the configuration protection mode is set to// MaxAvailability mode.// - The LogXptMode property for both the primary database and// the fast-start failover target standby database must be// set to ASYNC if the configuration protection mode is set to// MaxPerformance mode.// - The primary database and the fast-start failover target standby// database must both have flashback enabled.// - No valid target standby database was specified in the primary// database FastStartFailoverTarget property prior to the attempt// to enable fast-start failover, and more than one standby// database exists in the Data Guard configuration.// *Action: Retry the command after correcting the issue:// - Set the Data Guard configuration to either MaxAvailability// or MaxPerformance protection mode.// - Ensure that the LogXptMode property for both the primary// database and the fast-start failover target standby database// are set to SYNC if the configuration protection mode is set to// MaxAvailability.// - Ensure that the LogXptMode property for both the primary// database and the fast-start failover target standby database// are set to ASYNC if the configuration protection mode is set to// MaxPerformance.// - Ensure that both the primary database and the fast-start failover// target standby database have flashback enabled.// - Set the primary database FastStartFailoverTarget property to// the DB_UNIQUE_NAME value of the desired target standby database// and the desired target standby database FastStartFailoverTarget// property to the DB_UNIQUE_NAME value of the primary database.
启动闪回
alter database flashback on;
再次开启FSFO
DGMGRL> enable fast_start failover;Enabled.
对应日志:
Tue Sep 06 16:31:43 2022Fast-Start Failover (FSFO) has been enabled between:Primary = "cjc1"Standby = "cjc2"Tue Sep 06 16:31:43 2022FSFP started with pid=38, OS id=8869OCISessionBegin with PasswordVerifier succeeded
查看配置,Fast-Start Failover状态变成ENABLED了。
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - (*) Physical standby databaseFast-Start Failover: ENABLEDConfiguration Status:SUCCESS
测试自动切换
主库
SQL> shutdown abortORACLE instance shut down.
查看fsfo日志
[oracle@cjc-db-02 observer]$ tail -10f fsfo.log16:38:41.35 Tuesday, September 06, 2022Initiating Fast-Start Failover to database "cjc2"...Performing failover NOW, please wait...Failover succeeded, new primary is "cjc2"16:38:48.09 Tuesday, September 06, 2022
完成了自动切换
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc2 - Primary databaseWarning: ORA-16829: fast-start failover configuration is laggingcjc1 - (*) Physical standby database (disabled)ORA-16661: the standby database needs to be reinstatedFast-Start Failover: ENABLEDConfiguration Status:WARNING
已完成自动切换
CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1159699 MAXIMUM PERFORMANCE PRIMARY YES YES READ WRITE NOT ALLOWED
启动原主库
SQL> startupORACLE instance started.Total System Global Area 1135747072 bytesFixed Size 2252544 bytesVariable Size 754974976 bytesDatabase Buffers 369098752 bytesRedo Buffers 9420800 bytesDatabase mounted.ORA-16649: possible failover to another database prevents this database from being opened
检查错误
[oracle@cjc-db-01 ~]$ oerr ora 1644916449, 00000, "incomplete redo thread enable operation"// *Cause: The switchover operation could not continue because it failed to// disable a thread that was left in an incomplete thread enable// state.// *Action: Check alert log for more details.
启动数据库时报错ORA-16649,不需要处理,后台会自动执行闪回数据库,自动open实例。
SQL> set lin 200 pages 100set lin 200 pages 100col FLASHBACK_ON for a10col current_scn for 99999999999999col open_mode for a20col SWITCHOVER_STATUS for a20col PROTECTION_MODE for a20select current_scn,protection_mode,database_role,force_logging,FLASHBACK_ON,open_mode,switchover_status from v$database;CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1160947 MAXIMUM PERFORMANCE PHYSICAL STANDBY YES YES READ ONLY WITH APPLY SWITCHOVER PENDING
查看配置
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - (*) Physical standby databaseFast-Start Failover: ENABLEDConfiguration Status:SUCCESS
原主库自动变为备库
告警日志
FLASHBACK DATABASE TO SCN 1160354Flashback Restore StartFlashback Restore CompleteFlashback Media Recovery Startstarted logmerger processParallel Media Recovery started with 2 slavesFlashback Media Recovery Log arch/cjc_1_2_1114706326.arcFlashback Media Recovery Log arch/cjc_1_3_1114706326.arcTue Sep 06 16:53:25 2022Recovery of Online Redo Log: Thread 1 Group 1 Seq 4 Reading mem 0Mem# 0: oradata/cjc/redo01.logRecovery of Online Redo Log: Thread 1 Group 2 Seq 5 Reading mem 0Mem# 0: oradata/cjc/redo02.logRecovery of Online Redo Log: Thread 1 Group 3 Seq 6 Reading mem 0Mem# 0: oradata/cjc/redo03.logIncomplete Recovery applied until change 1160355 time 09/06/2022 16:50:59Flashback Media Recovery CompleteCompleted: FLASHBACK DATABASE TO SCN 1160354alter database convert to physical standbyALTER DATABASE CONVERT TO PHYSICAL STANDBY (cjc2)Flush standby redo logfile failed:1649Clearing standby activation ID 3756857555 (0xdfed18d3)The primary database controlfile was created using the'MAXLOGFILES 16' clause.There is space for up to 13 standby redo logfilesUse the following SQL commands on the standby database to createstandby redo logfiles that match the primary database:ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 52428800;ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 52428800;ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 52428800;ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 52428800;Waiting for all non-current ORLs to be archived...All non-current ORLs have been archived.Clearing online redo logfile 1 oradata/cjc/redo01.logClearing online log 1 of thread 1 sequence number 4Clearing online redo logfile 1 completeClearing online redo logfile 2 oradata/cjc/redo02.logClearing online log 2 of thread 1 sequence number 5Tue Sep 06 16:53:28 2022RFS[2]: Assigned to RFS process 10506RFS[2]: Opened log for thread 1 sequence 6 dbid -538205520 branch 1114706326Clearing online redo logfile 2 completeArchived Log entry 87 added for thread 1 sequence 6 rlc 1114706326 ID 0xdfed18d3 dest 2:Clearing online redo logfile 3 oradata/cjc/redo03.logClearing online log 3 of thread 1 sequence number 6Tue Sep 06 16:53:31 2022RFS[3]: Assigned to RFS process 10503RFS[3]: Opened log for thread 1 sequence 1 dbid -538205520 branch 1114707085RFS[2]: Opened log for thread 1 sequence 2 dbid -538205520 branch 1114707085Tue Sep 06 16:53:31 2022Clearing online redo logfile 3 completeA new recovery destination branch has been registeredRFS[3]: New Archival REDO Branch(resetlogs_id): 1114707085 Prior: 1114706326RFS[3]: Archival Activation ID: 0xdfeddf20 Current: 0x0RFS[3]: Effect of primary database OPEN RESETLOGSRFS[3]: Incarnation entry added for Branch(resetlogs_id): 1114707085 (cjc2)Tue Sep 06 16:53:31 2022Setting recovery target incarnation to 4Completed: alter database convert to physical standbyArchived Log entry 88 added for thread 1 sequence 1 rlc 1114707085 ID 0xdfeddf20 dest 2:Killing 2 processes with pids 10503,10506 (all RFS) in order to disallow current and future RFS connections. Requested by OS process 10491Archived Log entry 89 added for thread 1 sequence 2 rlc 1114707085 ID 0xdfeddf20 dest 2:Tue Sep 06 16:53:33 2022RFS[4]: Assigned to RFS process 10515RFS[4]: Opened log for thread 1 sequence 3 dbid -538205520 branch 1114707085Tue Sep 06 16:53:33 2022Shutting down instance (immediate)Shutting down instance: further logons disabledStopping background process MMNLArchived Log entry 89 added for thread 1 sequence 3 rlc 1114707085 ID 0xdfeddf20 dest 2:Stopping background process MMONLicense high water mark = 5All dispatchers and shared servers shutdownalter database CLOSE NORMALORA-1109 signalled during: alter database CLOSE NORMAL...alter database DISMOUNTShutting down archive processesArchiving is disabledCompleted: alter database DISMOUNTARCH: Archival disabled due to shutdown: 1089Shutting down archive processesArchiving is disabledShutting down Data Guard Broker processesTue Sep 06 16:53:39 2022Completed: Data Guard Broker shutdownARCH: Archival disabled due to shutdown: 1089Shutting down archive processesTue Sep 06 16:53:41 2022Stopping background process VKTMArchiving is disabledTue Sep 06 16:53:43 2022Instance shutdown completeTue Sep 06 16:53:44 2022Starting ORACLE instance (normal)LICENSE_MAX_SESSION = 0LICENSE_SESSIONS_WARNING = 0Initial number of CPU is 2Number of processor cores in the system is 2Number of processor sockets in the system is 1CELL communication is configured to use 0 interface(s):CELL IP affinity details:NUMA status: non-NUMA systemcellaffinity.ora status: N/ACELL communication will use 1 IP group(s):Grp 0:Picked latch-free SCN scheme 3Autotune of undo retention is turned on.IMODE=BRILAT =27LICENSE_MAX_USERS = 0SYS auditing is disabledStarting up:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options.ORACLE_HOME = oracle/app/oracle/product/11.2/dbSystem name:LinuxNode name:cjc-db-02Release:5.4.17-2102.201.3.el7uek.x86_64Version:#2 SMP Fri Apr 23 09:05:55 PDT 2021Machine:x86_64Using parameter settings in server-side spfile oracle/app/oracle/product/11.2/db/dbs/spfilecjc2.oraSystem parameters with non-default values:processes = 150event = "28401 trace name context forever,level 1"event = "10949 trace name context forever,level 1"memory_target = 1088Mcontrol_files = "/oradata/cjc/control01.ctl"control_files = "/oracle/app/oracle/fast_recovery_area/cjc/control02.ctl"db_file_name_convert = "cjc1"db_file_name_convert = "cjc2"log_file_name_convert = "cjc1"log_file_name_convert = "cjc2"control_file_record_keep_time= 31db_block_size = 8192compatible = "11.2.0.4.0"log_archive_dest_1 = "LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=cjc2"log_archive_dest_2 = "service="cjc1""log_archive_dest_2 = "LGWR ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="cjc1" net_timeout=30"log_archive_dest_2 = "valid_for=(all_logfiles,primary_role)"log_archive_dest_state_1 = "ENABLE"log_archive_dest_state_2 = "ENABLE"log_archive_min_succeed_dest= 1fal_server = "cjc1"log_archive_trace = 0log_archive_config = "DG_CONFIG=(cjc2,cjc1)"log_archive_format = "cjc_%t_%s_%r.arc"log_archive_max_processes= 4archive_lag_target = 0_use_adaptive_log_file_sync= "FALSE"db_files = 2048db_recovery_file_dest = "/home/oracle/dg/recover"db_recovery_file_dest_size= 10Gstandby_file_management = "AUTO"_cleanup_rollback_entries= 10000undo_tablespace = "UNDOTBS1"_partition_large_extents = "FALSE"remote_login_passwordfile= "EXCLUSIVE"audit_sys_operations = FALSEdb_domain = ""dispatchers = "(PROTOCOL=TCP) (SERVICE=cjcXDB)"parallel_execution_message_size= 32768_PX_use_large_pool = TRUEresult_cache_max_size = 0audit_file_dest = "/oracle/app/oracle/admin/cjc/adump"audit_trail = "NONE"cell_offload_processing = FALSEdb_name = "cjc"db_unique_name = "cjc2"open_cursors = 300_optimizer_null_aware_antijoin= FALSE_b_tree_bitmap_plans = FALSE_optimizer_extended_cursor_sharing= "NONE"_optimizer_extended_cursor_sharing_rel= "NONE"_optimizer_adaptive_cursor_sharing= FALSEdeferred_segment_creation= FALSE_optimizer_use_feedback = FALSEdg_broker_start = TRUEdiagnostic_dest = "/oracle/app/oracle"max_dump_file_size = "1024M"Tue Sep 06 16:53:45 2022PMON started with pid=2, OS id=10533Tue Sep 06 16:53:45 2022PSP0 started with pid=3, OS id=10535Tue Sep 06 16:53:46 2022VKTM started with pid=4, OS id=10538 at elevated priorityVKTM running at (1)millisec precision with DBRM quantum (100)msTue Sep 06 16:53:46 2022GEN0 started with pid=5, OS id=10543Tue Sep 06 16:53:46 2022DIAG started with pid=6, OS id=10545Tue Sep 06 16:53:46 2022DBRM started with pid=7, OS id=10547Tue Sep 06 16:53:46 2022DIA0 started with pid=8, OS id=10549Tue Sep 06 16:53:46 2022MMAN started with pid=9, OS id=10551Tue Sep 06 16:53:46 2022DBW0 started with pid=10, OS id=10553Tue Sep 06 16:53:46 2022LGWR started with pid=11, OS id=10555Tue Sep 06 16:53:46 2022CKPT started with pid=12, OS id=10557Tue Sep 06 16:53:46 2022SMON started with pid=13, OS id=10559Tue Sep 06 16:53:46 2022RECO started with pid=14, OS id=10561Tue Sep 06 16:53:46 2022MMON started with pid=15, OS id=10563Tue Sep 06 16:53:46 2022MMNL started with pid=16, OS id=10565starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...starting up 1 shared server(s) ...Tue Sep 06 16:53:46 2022DMON started with pid=19, OS id=10571ORACLE_BASE from environment = oracle/app/oracleTue Sep 06 16:53:46 2022alter database mountARCH: STARTING ARCH PROCESSESTue Sep 06 16:53:51 2022ARC0 started with pid=21, OS id=10582ARC0: Archival startedARCH: STARTING ARCH PROCESSES COMPLETEARC0: STARTING ARCH PROCESSESTue Sep 06 16:53:52 2022ARC1 started with pid=22, OS id=10585Tue Sep 06 16:53:52 2022ARC2 started with pid=23, OS id=10587ARC1: Archival startedARC2: Archival startedARC2: Becoming the 'no FAL' ARCHARC2: Becoming the 'no SRL' ARCHARC2: Thread not mountedTue Sep 06 16:53:52 2022ARC3 started with pid=24, OS id=10589ARC1: Becoming the heartbeat ARCHARC1: Thread not mountedSuccessful mount of redo thread 1, with mount id 3756855130Allocated 8388608 bytes in shared pool for flashback generation bufferStarting background process RVWRTue Sep 06 16:53:52 2022RVWR started with pid=25, OS id=10591Physical Standby Database mounted.Lost write protection disabledARC1: Becoming the active heartbeat ARCHCompleted: alter database mountARC3: Archival startedARC0: STARTING ARCH PROCESSES COMPLETEStarting Data Guard Broker (DMON)Tue Sep 06 16:53:55 2022INSV started with pid=26, OS id=10597Tue Sep 06 16:54:01 2022NSV0 started with pid=27, OS id=10607Tue Sep 06 16:54:04 2022Using STANDBY_ARCHIVE_DEST parameter default value as archTue Sep 06 16:54:04 2022RSM0 started with pid=29, OS id=10615Tue Sep 06 16:54:04 2022RFS[1]: Assigned to RFS process 10617RFS[1]: Opened log for thread 1 sequence 2 dbid -538205520 branch 1114707085Archived Log entry 90 added for thread 1 sequence 2 rlc 1114707085 ID 0xdfeddf20 dest 2:RFS[1]: Opened log for thread 1 sequence 4 dbid -538205520 branch 1114707085Archived Log entry 91 added for thread 1 sequence 4 rlc 1114707085 ID 0xdfeddf20 dest 2:RFS[1]: Selected log 4 for thread 1 sequence 5 dbid -538205520 branch 1114707085Tue Sep 06 16:54:06 2022Primary database is in MAXIMUM PERFORMANCE modeRFS[2]: Assigned to RFS process 10621RFS[2]: Selected log 5 for thread 1 sequence 6 dbid -538205520 branch 1114707085Tue Sep 06 16:54:06 2022Archived Log entry 92 added for thread 1 sequence 5 ID 0xdfeddf20 dest 1:Data Guard: Failover target was a Real Time Query standby; attempting to open this standby after reinstatement ...ALTER DATABASE OPEN READ ONLYData Guard Broker initializing...Data Guard Broker initialization completeTue Sep 06 16:54:07 2022SMON: enabling cache recoveryDictionary check beginningDictionary check completeDatabase Characterset is AL32UTF8No Resource Manager plan activereplication_dependency_tracking turned off (no async multimaster replication found)Physical standby database opened for read only access.Completed: ALTER DATABASE OPEN READ ONLYTue Sep 06 16:54:08 2022db_recovery_file_dest_size of 10240 MB is 0.49% used. This is auser-specified limit on the amount of space that will be used by thisdatabase for recovery-related files, and does not reflect the amount ofspace available in the underlying filesystem or ASM diskgroup.ALTER SYSTEM SET log_archive_trace=0 SCOPE=BOTH SID='cjc2';ALTER SYSTEM SET log_archive_format='cjc_%t_%s_%r.arc' SCOPE=SPFILE SID='cjc2';ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=BOTH SID='*';ALTER SYSTEM SET archive_lag_target=0 SCOPE=BOTH SID='*';ALTER SYSTEM SET log_archive_max_processes=4 SCOPE=BOTH SID='*';ALTER SYSTEM SET log_archive_min_succeed_dest=1 SCOPE=BOTH SID='*';ALTER SYSTEM SET db_file_name_convert='cjc1','cjc2' SCOPE=SPFILE;ALTER SYSTEM SET log_file_name_convert='cjc1','cjc2' SCOPE=SPFILE;ALTER SYSTEM SET fal_server='cjc1' SCOPE=BOTH;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILEAttempt to start background Managed Standby Recovery process (cjc2)Tue Sep 06 16:54:09 2022MRP0 started with pid=33, OS id=10629MRP0: Background Managed Standby Recovery process started (cjc2)started logmerger processTue Sep 06 16:54:15 2022Managed Standby Recovery starting Real Time ApplyParallel Media Recovery started with 2 slavesMedia Recovery start incarnation depth : 1, target inc# : 4, irscn : 1160356Waiting for all non-current ORLs to be archived...All non-current ORLs have been archived.Media Recovery Log arch/cjc_1_6_1114706326.arcIdentified End-Of-Redo (failover) for thread 1 sequence 6 at SCN 0x0.11b4a4Tue Sep 06 16:54:15 2022Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILEResetting standby activation ID 3756857555 (0xdfed18d3)Media Recovery End-Of-Redo indicator encounteredMedia Recovery ContinuingMedia Recovery Log arch/cjc_1_1_1114707085.arcArchived Log entry 93 added for thread 1 sequence 6 ID 0xdfeddf20 dest 1:Tue Sep 06 16:54:16 2022Primary database is in MAXIMUM PERFORMANCE modeMedia Recovery Log arch/cjc_1_2_1114707085.arcRFS[3]: Assigned to RFS process 10651RFS[3]: Selected log 4 for thread 1 sequence 7 dbid -538205520 branch 1114707085Media Recovery Log arch/cjc_1_3_1114707085.arcMedia Recovery Log arch/cjc_1_4_1114707085.arcMedia Recovery Log arch/cjc_1_5_1114707085.arcMedia Recovery Log arch/cjc_1_6_1114707085.arcMedia Recovery Waiting for thread 1 sequence 7 (in transit)Recovery of Online Redo Log: Thread 1 Group 4 Seq 7 Reading mem 0Mem# 0: oradata/cjc/standby_redo04.log
思考:
主库shutdown immediate会自动切换吗?
主库:
SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.
没有自动切换
过10min后启动数据库
startup
检查当前配置信息
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - (*) Physical standby databaseFast-Start Failover: ENABLEDConfiguration Status:SUCCESS
SQL>CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1164197 MAXIMUM PERFORMANCE PRIMARY YES YES READ WRITE TO STANDBY
思考:
启动FSFO后还可以通过之前的SQL命令进行主备切换吗?
主切备
alter database commit to switchover to physical standby with session shutdown;startup mount
备切主,报错ORA-16109
alter database commit to switchover to primary with session shutdown;ORA-16109: failed to apply log data from previous primary
[oracle@cjc-db-02 ~]$ oerr ora 1610916109, 00000, "failed to apply log data from previous primary"// *Cause: Log data from previous primary could not be completely applied.// *Action: Check DBA_LOGSTDBY_EVENTS for failures and take corrective// action. Then, reissue command
检查fsfo日志
[oracle@cjc-db-02 observer]$ tail -10f fsfo.log17:41:12.95 Tuesday, September 06, 2022Initiating Fast-Start Failover to database "cjc2"...Performing failover NOW, please wait...Failover succeeded, new primary is "cjc2"17:41:22.02 Tuesday, September 06, 2022
备库自动切成主库了
set lin 200 pages 100set lin 200 pages 100col FLASHBACK_ON for a10col current_scn for 99999999999999col open_mode for a20col SWITCHOVER_STATUS for a20col PROTECTION_MODE for a20select current_scn,protection_mode,database_role,force_logging,FLASHBACK_ON,open_mode,switchover_status from v$database;CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1185108 MAXIMUM PERFORMANCE PRIMARY YES YES READ WRITE NOT ALLOWED
备库需要手动启动MRP
alter database open;###recover managed standby database using current logfile disconnect from session;###ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
检查当前配置,显示需要重建备库
[oracle@cjc-db-01 ~]$ dgmgrl sys/oracleDGMGRL for Linux: Version 11.2.0.4.0 - 64bit ProductionCopyright (c) 2000, 2009, Oracle. All rights reserved.Welcome to DGMGRL, type "help" for information.Connected.DGMGRL> show configuration;ORA-16795: the standby database needs to be re-createdConfiguration details cannot be determined by DGMGRL
尝试回切
DGMGRL> switchover to cjc1;ORA-16795: the standby database needs to be re-createdConfiguration details cannot be determined by DGMGRLDGMGRL> show configuration;Configuration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc2 - Primary databaseWarning: ORA-16829: fast-start failover configuration is laggingcjc1 - (*) Physical standby database (disabled)ORA-16661: the standby database needs to be reinstatedFast-Start Failover: ENABLEDConfiguration Status:WARNING
备库提示
DGMGRL> show configuration;ORA-16795: the standby database needs to be re-createdConfiguration details cannot be determined by DGMGRL
检查cjc1DGMGRL> show database cjc1;Database - cjc1Role: PHYSICAL STANDBYIntended State: APPLY-ONTransport Lag: (unknown)Apply Lag: (unknown)Apply Rate: (unknown)Real Time Query: OFFInstance(s):cjc1Database Status:ORA-16661: the standby database needs to be reinstated检查cjc2DGMGRL> show database cjc2;Database - cjc2Role: PRIMARYIntended State: TRANSPORT-ONInstance(s):cjc2Database Warning(s):ORA-16829: fast-start failover configuration is laggingDatabase Status:WARNING
查看参数
备库
DGMGRL> show database verbose cjc1;Database - cjc1Role: PHYSICAL STANDBYIntended State: APPLY-ONTransport Lag: (unknown)Apply Lag: (unknown)Apply Rate: (unknown)Real Time Query: OFFInstance(s):cjc1Properties:DGConnectIdentifier = 'cjc1'ObserverConnectIdentifier = ''LogXptMode = 'async'DelayMins = '0'Binding = 'optional'MaxFailure = '0'MaxConnections = '1'ReopenSecs = '300'NetTimeout = '30'RedoCompression = 'DISABLE'LogShipping = 'ON'PreferredApplyInstance = ''ApplyInstanceTimeout = '0'ApplyParallel = 'AUTO'StandbyFileManagement = 'AUTO'ArchiveLagTarget = '0'LogArchiveMaxProcesses = '4'LogArchiveMinSucceedDest = '1'DbFileNameConvert = 'cjc2, cjc1'LogFileNameConvert = 'cjc2, cjc1'FastStartFailoverTarget = 'cjc2'InconsistentProperties = '(monitor)'InconsistentLogXptProps = '(monitor)'SendQEntries = '(monitor)'LogXptStatus = '(monitor)'RecvQEntries = '(monitor)'ApplyLagThreshold = '0'TransportLagThreshold = '0'TransportDisconnectedThreshold = '30'SidName = 'cjc1'StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=cjc-db-01)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=cjc1_DGMGRL)(INSTANCE_NAME=cjc1)(SERVER=DEDICATED)))'StandbyArchiveLocation = '/arch'AlternateLocation = ''LogArchiveTrace = '8191'LogArchiveFormat = 'cjc_%t_%s_%r.arc'TopWaitEvents = '(monitor)'Database Status:ORA-16661: the standby database needs to be reinstated
主库
DGMGRL> show database verbose cjc2;Database - cjc2Role: PRIMARYIntended State: TRANSPORT-ONInstance(s):cjc2Database Warning(s):ORA-16829: fast-start failover configuration is laggingProperties:DGConnectIdentifier = 'cjc2'ObserverConnectIdentifier = ''LogXptMode = 'async'DelayMins = '0'Binding = 'OPTIONAL'MaxFailure = '0'MaxConnections = '1'ReopenSecs = '300'NetTimeout = '30'RedoCompression = 'DISABLE'LogShipping = 'ON'PreferredApplyInstance = ''ApplyInstanceTimeout = '0'ApplyParallel = 'AUTO'StandbyFileManagement = 'AUTO'ArchiveLagTarget = '0'LogArchiveMaxProcesses = '4'LogArchiveMinSucceedDest = '1'DbFileNameConvert = 'cjc1, cjc2'LogFileNameConvert = 'cjc1, cjc2'FastStartFailoverTarget = 'cjc1'InconsistentProperties = '(monitor)'InconsistentLogXptProps = '(monitor)'SendQEntries = '(monitor)'LogXptStatus = '(monitor)'RecvQEntries = '(monitor)'ApplyLagThreshold = '0'TransportLagThreshold = '0'TransportDisconnectedThreshold = '30'SidName = 'cjc2'StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=cjc-db-02)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=cjc2_DGMGRL)(INSTANCE_NAME=cjc2)(SERVER=DEDICATED)))'StandbyArchiveLocation = '/arch'AlternateLocation = ''LogArchiveTrace = '0'LogArchiveFormat = 'cjc_%t_%s_%r.arc'TopWaitEvents = '(monitor)'Database Status:WARNING
主从不同步了,归档收不到
主库DEST_ID ERRORSTATUS LOG_SEQUENCE APPLIED_SCN MAX_CONNECTIONS NET_TIMEOUT COMPRES---------- -------------------- --------- ------------ -------------- --------------- ----------- -------1VALID 12 0 10 DISABLE2DEFERRED 0 0 1 30 DISABLE3INACTIVE 0 0 10 DISABLE4INACTIVE 0 0 10 DISABLE从库SQL> col dest_name for a30col error for a20set lin 200 pages 100col applied_scn for 9999999999999select dest_id,error,status,log_sequence,applied_scn,MAX_CONNECTIONS,NET_TIMEOUT,COMPRESSION from v$archive_dest where dest_id<5;SQL> SQL> SQL> SQL>DEST_ID ERRORSTATUS LOG_SEQUENCE APPLIED_SCN MAX_CONNECTIONS NET_TIMEOUT COMPRES---------- -------------------- --------- ------------ -------------- --------------- ----------- -------1VALID 0 0 10 DISABLE2VALID 0 0 1 30 DISABLE3INACTIVE 0 0 10 DISABLE4INACTIVE 0 0 10 DISABLE
主库
SQL> show parameter log_archive_dest_state_2NAME TYPE VALUE------------------------------------ ----------- ------------------------------log_archive_dest_state_2 string RESET
重新激活
SQL> alter system set log_archive_dest_state_2=defer;System altered.SQL> alter system set log_archive_dest_state_2=enable;System altered.
归档可以正常接收,主库新增数据可以正常同步到从库。
但是dgmgr显示还是不对
ORA-16829: fast-start failover configuration is lagging
ORA-16661: the standby database needs to be reinstated
重建备库
DGMGRL> reinstate database cjc1;Reinstating database "cjc1", please wait...Reinstatement of database "cjc1" succeeded
查看备库对应告警日志
Wed Sep 07 14:04:45 2022NSV1 started with pid=38, OS id=3216OCISessionBegin with PasswordVerifier succeededWed Sep 07 14:04:49 2022RSM0 started with pid=39, OS id=3223Killing 4 processes with pids 2641,2710,2652,2654 (all RFS) in order to reinstate the database after a failover. Requested by OS process 3223Data Guard: Stopping apply to check viability of standbyALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCELWed Sep 07 14:04:54 2022MRP0: Background Media Recovery cancelled with status 16037Errors in file oracle/app/oracle/diag/rdbms/cjc1/cjc1/trace/cjc1_pr00_2725.trc:ORA-16037: user requested cancel of managed recovery operationManaged Standby Recovery not using Real Time ApplyRecovery interrupted!Recovered data files to a consistent state at change 1186859Errors in file oracle/app/oracle/diag/rdbms/cjc1/cjc1/trace/cjc1_pr00_2725.trc:ORA-16037: user requested cancel of managed recovery operationWed Sep 07 14:04:54 2022Errors in file oracle/app/oracle/diag/rdbms/cjc1/cjc1/trace/cjc1_mrp0_2719.trc:ORA-10877: error signaled in parallel recovery slaveMRP0: Background Media Recovery process shutdown (cjc1)Managed Standby Recovery Canceled (cjc1)Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCELkrsk_ler_purge_scn: Purged kccle 4 (next SCN 65535:-1)ALTER SYSTEM SET log_archive_trace=8191 SCOPE=BOTH SID='cjc1';ALTER SYSTEM SET log_archive_format='cjc_%t_%s_%r.arc' SCOPE=SPFILE SID='cjc1';ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=BOTH SID='*';ALTER SYSTEM SET archive_lag_target=0 SCOPE=BOTH SID='*';ALTER SYSTEM SET log_archive_max_processes=4 SCOPE=BOTH SID='*';ALTER SYSTEM SET log_archive_min_succeed_dest=1 SCOPE=BOTH SID='*';ALTER SYSTEM SET db_file_name_convert='cjc2','cjc1' SCOPE=SPFILE;ALTER SYSTEM SET log_file_name_convert='cjc2','cjc1' SCOPE=SPFILE;ALTER SYSTEM SET fal_server='cjc2' SCOPE=BOTH;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILEAttempt to start background Managed Standby Recovery process (cjc1)Wed Sep 07 14:04:56 2022MRP0 started with pid=22, OS id=3233MRP0: Background Managed Standby Recovery process started (cjc1)started logmerger processWed Sep 07 14:05:02 2022Managed Standby Recovery starting Real Time ApplyParallel Media Recovery started with 2 slaveskrss_find_arc: Selecting ARC2 to receive message as last resortWaiting for all non-current ORLs to be archived...All non-current ORLs have been archived.Media Recovery Waiting for thread 1 sequence 17OCISessionBegin with PasswordVerifier succeededWed Sep 07 14:05:02 2022Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILEWed Sep 07 14:05:03 2022Redo Shipping Client Connected as PUBLIC-- Connected User is ValidRFS[6]: Assigned to RFS process 3248RFS[6]: Identified database type as 'physical standby': Client is LGWR ASYNC pid 2512Primary database is in MAXIMUM PERFORMANCE modeRFS[6]: Begin archive primary thread 1 sequence 18 (cjc1)Primary database is in MAXIMUM PERFORMANCE modeRFS[6]: Successfully opened standby log 4: '/oradata/cjc/standby_redo04.log'RFS[6]: Selected log 4 for thread 1 sequence 18 dbid -538205520 branch 1114707085Wed Sep 07 14:05:12 2022Fetching gap sequence in thread 1, gap sequence 17-17FAL[client]: Trying FAL server: cjc2OCISessionBegin with PasswordVerifier succeededWed Sep 07 14:05:23 2022FAL[client]: Trying FAL server: cjc2OCISessionBegin with PasswordVerifier succeededWed Sep 07 14:05:33 2022FAL[client]: Trying FAL server: cjc2OCISessionBegin with PasswordVerifier succeededWed Sep 07 14:05:43 2022FAL[client]: Trying FAL server: cjc2OCISessionBegin with PasswordVerifier succeededWed Sep 07 14:05:44 2022Redo Shipping Client Connected as PUBLIC-- Connected User is ValidRFS[7]: Assigned to RFS process 3288RFS[7]: Identified database type as 'physical standby': Client is ARCH pid 2506Wed Sep 07 14:05:44 2022Redo Shipping Client Connected as PUBLIC-- Connected User is ValidRFS[8]: Assigned to RFS process 3290RFS[8]: Identified database type as 'physical standby': Client is ARCH pid 2503RFS[8]: Begin archive primary thread 1 sequence 17 (cjc1)RFS[8]: Successfully opened standby log 5: '/oradata/cjc/standby_redo05.log'RFS[8]: Selected log 5 for thread 1 sequence 17 dbid -538205520 branch 1114707085RFS[8]: Completed archive log 0 thread 1 sequence 17 (cjc1)Wed Sep 07 14:05:44 2022ARC3: Evaluating archive log 5 thread 1 sequence 17ARC3: Beginning to archive thread 1 sequence 17 (1186140-1186874) (cjc1)ARC3: Creating local archive destination LOG_ARCHIVE_DEST_1: '/arch/cjc_1_17_1114707085.arc' (thread 1 sequence 17) (cjc1)ARC3: Closing local archive destination LOG_ARCHIVE_DEST_1: '/arch/cjc_1_17_1114707085.arc' (cjc1)Committing creation of archivelog '/arch/cjc_1_17_1114707085.arc'Archived Log entry 127 added for thread 1 sequence 17 ID 0xdfed0f5a dest 1:ARC3: Completed archiving thread 1 sequence 17 (0-0) (cjc1)Wed Sep 07 14:05:45 2022Redo Shipping Client Connected as PUBLIC-- Connected User is ValidRFS[9]: Assigned to RFS process 3294RFS[9]: Identified database type as 'physical standby': Client is ARCH pid 2510Media Recovery Log arch/cjc_1_17_1114707085.arcRFS[9]: Begin archive primary thread 1 sequence 17 (cjc1)Errors in file oracle/app/oracle/diag/rdbms/cjc1/cjc1/trace/cjc1_rfs_3294.trc:ORA-16401: archive log rejected by Remote File Server (RFS)Media Recovery Waiting for thread 1 sequence 18 (in transit)Recovery of Online Redo Log: Thread 1 Group 4 Seq 18 Reading mem 0Mem# 0: oradata/cjc/standby_redo04.log
再次检查,恢复正常
DGMGRL> show configuration;Configuration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc2 - Primary databasecjc1 - (*) Physical standby databaseFast-Start Failover: ENABLEDConfiguration Status:SUCCESS回切DGMGRL> switchover to cjc1;Performing switchover NOW, please wait...New primary database "cjc1" is opening...Operation requires startup of instance "cjc2" on database "cjc2"Starting instance "cjc2"...ORACLE instance started.Database mounted.Database opened.Switchover succeeded, new primary is "cjc1
总结:
在使用了DGMGRL来管理Dataguard时,不要再使用SQLPLUS命令行来管理了,所有的操作做好在DGMGRL下进行修改配置,否则会造成参数冲突,状态异常。
四:通过keepalived进行vip自动切换
既然DG可以自动切换了,如何保障主库出现异常时,应用中断时间最短呢,或者尽量避免人为干预?
这需要VIP或一个域名,应用连接数据库连接的是VIP或域名,当主库异常时,通过 FSFO 进行自动主备切换,VIP地址通过keepalived自动切换,切换完成后,应用仍然可以通过VIP进行访问数据库。
1.安装keepalived
[root@cjc-db-02 ~]# cd soft/[root@cjc-db-02 soft]# tar -zxvf keepalived-2.0.15.tar.gz[root@cjc-db-02 soft]# cd keepalived-2.0.15/[root@cjc-db-02 keepalived-2.0.15]# ./configure --prefix=/usr/local/keepalived
报错
configure: error:!!! OpenSSL is not properly installed on your system. !!!!!! Can not include OpenSSL headers files. !!!
解决
[root@cjc-db-01 keepalived-2.0.15]# yum install openssl openssl-devel
编译
make && make installecho $?
将命令复制到/usr/sbin里:
cp usr/local/keepalived/sbin/keepalived usr/sbin/cp usr/local/keepalived/etc/sysconfig/keepalived etc/sysconfig/
配置keepalived,VIP地址为172.16.6.150
节点1 172.16.6.137
vi /etc/keepalived/keepalived.conf! Configuration File for keepalivedvrrp_script chk_dg_stats {script "/etc/keepalived/check_dataguard.sh"interval 2weight -5fall 2rise 1}vrrp_instance VI_1 {state MASTERinterface enp0s3mcast_src_ip 172.16.6.137virtual_router_id 100priority 100inopreemptadvert_int 1authentication {auth_type PASSauth_pass 888888}virtual_ipaddress {172.16.6.150}track_script {chk_dg_stats}}
节点2 172.16.6.138
[root@test05 ~]# cat etc/keepalived/keepalived.conf! Configuration File for keepalivedvrrp_script chk_dg_stats {script "/etc/keepalived/check_dataguard.sh"interval 2weight -5fall 2rise 1}vrrp_instance VI_1 {state BACKUPinterface enp0s3mcast_src_ip 172.16.6.138virtual_router_id 100priority 100inopreemptadvert_int 1authentication {auth_type PASSauth_pass 888888}virtual_ipaddress {172.16.6.150}track_script {chk_dg_stats}}
检查脚本
vi etc/keepalived/check_dataguard.sh#!/bin/bashdbstats=`ps -ef | grep ora_smon | grep -v grep | wc -l`dgstats=`ps -ef | grep ora_mrp | grep -v grep | wc -l`if [ "${dbstats}" -eq 0 ]; thensystemctl stop keepalived.service#elif [[ "${dbstats}" -gt 0 ]] && [[ "${dgstats}" -gt 0 ]]; then#systemctl stop keepalived.servicefi
添加执行权限
chmod a+x etc/keepalived/check_dataguard.sh
启动keepalived
[root@cjc-db-01 keepalived]# systemctl start keepalived.service[root@cjc-db-01 keepalived]# systemctl status keepalived.service?.keepalived.service - LVS and VRRP High Availability MonitorLoaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled)Active: active (running) since Wed 2022-09-07 15:28:01 CST; 6s agoProcess: 16728 ExecStart=/usr/local/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)Main PID: 16730 (keepalived)Tasks: 2CGroup: system.slice/keepalived.service?..16730 usr/local/keepalived/sbin/keepalived -D?..16731 usr/local/keepalived/sbin/keepalived -DSep 07 15:28:01 cjc-db-01 Keepalived_vrrp[16731]: VRRP_Script(chk_dg_stats) succeededSep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: (VI_1) Receive advertisement timeoutSep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: (VI_1) Entering MASTER STATESep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: (VI_1) setting VIPs.Sep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: Sending gratuitous ARP on enp0s3 for 172.16.6.150Sep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: (VI_1) Sending/queueing gratuitous ARPs on enp0s3 for 172.16.6.150Sep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: Sending gratuitous ARP on enp0s3 for 172.16.6.150Sep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: Sending gratuitous ARP on enp0s3 for 172.16.6.150Sep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: Sending gratuitous ARP on enp0s3 for 172.16.6.150Sep 07 15:28:05 cjc-db-01 Keepalived_vrrp[16731]: Sending gratuitous ARP on enp0s3 for 172.16.6.150
检查vip
ip a2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether 08:00:27:29:44:a2 brd ff:ff:ff:ff:ff:ffinet 172.16.6.137/16 brd 172.16.255.255 scope global noprefixroute enp0s3valid_lft forever preferred_lft foreverinet 172.16.6.150/32 scope global enp0s3valid_lft forever preferred_lft foreverinet6 fe80::2d75:f64c:8022:6f66/64 scope link noprefixroutevalid_lft forever preferred_lft forever
测试VIP漂移
[root@cjc-db-01 keepalived]# systemctl stop keepalived.service[root@cjc-db-02 keepalived]# ip a1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope hostvalid_lft forever preferred_lft forever2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether 08:00:27:5c:ac:40 brd ff:ff:ff:ff:ff:ffinet 172.16.6.138/16 brd 172.16.255.255 scope global noprefixroute enp0s3valid_lft forever preferred_lft foreverinet 172.16.6.150/32 scope global enp0s3valid_lft forever preferred_lft foreverinet6 fe80::2d75:f64c:8022:6f66/64 scope link tentative noprefixroute dadfailedvalid_lft forever preferred_lft foreverinet6 fe80::f061:4b23:c393:ca5/64 scope link noprefixroutevalid_lft forever preferred_lft forever
禁用自动切换
DGMGRL> disable fast_start failover;Disabled.DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:SUCCESS
配置监听
[oracle@cjc-db-01 ~]$ sqlplus system/oracle@172.16.6.150:1521/cjc1SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 7 15:33:18 2022Copyright (c) 1982, 2013, Oracle. All rights reserved.ERROR:ORA-12541: TNS:no listener
[oracle@cjc-db-01 admin]$ cat listener.oraSID_LIST_LISTENER =(SID_LIST =(SID_DESC =(GLOBAL_DBNAME = cjc1)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc1))(SID_DESC =(GLOBAL_DBNAME = cjc1_DGMGRL)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc1)))LISTENER =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.6.137)(PORT = 1521)))(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.6.150)(PORT = 1521))))
配置服务
SQL> show parameter nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------cell_offloadgroup_name stringdb_file_name_convert string cjc2, cjc1db_name string cjcdb_unique_name string cjc1global_names boolean FALSEinstance_name string cjc1lock_name_space stringlog_file_name_convert string cjc2, cjc1processor_group_name stringservice_names string cjc1SQL> alter system set service_names='cjc1,cjc' scope=both;System altered.SQL> show parameter service_nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------service_names string cjc1,cjc从库alter system set service_names='cjc2,cjc' scope=both;
重启监听
lsnrctl reloadlsnrctl stoplsnrctl start
查看监听状态
[oracle@cjc-db-01 admin]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2022 15:45:15Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.6.137)(PORT=1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0 - ProductionStart Date 07-SEP-2022 15:44:08Uptime 0 days 0 hr. 1 min. 7 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /oracle/app/oracle/product/11.2/db/network/admin/listener.oraListener Log File /oracle/app/oracle/diag/tnslsnr/cjc-db-01/listener/alert/log.xmlListening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.6.137)(PORT=1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.6.150)(PORT=1521)))Services Summary...Service "cjc1" has 2 instance(s).Instance "cjc1", status UNKNOWN, has 1 handler(s) for this service...Instance "cjc1", status READY, has 1 handler(s) for this service...Service "cjc1_DGB" has 1 instance(s).Instance "cjc1", status READY, has 1 handler(s) for this service...Service "cjc1_DGMGRL" has 1 instance(s).Instance "cjc1", status UNKNOWN, has 1 handler(s) for this service...Service "cjcXDB" has 1 instance(s).Instance "cjc1", status READY, has 1 handler(s) for this service...The command completed successfully
连接测试
SQL> conn system/oracle@172.16.6.137:1521/cjc1Connected.SQL> conn system/oracle@172.16.6.150:1521/cjc1Connected.
监听文件
[oracle@cjc-db-01 admin]$ cat listener.oraSID_LIST_LISTENER =(SID_LIST =(SID_DESC =(GLOBAL_DBNAME = cjc1)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc1))(SID_DESC =(GLOBAL_DBNAME = cjc1_DGMGRL)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc1))(SID_DESC =(GLOBAL_DBNAME = cjc)(ORACLE_HOME = /oracle/app/oracle/product/11.2/db)(SID_NAME = cjc)))LISTENER =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.6.137)(PORT = 1521)))(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.6.150)(PORT = 1521))))测试SQL> conn system/oracle@172.16.6.137:1521/cjc1Connected.SQL> conn system/oracle@172.16.6.137:1521/cjcConnected.SQL> conn system/oracle@172.16.6.150:1521/cjc1Connected.SQL> conn system/oracle@172.16.6.150:1521/cjcConnected.SQL> conn system/oracle@172.16.6.138:1521/cjc2Connected.SQL> conn system/oracle@172.16.6.138:1521/cjcConnected.监听状态SQL> ho lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2022 16:05:22Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.6.137)(PORT=1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0 - ProductionStart Date 07-SEP-2022 15:44:08Uptime 0 days 0 hr. 21 min. 13 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /oracle/app/oracle/product/11.2/db/network/admin/listener.oraListener Log File /oracle/app/oracle/diag/tnslsnr/cjc-db-01/listener/alert/log.xmlListening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.6.137)(PORT=1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.6.150)(PORT=1521)))Services Summary...Service "cjc" has 2 instance(s).Instance "cjc", status UNKNOWN, has 1 handler(s) for this service...Instance "cjc1", status READY, has 1 handler(s) for this service...Service "cjc1" has 2 instance(s).Instance "cjc1", status UNKNOWN, has 1 handler(s) for this service...Instance "cjc1", status READY, has 1 handler(s) for this service...Service "cjc1_DGB" has 1 instance(s).Instance "cjc1", status READY, has 1 handler(s) for this service...Service "cjc1_DGMGRL" has 1 instance(s).Instance "cjc1", status UNKNOWN, has 1 handler(s) for this service...Service "cjcXDB" has 1 instance(s).Instance "cjc1", status READY, has 1 handler(s) for this service...The command completed successfully
测试VIP切换
停主库
SQL> shutdown immediate
查看VIP已经飘到从库
ip a: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether 08:00:27:5c:ac:40 brd ff:ff:ff:ff:ff:ffinet 172.16.6.138/16 brd 172.16.255.255 scope global noprefixroute enp0s3valid_lft forever preferred_lft foreverinet 172.16.6.150/32 scope global enp0s3valid_lft forever preferred_lft forever
连接测试
SQL> conn system/oracle@172.16.6.150:1521/cjcConnected.sqlplus system/oracle@172.16.6.150:1521/cjc
set lin 200 pages 100set lin 200 pages 100col FLASHBACK_ON for a10col current_scn for 99999999999999col open_mode for a20col SWITCHOVER_STATUS for a20col PROTECTION_MODE for a20select current_scn,protection_mode,database_role,force_logging,FLASHBACK_ON,open_mode,switchover_status from v$database;CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1219061 MAXIMUM PERFORMANCE PHYSICAL STANDBY YES YES READ ONLY WITH APPLY NOT ALLOWED
只是VIP飘了,数据库角色没有变
需要执行手动切换 或 配置自动切换后才能进行使用
通过dg broker进行手动切换
DGMGRL> switchover to cjc2;Performing switchover NOW, please wait...Operation requires a connection to instance "cjc2" on database "cjc2"Connecting to instance "cjc2"...Connected.New primary database "cjc2" is opening...Operation requires startup of instance "cjc1" on database "cjc1"Starting instance "cjc1"...ORACLE instance started.Database mounted.Database opened.Switchover succeeded, new primary is "cjc2"
检查,切换成功
[oracle@cjc-db-01 ~]$ sqlplus system/oracle@172.16.6.150:1521/cjcSQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 7 16:28:14 2022Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> show parameter nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------cell_offloadgroup_name stringdb_file_name_convert string cjc1, cjc2db_name string cjcdb_unique_name string cjc2global_names boolean FALSEinstance_name string cjc2lock_name_space stringlog_file_name_convert string cjc1, cjc2processor_group_name stringservice_names string cjc2,cjc
通过VIP连接已经是cjc2了
CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1240051 MAXIMUM PERFORMANCE PRIMARY YES YES READ WRITE SESSIONS ACTIVE
回切
回切前需要先启动从库的keepalived服务
[root@cjc-db-01 keepalived]# systemctl start keepalived.service
开始回切
DGMGRL> switchover to cjc1Performing switchover NOW, please wait...New primary database "cjc1" is opening...Operation requires startup of instance "cjc2" on database "cjc2"Starting instance "cjc2"...ORACLE instance started.Database mounted.Database opened.Switchover succeeded, new primary is "cjc1"
通过VIP连接数据库
SQL> show parameter instance_nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------instance_name string cjc1sqlplus system/oracle@172.16.6.150:1521/cjcCURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1260596 MAXIMUM PERFORMANCE PRIMARY YES YES READ WRITE SESSIONS ACTIVE
测试 FSFO+keepalived自动切换
启动自动切换
DGMGRL> enable fast_start failover;DGMGRL> show configurationDGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - (*) Physical standby databaseFast-Start Failover: ENABLEDConfiguration Status:SUCCESS
主库
enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether 08:00:27:29:44:a2 brd ff:ff:ff:ff:ff:ffinet 172.16.6.137/16 brd 172.16.255.255 scope global noprefixroute enp0s3valid_lft forever preferred_lft foreverinet 172.16.6.150/32 scope global enp0s3
主库执行非正常关库操作
SQL> shutdown abortORACLE instance shut down.
查看fsfo.log日志,成功切换到cjc2
16:38:20.23 Wednesday, September 07, 2022Initiating Fast-Start Failover to database "cjc2"...Performing failover NOW, please wait...Failover succeeded, new primary is "cjc2"16:38:24.18 Wednesday, September 07, 2022
vip 已经切换到138上
enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether 08:00:27:5c:ac:40 brd ff:ff:ff:ff:ff:ffinet 172.16.6.138/16 brd 172.16.255.255 scope global noprefixroute enp0s3valid_lft forever preferred_lft foreverinet 172.16.6.150/32 scope global enp0s3valid_lft forever preferred_lft foreverinet6 fe80::2d75:f64c:8022:6f66/64 scope link tentative noprefixroute dadfailedvalid_lft forever preferred_lft foreverinet6 fe80::f061:4b23:c393:ca5/64 scope link noprefixroutevalid_lft forever preferred_lft forever
主库也是切换到138 cjc2上
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc2 - Primary databaseWarning: ORA-16829: fast-start failover configuration is laggingcjc1 - (*) Physical standby database (disabled)ORA-16661: the standby database needs to be reinstatedFast-Start Failover: ENABLEDConfiguration Status:WARNING
恢复原主库137 cjc1
SQL> startupORACLE instance started.Total System Global Area 1135747072 bytesFixed Size 2252544 bytesVariable Size 754974976 bytesDatabase Buffers 369098752 bytesRedo Buffers 9420800 bytesDatabase mounted.ORA-16649: possible failover to another database prevents this database frombeing opened
报错可以忽略,后台自动执行闪回数据库,重新open数据库
可以看到已经加会到备库
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc2 - Primary databasecjc1 - (*) Physical standby databaseFast-Start Failover: ENABLEDConfiguration Status:SUCCESS
普通关闭数据库,理论上主备角色是不会自动切换的,VIP会发生漂移
[oracle@cjc-db-01 ~]$ sqlplus system/oracle@172.16.6.150:1521/cjcSQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 7 16:44:40 2022Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> show parameter instance_nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------instance_name string cjc2
启动keepalived
[root@cjc-db-01 keepalived]# systemctl start keepalived.service
主库关闭实例
查看IP
enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether 08:00:27:5c:ac:40 brd ff:ff:ff:ff:ff:ffinet 172.16.6.138/16 brd 172.16.255.255 scope global noprefixroute enp0s3valid_lft forever preferred_lft foreverinet 172.16.6.150/32 scope global enp0s3valid_lft forever preferred_lft foreverinet6 fe80::2d75:f64c:8022:6f66/64 scope link tentative noprefixroute dadfailedvalid_lft forever preferred_lft foreverinet6 fe80::f061:4b23:c393:ca5/64 scope link noprefixroutevalid_lft forever preferred_lft forever
SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.
主从角色并没有自动切换
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc2 - Primary databasecjc1 - (*) Physical standby databaseFast-Start Failover: ENABLEDConfiguration Status:ORA-01034: ORACLE not availableORA-16625: cannot reach database "cjc2"DGM-17017: unable to determine configuration status
但是VIP进行切换了
[oracle@cjc-db-01 ~]$ sqlplus system/oracle@172.16.6.150:1521/cjcSQL> show parameter instance_nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------instance_name string cjc1set lin 200 pages 100set lin 200 pages 100col FLASHBACK_ON for a10col current_scn for 99999999999999col open_mode for a20col SWITCHOVER_STATUS for a20col PROTECTION_MODE for a20select current_scn,protection_mode,database_role,force_logging,FLASHBACK_ON,open_mode,switchover_status from v$database;CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1261913 MAXIMUM PERFORMANCE PHYSICAL STANDBY YES YES READ ONLY WITH APPLY SWITCHOVER PENDING
手动切换
启动主库实例
startup
启动主库keepalived
systemctl start keepalived.service
重启从库keepalived,目的是将VIP切换到主库
[root@cjc-db-01 keepalived]# systemctl stop keepalived.service[root@cjc-db-01 keepalived]# systemctl start keepalived.service
关闭自动切换
DGMGRL> disable fast_start failover;Disabled.DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc2 - Primary databasecjc1 - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:SUCCES
回切
DGMGRL> switchover to cjc1Performing switchover NOW, please wait...New primary database "cjc1" is opening...Operation requires startup of instance "cjc2" on database "cjc2"Starting instance "cjc2"...ORACLE instance started.Database mounted.Database opened.Switchover succeeded, new primary is "cjc1"
DGMGRL> show configurationConfiguration - cjcdgbrokerProtection Mode: MaxPerformanceDatabases:cjc1 - Primary databasecjc2 - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:SUCCESS
[oracle@cjc-db-01 ~]$ sqlplus system/oracle@172.16.6.150:1521/cjcSQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 7 17:29:02 2022Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> show parameter instance_nameNAME TYPE VALUE------------------------------------ ----------- ------------------------------instance_name string cjc1CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR FLASHBACK_ OPEN_MODE SWITCHOVER_STATUS--------------- -------------------- ---------------- --- ---------- -------------------- --------------------1304918 MAXIMUM PERFORMANCE PRIMARY YES YES READ WRITE SESSIONS ACTIVE
想了解更多干货,可通过下方扫码关注

可扫码添加上智启元官方客服微信👇

17认证网








