show configuration
Configuration - ORACLE_SIDDR Protection Mode: MaxAvailability Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database Warning: ORA-16817: unsynchronized fast-start failover configuration ORACLE_SID_STANDBYDATACENTER - (*) Physical standby database (disabled) Fast-Start Failover: ENABLED Configuration Status: WARNING
export ORACLE_SID=ORACLE_SID; echo 'select status from v$instance;' | sqlplus / as sysdba
STATUS ------------------------------------ OPENopen is BAD for a standby database, it should be mounted.
shutdown
ORA-16175: cannot shut down database when media recovery is active
shutdown immediate
Database closed. Database dismounted. ORACLE instance shut down.
echo 'select status from v$instance;' | sqlplus / as sysdba
STATUS ------------------------------------ MOUNTEDThis is much better
show configuration
Configuration - ORACLE_SIDDR Protection Mode: MaxAvailability Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database Warning: ORA-16817: unsynchronized fast-start failover configuration ORACLE_SID_STANDBYDATACENTER - (*) Physical standby database Warning: ORA-16817: unsynchronized fast-start failover configuration Fast-Start Failover: ENABLED Configuration Status: WARNINGLooks like a double ORA-16817 error while FSFO is enabled means an automatic re-synchronization is on going.
show configuration
Configuration - ORACLE_SIDDR Protection Mode: MaxAvailability Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - (*) Physical standby database Fast-Start Failover: ENABLED Configuration Status: SUCCESS
this is a DRAFT !
1. Arrêt de la primaire 2. Arrêt de la standby 3. re créer le mdp 4. copier le mdp vers standby 5. démarrer la primaire 6. démarrer la standby 7. re créer le wallet 1. désactiver FSFO 2. changer le mdp sys sur le primaire 3. redémarrer primaire pour prise en compte nouveau mdp 4. copier le fichier orapw vers le standby 5. redémarrer standby pour prise en compte nouveau mdp 6. créer nouveau wallet 7. mettre à jour le wallet côté observer 8. réactiver FSFO
FSFO is designed so that it automatically "fails over" from the primary to the standby server should the primary server become unavailable for any reason. However, if we're planning maintenance or any action on our Oracle servers involving the primary server to stop working as expected, FSFO will do its job and engage the failover procedure. This is why FSFO needs to be disabled prior to any maintenance action.
All actions below are executed as oracle on the primary server. There's nothing special to do on the standby server.
Don't forget to : export ORACLE_SID=ORACLE_SID
Connected.
Configuration - ORACLE_SIDDR Protection Mode: MaxAvailability Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - (*) Physical standby database Fast-Start Failover: ENABLED Configuration Status: SUCCESS
Disabled.
Configuration - ORACLE_SIDDR Protection Mode: MaxAvailability Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS
dgmgrl / << EOC show configuration; disable fast_start failover; show configuration; EOC
Connected. DGMGRL> Configuration - ORACLE_SIDDR Protection Mode: MaxAvailability Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - (*) Physical standby database Fast-Start Failover: ENABLED Configuration Status: SUCCESS DGMGRL> Disabled. DGMGRL> Configuration - ORACLE_SIDDR Protection Mode: MaxAvailability Databases: ORACLE_SID_PRIMARYDATACENTER - Primary database ORACLE_SID_STANDBYDATACENTER - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS
When the maintenance is over, don't forget to re-enable FSFO.
tnsping standbyServiceName
should return :TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 19-NOV-2014 17:20:00 Copyright (c) 1997, 2011, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = standby.example.com)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = serviceName))) OK (0 msec)Like for any network problem, if tnsping can't reach the standby, no need to search further for the moment.
NAME TYPE VALUE ------------------ ---------- -------- dg_broker_start boolean TRUE
column name format a25;
column value format a10;
SELECT name, type, value FROM v$parameter WHERE name=LOWER('log_archive_dest_state_2');
will return :NAME TYPE VALUE
--------------------------- ------- -------------
log_archive_dest_state_2 2 resultValue
With resultValue being :
System modified.Checking the status should say enable.
System modified.Checking the status should say defer.
When configuring / altering Data Guard, the settings may be correct while the checks described below fail. It takes a few minutes for these settings to be applied.
All commands below are run as oracle and after doing : export ORACLE_SID=ORACLE_SID
no rows selectedOtherwise, databases are NOT in sync, no matter what commands below return (including matching sequence numbers).
THREAD# SEQUENCE# ARCHIVED APPLIED
---------- ---------- --------- ---------------------------
1 41 YES NO
The values of SEQUENCE# must match between servers.
System altered.
THREAD# SEQUENCE# ARCHIVED APPLIED
---------- ---------- --------- ---------------------------
1 42 YES NO
Sequence numbers are constantly incrementing, so, to get good results, you have to execute both queries below within the same second.
select to_char(CURRENT_SCN) from v$database;
TO_CHAR(CURRENT_SCN)
--------------------------------------------------------------------------------
711171630
select to_char(FIRST_CHANGE#), to_char(LAST_CHANGE#), FIRST_TIME, LAST_TIME from V$STANDBY_LOG where status='ACTIVE';
TO_CHAR(FIRST_CHANGE#) TO_CHAR(LAST_CHANGE#) FIRST_TIME LAST_TIME ------------------------- ------------------------ ------------- ------------ 711170565 711171630 04-JUL-16 04-JUL-16
We get identical sequence numbers, showing that the MRP0 process is running fine.
All commands below are executed as Oracle in SQL*Plus : export ORACLE_SID=ORACLE_SID; sqlplus / as sysdba
SELECT RESETLOGS_CHANGE# FROM V$DATABASE_INCARNATION WHERE STATUS = 'CURRENT';
RESETLOGS_CHANGE#
-----------------
697696214
SELECT GROUP#, THREAD#, SEQUENCE# FROM V$STANDBY_LOG WHERE STATUS = 'ACTIVE' ORDER BY THREAD#, SEQUENCE#;
SELECT THREAD#, MAX(SEQUENCE#) FROM V$LOG_HISTORY WHERE RESETLOGS_CHANGE# = 697696214 GROUP BY THREAD#;
GROUP# THREAD# SEQUENCE# ---------- ---------- ---------- 7 1 1416 THREAD# MAX(SEQUENCE#) ---------- -------------- 1 1415(When DB sync is defer (i.e. disabled), status is UNASSIGNED.)
The value of MAX(SEQUENCE#)
should be close (difference < 3) to the value of SEQUENCE#.
SELECT THREAD#, MAX(SEQUENCE#) FROM V$LOG_HISTORY WHERE RESETLOGS_CHANGE#=(SELECT RESETLOGS_CHANGE# FROM V$DATABASE_INCARNATION WHERE STATUS = 'CURRENT') GROUP BY THREAD#;
THREAD# MAX(SEQUENCE#) ---------- -------------- 1 1415
SELECT al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied" from (SELECT thread# thrd, max(sequence#) almax from v$archived_log where resetlogs_change#=(SELECT resetlogs_change# from v$database) group by thread#) al, (SELECT thread# thrd, max(sequence#) lhmax from v$log_history where first_time=(SELECT max(first_time) from v$log_history) group by thread#) lh where al.thrd = lh.thrd;
Thread Last Seq Received Last Seq Applied ---------- ----------------- ---------------- 1 1415 1415==> MATCH !!
export ORACLE_SID=MYORACLESID; sqlplus '/ as sysdba' << EOSQL
SELECT THREAD#, MAX(SEQUENCE#) FROM V\$ARCHIVED_LOG group by thread#;
EOSQL
Which may return :
THREAD# MAX(SEQUENCE#) ---------- -------------- 1 4560
export ORACLE_SID=MYORACLESID; sqlplus '/ as sysdba' << EOSQL
SELECT THREAD#, SEQUENCE#, ARCHIVED, APPLIED
FROM V\$ARCHIVED_LOG
WHERE SEQUENCE# IN (SELECT MAX(SEQUENCE#) FROM V\$ARCHIVED_LOG);
column process format a10;
column status format a15;
SELECT process, status, thread#, sequence#, delay_mins from V\$MANAGED_STANDBY;
EOSQL
Which may return :
SQL> 2 3
THREAD# SEQUENCE# ARCHIVED APPLIED
---------- ---------- --------- ---------------------------
1 173 YES YES
SQL> SQL> SQL>
PROCESS STATUS THREAD# SEQUENCE# DELAY_MINS
---------- --------------- ---------- ---------- ----------
ARCH CLOSING 1 171 0
ARCH CONNECTED 0 0 0
ARCH CLOSING 1 172 0
ARCH CLOSING 1 173 0
MRP0 WAIT_FOR_LOG 1 174 0
RFS IDLE 0 0 0
RFS IDLE 0 0 0
RFS IDLE 0 0 0
RFS IDLE 1 174 0
export ORACLE_SID=MYORACLESID; sqlplus '/ as sysdba' << EOSQL
ALTER SYSTEM SWITCH LOGFILE;
SELECT THREAD#, MAX(SEQUENCE#) FROM V\$ARCHIVED_LOG group by thread#;
EOSQL
Which may return :
SQL> System altered. SQL> THREAD# MAX(SEQUENCE#) ---------- -------------- 1 4560
export ORACLE_SID=MYORACLESID; sqlplus '/ as sysdba' << EOSQL
SELECT THREAD#, SEQUENCE#, ARCHIVED, APPLIED
FROM V\$ARCHIVED_LOG
WHERE SEQUENCE# IN (SELECT MAX(SEQUENCE#) FROM V\$ARCHIVED_LOG);
column process format a10;
column status format a15;
SELECT process,status,thread#,sequence#,delay_mins from V\$MANAGED_STANDBY;
EOSQL
Which may return :
SQL> 2 3
THREAD# SEQUENCE# ARCHIVED APPLIED
---------- ---------- --------- ---------------------------
1 174 YES YES
SQL> SQL> SQL>
PROCESS STATUS THREAD# SEQUENCE# DELAY_MINS
---------- --------------- ---------- ---------- ----------
ARCH CLOSING 1 174 0
ARCH CONNECTED 0 0 0
ARCH CLOSING 1 172 0
ARCH CLOSING 1 173 0
MRP0 WAIT_FOR_LOG 1 175 0
RFS IDLE 0 0 0
RFS IDLE 0 0 0
RFS IDLE 0 0 0
RFS IDLE 1 175 0
This article is still quite experimental and may be wrong/obsolete on several points. Consider it as a draft.
Some procedures described here are based on internal tools/scripts that may not be available.
ALTER USER SYS IDENTIFIED BY "newPassword"; scp /home/oracle/admin/ORACLE_SID/dbs/orapwORACLE_SID bob@standbyServer:/home/bob
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 sqlplus / as sysdba shutdown immediate startup nomount exit
duplicate target database for standby NOFILENAMECHECK dorecover; exit
sqlplus / as sysdba alter database open read only; shutdown immediate; startup nomount; alter database mount standby database; alter database recover managed standby database using current logfile disconnect;