Pointing out the word initially in definitions above : if primaryServer dies, thanks to Data Guard standbyServer will become a primary server, so things may become harder to explain (and I should probably give more descriptive names to servers and datacenters ). Anyway, this whole article is about the initial situation, where the primary server is in the primary datacenter.
Referring to servers primaryServer, standbyServer or currentServer (see below) is made via any means allowing to contact them over the network : FQDN, DNS record, /etc/hosts entry, ...
For example : standbyServer may have a value such as mystandbyoracleserver.domain.tld, whereas standbyServerShortname would just be mystandbyoracleserver.
Variables presented all uppercase in examples below should be entered uppercase too. Variables shown in camelCase should be all lowercase. This makes no big difference anyway, except in paths.
Some actions/usages/rules/notations described below may be specific to my company and differ from the general usage and documentation.
cd /home/afh/livraison/05.00.00/oracle; ./install_oratoolbox_2.7.sh
As root : sed -i 's/:N/:Y/g' /etc/oratab
ORACLE_SID = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = currentServer)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = ORACLE_SID) ) ) ORACLE_SID_PRIMARYDATACENTER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = primaryServer)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = ORACLE_SID) ) ) ORACLE_SID_STANDBYDATACENTER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = standbyServer)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = ORACLE_SID) ) )
You'll have to create one version of this file for primaryServer, and another one for standbyServer, the only difference being currentServer.
LISTENER_ORACLE_SID = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = currentServer)(PORT = 1521)) ) ) SID_LIST_LISTENER_ORACLE_SID = (SID_LIST = (SID_DESC = (SID_NAME = ORACLE_SID) (GLOBAL_DBNAME = ORACLE_SID_CURRENTDATACENTER_DGMGRL) (ORACLE_HOME = ORACLE_HOME) ) ) DIAG_ADR_ENABLED_LISTENER_ORACLE_SID = ON LOGGING_LISTENER_ORACLE_SID = ON TRACE_LEVEL_LISTENER_ORACLE_SID = OFF TRACE_TIMESTAMP_LISTENER_ORACLE_SID = TRUE SUBSCRIBE_FOR_NODE_DOWN_EVENT_listener = OFF ADMIN_RESTRICTIONS_LISTENER_ORACLE_SID = ON LOCAL_OS_AUTHENTIFICATION_LISTENER_ORACLE_SID = ON SECURE_REGISTER_LISTENER_ORACLE_SID = (TCP)
You'll have to create one version of this file for primaryServer, and another one for standbyServer, the differences being currentServer and CURRENTDATACENTER.
As oracle : export ORACLE_SID=ORACLE_SID; sqlplus / as sysdba
Is archivelog mode enabled and logging forced ? (Details : 1, 2, 3)
SET linesize 100; COL "FORCE_LOGGING" FORMAT A15; SELECT dbid, name, log_mode, force_logging FROM v$database;
DBID NAME LOG_MODE FORCE_LOGGING
---------- ----------------- --------------------- ---------------
1152768762 ORACLE_SID ARCHIVELOG NO
Database altered.
DBID NAME LOG_MODE FORCE_LOGGING
---------- ----------------- --------------------- ---------------
1152768762 ORACLE_SID ARCHIVELOG YES
alter system set db_unique_name='ORACLE_SID_PRIMARYDATACENTER' scope=spfile; alter system set remote_login_passwordfile=EXCLUSIVE scope=spfile; alter system set standby_file_management=auto scope=both; alter system set log_archive_dest_state_2=defer scope=both;
System altered.
alter system set local_listener='ORACLE_SID_PRIMARYDATACENTER' scope=both; alter system set log_archive_dest_1='LOCATION=/appli/oracle/ORACLE_SID/oraarch/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES)' scope=spfile;
System altered.
Database closed. Database dismounted. ORACLE instance shut down.
ORACLE instance started. Total System Global Area 8551575552 bytes Fixed Size 2270360 bytes Variable Size 5200939880 bytes Database Buffers 3338665984 bytes Redo Buffers 9699328 bytes Database mounted. Database opened.
alter system set log_archive_dest_2='SERVICE=ORACLE_SID_STANDBYDATACENTER LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) delay=0 DB_UNIQUE_NAME=ORACLE_SID_STANDBYDATACENTER'; alter system set log_archive_config='dg_config=(ORACLE_SID_PRIMARYDATACENTER,ORACLE_SID_STANDBYDATACENTER)' scope=both;
System altered.
FAL settings define where the current server will get missing archivelogs in case of a gap (i.e. when acting as a standby server). The fal_server is the one serving archivelogs, and fal_client is the one receiving them (sources 1, 2).
Values are Oracle Net service names. Such names are usually defined locally in tnsnames.ora, or in a directory server (details).
These settings stay inert on primaryServer until Data Guard switches and primaryServer becomes a standby server.
alter system set fal_server='ORACLE_SID_STANDBYDATACENTER' scope=both; alter system set fal_client='ORACLE_SID_PRIMARYDATACENTER' scope=both;
System altered.
Database closed. Database dismounted. ORACLE instance shut down.
mv $ORACLE_HOME/dbs/{orapw$ORACLE_SID,init$ORACLE_SID.ora,spfile$ORACLE_SID.ora} /home/oracle/admin/$ORACLE_SID/dbs ln -sf /home/oracle/admin/$ORACLE_SID/dbs/{orapw$ORACLE_SID,init$ORACLE_SID.ora,spfile$ORACLE_SID.ora} $ORACLE_HOME/dbs/
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 6 10:12:52 2016 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance.
ORACLE instance started. Total System Global Area 8551575552 bytes Fixed Size 2270360 bytes Variable Size 5200939880 bytes Database Buffers 3338665984 bytes Redo Buffers 9699328 bytes Database mounted. Database opened.
column type format a10; show parameter log_archive_dest_1
NAME TYPE VALUE
--------------------- ---------- ------------------------------
log_archive_dest_1 string LOCATION=/appli/oracle/ORACLE_SID/oraarch/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
NAME TYPE VALUE --------------------- ---------- ------------------------------ log_archive_dest_2 string SERVICE=ORACLE_SID_STANDBYDATACENTER LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) delay=0 DB_UNIQUE_NAME=ORACLE_SID_STANDBYDATACENTER
NAME TYPE VALUE --------------------- ---------- ------------------------------ fal_client string ORACLE_SID_PRIMARYDATACENTER fal_server string ORACLE_SID_STANDBYDATACENTER
NAME TYPE VALUE --------------------- ---------- ------------------------------ log_archive_config string dg_config=(ORACLE_SID_PRIMARYDATACENTER,ORACLE_SID_STANDBYDATACENTER)
standby redologs should be the same size than online redologs. To get the size of the online redologs :
-rw-r----- 1 oracle oinstall 151M Jan 6 11:15 ORACLE_SID_redo1_1.rdo -rw-r----- 1 oracle oinstall 151M Jan 6 10:13 ORACLE_SID_redo2_1.rdo -rw-r----- 1 oracle oinstall 151M Jan 6 10:13 ORACLE_SID_redo3_1.rdo
<RedoLogGroupAttributes id="1"> <reuse>false</reuse> <fileSize unit="KB">153600</fileSize> <Thread>1</Thread> <member ordinal="0" memberName="ORACLE_SID_redo1_1.rdo" filepath="/appli/oracle/ORACLE_SID/oraredolog01/"/> <member ordinal="1" memberName="ORACLE_SID_redo1_2.rdo" filepath="/appli/oracle/ORACLE_SID/oraredolog02/"/> </RedoLogGroupAttributes>
ALTER DATABASE ADD STANDBY LOGFILE GROUP 11 ('/appli/oracle/ORACLE_SID/oraredolog01/ORACLE_SID_stdbyredo11_1.rdo','/appli/oracle/ORACLE_SID/oraredolog02/ORACLE_SID_stdbyredo11_2.rdo') SIZE 150M; ALTER DATABASE ADD STANDBY LOGFILE GROUP 12 ('/appli/oracle/ORACLE_SID/oraredolog01/ORACLE_SID_stdbyredo12_1.rdo','/appli/oracle/ORACLE_SID/oraredolog02/ORACLE_SID_stdbyredo12_2.rdo') SIZE 150M; ALTER DATABASE ADD STANDBY LOGFILE GROUP 13 ('/appli/oracle/ORACLE_SID/oraredolog01/ORACLE_SID_stdbyredo13_1.rdo','/appli/oracle/ORACLE_SID/oraredolog02/ORACLE_SID_stdbyredo13_2.rdo') SIZE 150M;
Database altered.
All these steps must be executed as oracle :
FCM interne. 2016/01/06-16:17:16 |pcyyycvv|SavOra5.6b |SavDebut |0|_INFO_ ||0|||Base ORACLE_SID: sauvegarde RMAN (level 0-), dir=/sauvebase/ORACLE_SID, parall=2, retention=3, StartStop/Compress=Y, dir2=0, IncrementalOnly= 2016/01/06-16:17:16 |pcyyycvv|SavOra5.6b |DelFlagErr |0|_WARNING_||102|||Base ORACLE_SID: Suppression de fanion(s) en erreur: FANION_DIR=/nsr/fanion ID_APPLI= 2016/01/06-16:18:11 |pcyyycvv|SavOra5.6b |SetFlagErr |0|_WARNING_||103|||Base ORACLE_SID: Pose de fanion en erreur: FANION_DIR=/nsr/fanion ID_APPLI= 2016/01/06-16:18:11 |pcyyycvv|SavOra5.6b |FinOk |0|_INFO_ ||0|||Base ORACLE_SID: sauvegarde Ok.
backupFile='backupPrimary_2016-01-12_11-37-45.tgz'; cd "/sauvebase/$ORACLE_SID" && tar zxf "$backupFile" && rm "$backupFile"
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-JAN-2016 16:14:56 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=standbyServer)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias listener_ORACLE_SID Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 12-JAN-2016 16:08:05 Uptime 0 days 0 hr. 6 min. 50 sec Trace Level off Security ON: Local OS Authentication SNMP ON Listener Parameter File /home/oracle/network/admin/listener.ora Listener Log File /logiciels/oracle/diag/tnslsnr/standbyServerShortname/listener_oracle_sid/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=standbyServer)(PORT=1521))) Services Summary... Service "ORACLE_SIDXDB" has 1 instance(s). Instance "ORACLE_SID", status READY, has 1 handler(s) for this service... Service "ORACLE_SID_STANDBYDATACENTER_DGMGRL" has 1 instance(s). Instance "ORACLE_SID", status UNKNOWN, has 1 handler(s) for this service... Service "oracle_sid_standbyDatacenter" has 1 instance(s). Instance "ORACLE_SID", status READY, has 1 handler(s) for this service... The command completed successfully
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-JAN-2016 16:04:16
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=standbyServer)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Start it with : lsnrctl start "listener_$ORACLE_SID"
SID_LIST
) in listener.ora file, rather than dynamically with service registration. There's nothing to worry about here. (source)*.audit_file_dest='/logiciels/oracle/diag/rdbms/oracle_sid_standbyDatacenter/ORACLE_SID/adump'
*.db_unique_name='ORACLE_SID_STANDBYDATACENTER'
*.fal_client='ORACLE_SID_STANDBYDATACENTER'
*.fal_server='ORACLE_SID_PRIMARYDATACENTER'
*.local_listener='ORACLE_SID_STANDBYDATACENTER'
*.log_archive_dest_2='SERVICE=ORACLE_SID_PRIMARYDATACENTER LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) delay=0 DB_UNIQUE_NAME=ORACLE_SID_PRIMARYDATACENTER' <== this is a continued line, don't edit the *.db_unique_name=
line !
Database closed. Database dismounted. ORACLE instance shut down.
ORACLE instance started. Total System Global Area 8551575552 bytes Fixed Size 2270360 bytes Variable Size 5200939880 bytes Database Buffers 3338665984 bytes Redo Buffers 9699328 bytesThis command may fail (because of an already existing spfile with parameters that don't fit) and complain :
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name 'LISTENER_ORACLE_SID'
In such case :
File created.
ORA-01507: database not mounted ORACLE instance shut down.
sqlplus -s / as sysdba <<EOC shutdown immediate startup nomount create spfile='/home/oracle/admin/@/dbs/spfile@.ora' from pfile='/home/oracle/admin/@/dbs/init@.ora'; shutdown immediate !ln -sf "/home/oracle/admin/$ORACLE_SID/dbs/spfile$ORACLE_SID.ora" "$ORACLE_HOME/dbs/spfile$ORACLE_SID.ora" EOC
ORA-01109: database not open Database dismounted. ORACLE instance shut down. ORACLE instance started. Total System Global Area 2137886720 bytes Fixed Size 2254952 bytes Variable Size 1258293144 bytes Database Buffers 872415232 bytes Redo Buffers 4923392 bytes File created. ORA-01507: database not mounted ORACLE instance shut down.
connected to target database (not started)
Oracle instance started Total System Global Area 8551575552 bytes Fixed Size 2270360 bytes Variable Size 5234494312 bytes Database Buffers 3305111552 bytes Redo Buffers 9699328 bytesIf this fails with ORA-00119 + ORA-00132 errors, read this.
Starting restore at 13-JAN-16 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1145 device type=DISK channel ORA_DISK_1: copied control file copy output file name=/appli/oracle/ORACLE_SID/oractl01/ORACLE_SID_ctrl01.ctl output file name=/appli/oracle/ORACLE_SID/oradata01/ORACLE_SID_ctrl02.ctl Finished restore at 13-JAN-16
sql statement: alter database mount standby database released channel: ORA_DISK_1
Starting restore at 13-JAN-16 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1145 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00003 to /appli/oracle/ORACLE_SID/oradata02/ORACLE_SID_undo_01.dbf channel ORA_DISK_1: restoring datafile 00004 to /appli/oracle/ORACLE_SID/oradata04/ORACLE_SID_tools_01.dbf channel ORA_DISK_1: restoring datafile 00007 to /appli/oracle/ORACLE_SID/oradata02/ORACLE_SID_tab_itr1_s_02.dbf channel ORA_DISK_1: restoring datafile 00009 to /appli/oracle/ORACLE_SID/oradata01/ORACLE_SID_idx_itr1_s_02.dbf channel ORA_DISK_1: restoring datafile 00010 to /appli/oracle/ORACLE_SID/oradata02/ORACLE_SID_jms_itr1_s_01.dbf channel ORA_DISK_1: reading from backup piece /sauvebase/ORACLE_SID/db_0__20160106_161716_ORACLE_SID_s2_p1 channel ORA_DISK_1: piece handle=/sauvebase/ORACLE_SID/db_0__20160106_161716_ORACLE_SID_s2_p1 tag=DB_0_ channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to /appli/oracle/ORACLE_SID/oradata01/ORACLE_SID_system_01.dbf channel ORA_DISK_1: restoring datafile 00002 to /appli/oracle/ORACLE_SID/oradata01/ORACLE_SID_sysaux_01.dbf channel ORA_DISK_1: restoring datafile 00005 to /appli/oracle/ORACLE_SID/oradata03/ORACLE_SID_users_01.dbf channel ORA_DISK_1: restoring datafile 00006 to /appli/oracle/ORACLE_SID/oradata02/ORACLE_SID_tab_itr1_s_01.dbf channel ORA_DISK_1: restoring datafile 00008 to /appli/oracle/ORACLE_SID/oradata01/ORACLE_SID_idx_itr1_s_01.dbf channel ORA_DISK_1: restoring datafile 00011 to /appli/oracle/ORACLE_SID/oradata02/ORACLE_SID_quartz_itr1_s_01.dbf channel ORA_DISK_1: reading from backup piece /sauvebase/ORACLE_SID/db_0__20160106_161716_ORACLE_SID_s1_p1 channel ORA_DISK_1: piece handle=/sauvebase/ORACLE_SID/db_0__20160106_161716_ORACLE_SID_s1_p1 tag=DB_0_ channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:45 Finished restore at 13-JAN-16This _may_ fail saying :
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of restore command at 07/22/2016 11:07:36 ORA-19870: error while restoring backup piece /sauvebase/$ORACLE_SID/db_0__20160722_104854_${ORACLE_SID}_s11197_p1 ORA-19573: cannot obtain exclusive enqueue for datafile 10"Fixed" it by stopping MRP + retry the restore command.
sql statement: alter database recover managed standby database using current logfile disconnectThis _may_ be grumpy and return instead :
sql statement: alter database recover managed standby database using current logfile disconnect RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of sql command on default channel at 07/21/2016 17:55:30 RMAN-11003: failure during parse/execution of SQL statement: alter database recover managed standby database using current logfile disconnect ORA-01153: an incompatible media recovery is activeThis is because this statement asks MRP to start whereas it is already running (check it : ps -ef | grep -E "[m]rp.*$ORACLE_SID"). In such case (source) :
sql statement: alter database recover managed standby database cancel
Recovery Manager complete.
Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = fqdnOfServerBeingTnsping'd)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = ORACLE_SID))) OK (0 msec)
Enter password: sys password
Connected.
Enter password: enter the same password
Connected.
Failing this test means something went wrong when copying orapwORACLE_SID from primaryServer to standbyServer. You MUST fix this before continuing. To quickly check it, run on both servers as oracle :
System altered.
THREAD# SEQUENCE# ARCHIVED APPLIED ---------- ---------- --------- --------------------------- 1 17 YES NO
System altered.
THREAD# SEQUENCE# ARCHIVED APPLIED ---------- ---------- --------- --------------------------- 1 20 YES NO
sqlplus -s / as sysdba <<EOSQL alter system set log_archive_dest_state_2=enable scope=both; select thread#, sequence#, archived, applied from v\$archived_log where recid in (select max(recid) from v\$archived_log); alter system switch logfile; select thread#, sequence#, archived, applied from v\$archived_log where recid in (select max(recid) from v\$archived_log); EOSQL
System altered. THREAD# SEQUENCE# ARCHIVED APPLIED ---------- ---------- ------------ ------------------------------------ 1 17 YES YES System altered. THREAD# SEQUENCE# ARCHIVED APPLIED ---------- ---------- ------------ ------------------------------------ 1 20 YES YES
System altered.
THREAD# SEQUENCE# ARCHIVED APPLIED ---------- ---------- --------- --------------------------- 1 20 YES YES
This is OK if we get the same number on both servers (here 20).
no rows selected
sqlplus -s / as sysdba <<EOSQL alter system set log_archive_dest_state_2=enable scope=both; select thread#, sequence#, archived, applied from v\$archived_log where recid in (select max(recid) from v\$archived_log); select * from v\$archive_gap; EOSQL
System altered. THREAD# SEQUENCE# ARCHIVED APPLIED ---------- ---------- ------------ ------------------------------------ 1 20 YES YES no rows selected
The Data Guard broker is used to create, manage and monitor a Data Guard configuration (adding a new standby database, configuring the standby control file, ...). It also simplifies switchover and failover operations, and many more things...
As usual, all actions below are run as oracle.
sqlplus '/ as sysdba' << EOSQL alter system set dg_broker_config_file1='$ORACLE_HOME/dbs/dr1${ORACLE_SID}_PRIMARYDATACENTER.dat' scope=both; alter system set dg_broker_config_file2='$ORACLE_HOME/dbs/dr2${ORACLE_SID}_STANDBYDATACENTER.dat' scope=both; alter system set dg_broker_start=true scope=both; EOSQLThis should output :
SQL> System altered. SQL> System altered. SQL> System altered.
Don't forget to do this on both servers !
Connected.
Configuration "ORACLE_SIDDR" created with primary database "ORACLE_SID_PRIMARYDATACENTER"
Database "ORACLE_SID_STANDBYDATACENTER" added
Enabled.
Property "staticconnectidentifier" updated
Property "staticconnectidentifier" updated
Configuration - ORACLE_SIDDR Protection Mode: MaxPerformance Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - Physical standby database Properties: FastStartFailoverThreshold = '30' OperationTimeout = '30' FastStartFailoverLagLimit = '30' CommunicationTimeout = '180' ObserverReconnect = '0' FastStartFailoverAutoReinstate = 'TRUE' FastStartFailoverPmyShutdown = 'TRUE' BystandersFollowRoleChange = 'ALL' ObserverOverride = 'FALSE' ExternalDestination1 = '' ExternalDestination2 = '' PrimaryLostWriteAction = 'CONTINUE' Fast-Start Failover: DISABLED Configuration Status: SUCCESS
dgmgrl / << EOC create configuration '${ORACLE_SID}DR' as primary database is '${ORACLE_SID}_PRIMARYDATACENTER' connect identifier is '${ORACLE_SID}_PRIMARYDATACENTER'; add database '${ORACLE_SID}_STANDBYDATACENTER' as connect identifier is '${ORACLE_SID}_STANDBYDATACENTER'; enable configuration; edit database '${ORACLE_SID}_PRIMARYDATACENTER' set property StaticConnectIdentifier='${ORACLE_SID}_PRIMARYDATACENTER'; edit database '${ORACLE_SID}_STANDBYDATACENTER' set property StaticConnectIdentifier='${ORACLE_SID}_STANDBYDATACENTER'; show configuration verbose; EOC
Welcome to DGMGRL, type "help" for information. Connected. DGMGRL> Configuration "ORACLE_SIDDR" created with primary database "ORACLE_SID_PRIMARYDATACENTER" DGMGRL> Database "ORACLE_SID_STANDBYDATACENTER" added DGMGRL> Enabled. DGMGRL> Property "staticconnectidentifier" updated DGMGRL> Property "staticconnectidentifier" updated DGMGRL> Configuration - ORACLE_SIDDR Protection Mode: MaxPerformance Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - Physical standby database Properties: FastStartFailoverThreshold = '30' OperationTimeout = '30' FastStartFailoverLagLimit = '30' CommunicationTimeout = '180' ObserverReconnect = '0' FastStartFailoverAutoReinstate = 'TRUE' FastStartFailoverPmyShutdown = 'TRUE' BystandersFollowRoleChange = 'ALL' ObserverOverride = 'FALSE' ExternalDestination1 = '' ExternalDestination2 = '' PrimaryLostWriteAction = 'CONTINUE' Fast-Start Failover: DISABLED Configuration Status: SUCCESS
The show configuration verbose could also return :
Configuration - ORACLE_SIDDR Protection Mode: MaxPerformance Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - Physical standby database Warning: ORA-16857: standby disconnected from redo source for longer than specified threshold Properties: FastStartFailoverThreshold = '30' OperationTimeout = '30' FastStartFailoverLagLimit = '30' CommunicationTimeout = '180' ObserverReconnect = '0' FastStartFailoverAutoReinstate = 'TRUE' FastStartFailoverPmyShutdown = 'TRUE' BystandersFollowRoleChange = 'ALL' ObserverOverride = 'FALSE' ExternalDestination1 = '' ExternalDestination2 = '' PrimaryLostWriteAction = 'CONTINUE' Fast-Start Failover: DISABLED Configuration Status: WARNINGThe ORA-16857 error shown here is generally due to network latency and may not occur trying the same command again (details).
Disabled.
sqlplus '/ as sysdba' << EOSQL alter system set dg_broker_start=false; set linesize 2000 show parameter broker EOSQL
System altered. NAME TYPE VALUE ------------------------- ---------- ------------------------------------------------------------------------------ dg_broker_config_file1 string /logiciels/oracle/oradb/11.2.0/ora/dbs/dr1ORACLE_SID_PRIMARYDATACENTER.dat dg_broker_config_file2 string /logiciels/oracle/oradb/11.2.0/ora/dbs/dr2ORACLE_SID_STANDBYDATACENTER.dat dg_broker_start boolean FALSE
sqlplus '/ as sysdba' << EOSQL alter system set dg_broker_start=true; set linesize 2000 show parameter broker EOSQL
System altered. NAME TYPE VALUE ------------------------- ---------- ------------------------------------------------------------------------------ dg_broker_config_file1 string /logiciels/oracle/oradb/11.2.0/ora/dbs/dr1ORACLE_SID_PRIMARYDATACENTER.dat dg_broker_config_file2 string /logiciels/oracle/oradb/11.2.0/ora/dbs/dr2ORACLE_SID_STANDBYDATACENTER.dat dg_broker_start boolean TRUE
Connected.
Enabled.
Configuration - ORACLE_SIDDR Protection Mode: MaxPerformance Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - Physical standby database Properties: FastStartFailoverThreshold = '30' OperationTimeout = '30' FastStartFailoverLagLimit = '30' CommunicationTimeout = '180' ObserverReconnect = '0' FastStartFailoverAutoReinstate = 'TRUE' FastStartFailoverPmyShutdown = 'TRUE' BystandersFollowRoleChange = 'ALL' ObserverOverride = 'FALSE' ExternalDestination1 = '' ExternalDestination2 = '' PrimaryLostWriteAction = 'CONTINUE' Fast-Start Failover: DISABLED Configuration Status: SUCCESS
dgmgrl / << EOC enable configuration; show configuration verbose; EOC
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production Copyright (c) 2000, 2009, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. Connected. DGMGRL> Enabled. DGMGRL> Configuration - ORACLE_SIDDR Protection Mode: MaxPerformance Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - Physical standby database Properties: FastStartFailoverThreshold = '30' OperationTimeout = '30' FastStartFailoverLagLimit = '30' CommunicationTimeout = '180' ObserverReconnect = '0' FastStartFailoverAutoReinstate = 'TRUE' FastStartFailoverPmyShutdown = 'TRUE' BystandersFollowRoleChange = 'ALL' ObserverOverride = 'FALSE' ExternalDestination1 = '' ExternalDestination2 = '' PrimaryLostWriteAction = 'CONTINUE' Fast-Start Failover: DISABLED Configuration Status: SUCCESS
Same remark as earlier regarding the possible Warning: ORA-16857: standby disconnected from redo source for longer than specified threshold error.
Password: sys password
Connected.
Performing switchover NOW, please wait... New primary database "ORACLE_SID_STANDBYDATACENTER" is opening... Operation requires startup of instance "ORACLE_SID" on database "ORACLE_SID_PRIMARYDATACENTER" Starting instance "ORACLE_SID"... ORACLE instance started. Database mounted. Switchover succeeded, new primary is "ORACLE_SID_STANDBYDATACENTER"I have no idea why it says Operation requires startup of instance "ORACLE_SID" on database "ORACLE_SID_PRIMARYDATACENTER", I expected it to be Operation requires startup of instance "ORACLE_SID" on database "ORACLE_SID_STANDBYDATACENTER" ... (bug ?)
Configuration - ORACLE_SIDDR Protection Mode: MaxPerformance Databases: ORACLE_SID_STANDBYDATACENTER - Primary database ORACLE_SID_PRIMARYDATACENTER - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS
oracleSid='ORACLE_SID'; currentStandbyDatacenter='STANDBYDATACENTER'; sysPassword='password'; export ORACLE_SID="$oracleSid"; dgmgrl sys/"$sysPassword"@${oracleSid}_${currentStandbyDatacenter} << EOC switchover to '${oracleSid}_${currentStandbyDatacenter}'; show configuration EOC
Connected. DGMGRL> Performing switchover NOW, please wait... New primary database "ORACLE_SID_STANDBYDATACENTER" is opening... Operation requires startup of instance "ORACLE_SID" on database "ORACLE_SID_PRIMARYDATACENTER" Starting instance "ORACLE_SID"... ORACLE instance started. Database mounted. Switchover succeeded, new primary is "ORACLE_SID_STANDBYDATACENTER" DGMGRL> Configuration - ORACLE_SIDDR Protection Mode: MaxPerformance Databases: ORACLE_SID_STANDBYDATACENTER - Primary database ORACLE_SID_PRIMARYDATACENTER - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS
Now the primary server is the one in standbyDatacenter and vice versa.
Password: sys password
Connected.
Performing switchover NOW, please wait... New primary database "ORACLE_SID_PRIMARYDATACENTER" is opening... Operation requires startup of instance "ORACLE_SID" on database "ORACLE_SID_STANDBYDATACENTER" Starting instance "ORACLE_SID"... ORACLE instance started. Database mounted. Switchover succeeded, new primary is "ORACLE_SID_PRIMARYDATACENTER"Same remark as above about : Operation requires startup of instance "ORACLE_SID" on database ....
Configuration - ORACLE_SIDDR Protection Mode: MaxPerformance Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS
oracleSid='ORACLE_SID'; currentStandbyDatacenter='PRIMARYDATACENTER'; sysPassword='password'; export ORACLE_SID="$oracleSid"; dgmgrl sys/"$sysPassword"@${oracleSid}_${currentStandbyDatacenter} << EOC switchover to '${oracleSid}_${currentStandbyDatacenter}'; show configuration EOCshow command output
Things are back to the initial situation.