结论1:主库和master ob 挂掉,不会fofo!
DGMGRL> SHOW OBSERVERS
ObserverConfigFile=observer.ora
observer configuration file parsing succeeded
Submitted command "SHOW OBSERVER" using connect identifier "orcl"
Connected to "orcl"
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "grp_a" - Master
Host Name: prdb19
Last Ping to Primary: 0 seconds ago
Last Ping to Target: 3 seconds ago
Observer "grp_b" - Backup
Host Name: prdg19
Last Ping to Primary: 2 seconds ago
Last Ping to Target: 2 seconds ago
.
Submitted command "SHOW OBSERVER" using connect identifier "orcl2dg"
Connected to "orcl2dg"
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "grp_a" - Master
Host Name: prdb19
Last Ping to Primary: 2 seconds ago
Last Ping to Target: 2 seconds ago
Observer "grp_b" - Backup
Host Name: prdg19
Last Ping to Primary: 1 second ago
Last Ping to Target: 1 second ago
.
Submitted command "SHOW OBSERVER" using connect identifier "orcl0dg"
Connected to "orcl0dg"
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "grp_a" - Master
Host Name: prdb19
Last Ping to Primary: 2 seconds ago
Last Ping to Target: 2 seconds ago
Observer "grp_b" - Backup
Host Name: prdg19
Last Ping to Primary: 1 second ago
Last Ping to Target: 2 seconds ago
DGMGRL> SHOW CONFIGURATION lag verbose
Configuration - dg_config
Protection Mode: MaxPerformance
Members:
orcl - Primary database
orcl2dg - (*) Physical standby database
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
orcl0dg - Physical standby database
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
(*) Fast-Start Failover target
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'FALSE'
ExternalDestination1 = ''
ExternalDestination2 = ''
PrimaryLostWriteAction = 'CONTINUE'
ConfigurationWideServiceName = 'orcl_CFG'
Fast-Start Failover: Enabled in Potential Data Loss Mode
Lag Limit: 30 seconds
Threshold: 30 seconds
Active Target: orcl2dg
Potential Targets: "orcl2dg"
orcl2dg valid
Observers: (*) grp_a
grp_b
Shutdown Primary: TRUE
Auto-reinstate: TRUE
Observer Reconnect: (none)
Observer Override: FALSE
Configuration Status:
SUCCESS
DGMGRL>
--broker 数据无正常返回:
[root@prdg19 ~]# su - oracle
Last login: Sat Oct 12 22:10:17 CST 2024 on pts/2
[oracle@prdg19 rdbms]$ dgmgrl sys/Szcmb123_
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sat Oct 12 22:14:53 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected to "orcl2dg"
Connected as SYSDBA.
DGMGRL> SHOW CONFIGURATION lag verbose
--Fast-Start Failover is not possible 因为没有master observer【结论,没有设置参数,不会切换】
Unable to connect to database using prdb19/orcl
[W000 2024-10-12T22:16:31.128+08:00] Primary database cannot be reached.
[W000 2024-10-12T22:16:31.128+08:00] Fast-Start Failover threshold has not exceeded. Retry for the next 1 second
[W000 2024-10-12T22:16:31.128+08:00] Try to connect to the primary.
[W000 2024-10-12T22:16:34.131+08:00] Primary database cannot be reached.
[W000 2024-10-12T22:16:34.131+08:00] Fast-Start Failover threshold has expired.
[W000 2024-10-12T22:16:34.131+08:00] Try to connect to the standby.
[W000 2024-10-12T22:16:34.131+08:00] Making a last connection attempt to primary database before proceeding with Fast-Start Failover.
[W000 2024-10-12T22:16:34.131+08:00] Check if the standby is ready for failover.
ORA-12543: TNS:destination host unreachable
Unable to connect to database using prdb19/orcl
[W000 2024-10-12T22:16:34.143+08:00] Fast-Start Failover is not possible because this observer is not the master.
[W000 2024-10-12T22:16:35.144+08:00] Try to connect to the primary.
ORA-12543: TNS:destination host unreachable
Unable to connect to database using prdb19/orcl
ORA-12543: TNS:destination host unreachable
Unable to connect to database using prdb19/orcl
[W000 2024-10-12T22:16:37.149+08:00] Primary database cannot be reached.
[W000 2024-10-12T22:16:37.149+08:00] Try to connect to the primary.
ORA-12543: TNS:destination host unreachable
Unable to connect to database using prdb19/orcl
--主库主机重启后,不会启动
DGMGRL> SHOW CONFIGURATION lag verbose
Configuration - dg_config
Protection Mode: MaxPerformance
Members:
orcl - Primary database
Error: ORA-16810: multiple errors or warnings detected for the member
orcl2dg - (*) Physical standby database
Error: ORA-16825: multiple errors or warnings, including fast-start failover-related errors or warnings, detected for the database
Transport Lag: 8 minutes 43 seconds (computed 2 seconds ago)
Apply Lag: 8 minutes 43 seconds (computed 2 seconds ago)
orcl0dg - Physical standby database
Warning: ORA-16857: member disconnected from redo source for longer than specified threshold
Transport Lag: 8 minutes 43 seconds (computed 2 seconds ago)
Apply Lag: 8 minutes 43 seconds (computed 2 seconds ago)
--连接主库后,才能看到observer 的failover, 没有发现fsfo
DGMGRL> show observer
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "grp_b" - Master
Host Name: prdg19
Last Ping to Primary: 0 seconds ago
Last Ping to Target: 1 second ago
Observer "grp_a" - Backup
Host Name: prdb19
Last Ping to Primary: (unknown)
Last Ping to Target: (unknown)
--解决方案[不可行]:
没有设置参数!测试结果同上,但是发现,主库启动后,ob failover,而且发生fsfo,风险较大!
EDIT CONFIGURATION SET PROPERTY ObserverReconnect=5;
EDIT CONFIGURATION SET PROPERTY ObserverOverride=TRUE;
DGMGRL> SHOW CONFIGURATION lag verbose
Configuration - dg_config
Protection Mode: MaxPerformance
Members:
orcl - Primary database
orcl2dg - (*) Physical standby database
Transport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 0 seconds (computed 1 second ago)
orcl0dg - Physical standby database
Transport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 0 seconds (computed 1 second ago)
(*) Fast-Start Failover target
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '5'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'TRUE'
ExternalDestination1 = ''
ExternalDestination2 = ''
PrimaryLostWriteAction = 'CONTINUE'
ConfigurationWideServiceName = 'orcl_CFG'
Fast-Start Failover: Enabled in Potential Data Loss Mode
Lag Limit: 30 seconds
Threshold: 30 seconds
Active Target: orcl2dg
Potential Targets: "orcl2dg"
orcl2dg valid
Observers: (*) grp_a
grp_b
prdg19
Shutdown Primary: TRUE
Auto-reinstate: TRUE
Observer Reconnect: 5 seconds
Observer Override: TRUE
Configuration Status:
SUCCESS
DGMGRL>
DGMGRL> show observer
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "grp_a" - Master
Host Name: prdb19
Last Ping to Primary: 3 seconds ago
Last Ping to Target: 3 seconds ago
Observer "grp_b" - Backup
Host Name: prdg19
Last Ping to Primary: 2 seconds ago
Last Ping to Target: 4 seconds ago
Observer "prdg19" - Backup
Host Name: prdg19
Last Ping to Primary: 2 seconds ago
Last Ping to Target: 3 seconds ago
DGMGRL>
--同样的报错
Unable to connect to database using prdb19/orcl
[W000 2024-10-12T22:51:57.905+08:00] Fast-Start Failover is not possible because this observer is not the master.
[W000 2024-10-12T22:51:58.906+08:00] Try to connect to the primary.
ORA-12543: TNS:destination host unreachable
Unable to connect to database using prdb19/orcl
ORA-12543: TNS:destination host unreachable
Unable to connect to database using prdb19/orcl
[W000 2024-10-12T22:52:00.917+08:00] Primary database cannot be reached.
[W000 2024-10-12T22:52:00.917+08:00] Try to connect to the primary.
ORA-12543: TNS:destination host unreachable
Unable to connect to database using prdb19/orcl
--下面程序没有成功
set serveroutput on
declare
status integer;
begin
status := dbms_dg.initiate_fs_failover('Failover Requested');
dbms_output.put_line('Fast-Start Failover is disabled: Expected status = ORA-16646');
dbms_output.put_line(' Actual Status = ORA-' || status);
end;
/
exit;
--主库启动后,ob立即failover fsfo理解启动!【问题和隐患】设置参数后的隐患
DGMGRL> show observer
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "prdg19" - Master
Host Name: prdg19
Last Ping to Primary: 1 second ago
Last Ping to Target: 3 seconds ago
Observer "grp_a" - Backup
Host Name: prdb19
Last Ping to Primary: (unknown)
Last Ping to Target: (unknown)
Observer "grp_b" - Backup
Host Name: prdg19
Last Ping to Primary: 2 seconds ago
Last Ping to Target: 2 seconds ago
--obsever 顺序*****************************
show observer
DGMGRL> show observer
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "grp_a" - Master
Host Name: prdb19
Last Ping to Primary: 17 seconds ago
Last Ping to Target: 17 seconds ago
Observer "grp_b" - Backup
Host Name: prdg19
Last Ping to Primary: 1 second ago
Last Ping to Target: 1 second ago
Observer "prdg19" - Backup
Host Name: prdg19
Last Ping to Primary: 0 seconds ago
Last Ping to Target: 3 seconds ago
--顺序要求的时候,参考:PreferredObserverHosts
DGMGRL> show observer
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "grp_b" - Master
Host Name: prdg19
Last Ping to Primary: 1 second ago
Last Ping to Target: 2 seconds ago
Observer "grp_a" - Backup
Host Name: prdb19
Last Ping to Primary: 2 seconds ago
Last Ping to Target: 0 seconds ago
Observer "grp_c" - Backup
Host Name: prdg19
Last Ping to Primary: 1 second ago
Last Ping to Target: 0 seconds ago
DGMGRL>
DGMGRL> edit database orcl set property PreferredObserverHosts='prdg19';
Property "preferredobserverhosts" updated
DGMGRL> edit database orcl2dg set property PreferredObserverHosts='prdg19';
Property "preferredobserverhosts" updated
DGMGRL>
--如何hang进程!
[oracle@prdg19 cluster1]$ ps -ef|grep dgmgrl
oracle 3640 17113 0 23:19 pts/5 00:00:01 dgmgrl
oracle 8071 1527 0 23:24 pts/6 00:00:00 grep --color=auto dgmgrl
oracle 27715 9627 0 22:31 pts/2 00:00:09 dgmgrl
[oracle@prdg19 cluster1]$ kill -SIGSTOP 3640
[oracle@prdg19 cluster1]$ kill -conn 3640
-bash: kill: conn: invalid signal specification
[oracle@prdg19 cluster1]$ kill -cont 3640
[oracle@prdg19 cluster1]$ kill -9 27715
DGMGRL> show observer
Configuration - dg_config
Primary: orcl
Active Target: orcl2dg
Observer "grp_c" - Master
Host Name: prdg19
Last Ping to Primary: 0 seconds ago
Last Ping to Target: 2 seconds ago
Observer "grp_a" - Backup
Host Name: prdb19
Last Ping to Primary: 1 second ago
Last Ping to Target: 3 seconds ago
Observer "grp_b" - Backup
Host Name: prdg19
Last Ping to Primary: 65 seconds ago
Last Ping to Target: 34 seconds ago
DGMGRL>