Tuesday 17 August 2021

DATAGUARD - Error: ORA-16698: member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set Failed.

 Scenario Preview: Getting  oracle error ORA-16698 dduring creation of dataguard in 19c release.  

Physical standby already created and in sync.  steps to create datagauard on 19c and troubleshooting error as well. 

Error: ORA-16698: member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set Failed.


[oracle@srv6 dgbroker]$ sqlplus / as sysdba


SQL*Plus: Release 19.0.0.0.0 - Production on Tue Aug 17 20:10:53 2021

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


SQL> ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='/u01/dgbroker/pr1ORADB.dat';


System altered.


SQL> ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='/u01/dgbroker/pr2ORADB.dat';


System altered.


SQL> SHOW PARAMETER DG_BROKER_START


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

dg_broker_start                      boolean     FALSE

SQL>  ALTER SYSTEM SET DG_BROKER_START=TRUE SCOPE=BOTH;


System altered.


SQL> alter system set LOG_ARCHIVE_DEST_2='' SCOPE=BOTH sid='*';


System altered.


SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

[oracle@srv6 dgbroker]$ dgmgrl sys/system123@TEST19C

DGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Aug 17 20:13:48 2021

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 "TEST19C"

Connected as SYSDBA.

DGMGRL> show configuration;

ORA-16532: Oracle Data Guard broker configuration does not exist


Configuration details cannot be determined by DGMGRL

DGMGRL> CREATE CONFIGURATION TEST19C AS PRIMARY DATABASE IS TEST19C CONNECT IDENTIFIER IS TEST19C;

Configuration "test19c" created with primary database "test19c"

DGMGRL> show configuration;


Configuration - test19c


  Protection Mode: MaxPerformance

  Members:

  test19c - Primary database


Fast-Start Failover:  Disabled


Configuration Status:

DISABLED


DGMGRL> ADD DATABASE TESTDR AS CONNECT IDENTIFIER IS TESTDR;

Error: ORA-16698: member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set


Failed.


  • Primary database LOG_ARCHIVE_DEST_2 attribute aleady clear but as we noticed standby attribute was not cleared so we set parameterd to emplty in physical standby database. 

SQL> alter system set LOG_ARCHIVE_DEST_2='' SCOPE=BOTH sid='*';


System altered.


SQL>



DGMGRL> ADD DATABASE TESTDR AS CONNECT IDENTIFIER IS TESTDR;

Database "testdr" added


DGMGRL> show configuration;


Configuration - test19c

  Protection Mode: MaxPerformance
  Members:
  test19c - Primary database
    testdr  - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
DISABLED

DGMGRL>

DGMGRL> ENABLE CONFIGURATION;
Enabled.
DGMGRL> SHOW CONFIGURATION;

Configuration - test19c

  Protection Mode: MaxPerformance
  Members:
  test19c - Primary database
    testdr  - Physical standby database
      Warning: ORA-16853: apply lag has exceeded specified threshold

Fast-Start Failover:  Disabled

Configuration Status:
WARNING   (status updated 2 seconds ago)

DGMGRL>

DGMGRL> EDIT DATABASE TESTDR SET STATE=APPLY-ON;
Succeeded.



DGMGRL> SHOW CONFIGURATION;

Configuration - test19c

  Protection Mode: MaxPerformance
  Members:
  test19c - Primary database
    testdr  - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 44 seconds ago)

DGMGRL>

Friday 13 August 2021

Dataguard- EDIT DATABASE zabbixdr SET STATE=APPLY-ON;

 Simple blog to enable MRP0 process using DGMGRL prompt

  • Dataguard- EDIT DATABASE zabbixdr SET STATE=APPLY-ON;


DGMGRL> show configuration

Configuration - zabbix

  Protection Mode: MaxPerformance

  Members:

  zabbix   - Primary database

    zabbixdr - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS   (status updated 30 seconds ago)

DGMGRL>  EDIT DATABASE zabbixdr SET STATE=APPLY-ON;

Succeeded.

DGMGRL> show configuration


Configuration - zabbix


  Protection Mode: MaxPerformance

  Members:

  zabbix   - Primary database

    zabbixdr - Physical standby database


Fast-Start Failover: DISABLED


Configuration Status:

SUCCESS   (status updated 9 seconds ago)

DGMGRL> show database zabbixdr

Database - zabbixdr

  Role:               PHYSICAL STANDBY

  Intended State:     APPLY-ON

  Transport Lag:      0 seconds (computed 1 second ago)

  Apply Lag:          0 seconds (computed 1 second ago)

  Average Apply Rate: 5.00 KByte/s

  Real Time Query:    OFF

  Instance(s):

    ZABBIXDR


Database Status:

SUCCESS

  • Command to check the DR database status 

set lines 200

col MESSAGE for a60

 

SELECT FACILITY, ERROR_CODE, TIMESTAMP, MESSAGE FROM V$DATAGUARD_STATUS WHERE TRUNC(TIMESTAMP)= TRUNC(SYSTIMESTAMP) ORDER BY TIMESTAMP;


FACILITY                 ERROR_CODE TIMESTAMP MESSAGE

------------------------ ---------- --------- ------------------------------------------------------------

Log Transport Services            0 19-JUL-21 ARC0: Archival started

Log Transport Services            0 19-JUL-21 ARC1: Archival started

Log Transport Services            0 19-JUL-21 ARC2: Archival started

Log Transport Services            0 19-JUL-21 ARC1: Becoming the 'no FAL' ARCH

Log Transport Services        12541 19-JUL-21 FAL[client, ARC0]: Error 12541 connecting to zabbix for fetc

                                              hing gap sequence


Log Transport Services            0 19-JUL-21 ARC2: Becoming the active heartbeat ARCH

Log Transport Services            0 19-JUL-21 ARC3: Archival started

Log Transport Services        12541 19-JUL-21 Error 12541 received logging on to the standby

Log Transport Services        12541 19-JUL-21 Check whether the listener is up and running.


FACILITY                 ERROR_CODE TIMESTAMP MESSAGE

------------------------ ---------- --------- ------------------------------------------------------------

Log Transport Services            0 19-JUL-21 ARC2: Becoming the heartbeat ARCH

Log Apply Services                0 19-JUL-21 Attempt to start background Managed Standby Recovery process

Log Apply Services                0 19-JUL-21 MRP0: Background Managed Standby Recovery process started

Log Apply Services                0 19-JUL-21 Managed Standby Recovery starting Real Time Apply

Remote File Server                0 19-JUL-21 RFS[1]: Assigned to RFS process (PID:5588)

Remote File Server                0 19-JUL-21 Primary database is in MAXIMUM PERFORMANCE mode

Remote File Server                0 19-JUL-21 RFS[3]: Assigned to RFS process (PID:5594)

Remote File Server                0 19-JUL-21 RFS[2]: Assigned to RFS process (PID:5592)

Log Transport Services            0 19-JUL-21 ARC3: Beginning to archive thread 1 sequence 53 (2332140-243

                                              2852)



FACILITY                 ERROR_CODE TIMESTAMP MESSAGE

------------------------ ---------- --------- ------------------------------------------------------------

Log Apply Services                0 19-JUL-21 Media Recovery Waiting for thread 1 sequence 55 (in transit)

Log Apply Services                0 19-JUL-21 Media Recovery Log /u01/app/oracle/fast_recovery_area/ZABBIX

                                              DR/archivelog/2021_07_19/o1_mf_1_54_jhbqjq1l_.arc


Log Transport Services            0 19-JUL-21 ARC3: Completed archiving thread 1 sequence 53 (0-0)

Log Transport Services            0 19-JUL-21 ARC3: Beginning to archive thread 1 sequence 55 (2432983-243

                                              7745)


Log Apply Services                0 19-JUL-21 Media Recovery Waiting for thread 1 sequence 56 (in transit)

Log Transport Services            0 19-JUL-21 ARC3: Completed archiving thread 1 sequence 55 (0-0)


24 rows selected.


SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;


no rows selected


SQL> SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG WHERE RESETLOGS_CHANGE# = (SELECT MAX(RESETLOGS_CHANGE#) FROM V$ARCHIVED_LOG) GROUP BY THREAD#;


MAX(SEQUENCE#)    THREAD#

-------------- ----------

            55          1


SQL> SELECT NAME, VALUE, UNIT, TIME_COMPUTED FROM V$DATAGUARD_STATS WHERE NAME IN ('transport lag','apply lag','apply finish time');


NAME                             VALUE                                                            UNIT                           TIME_COMPUTED

-------------------------------- ---------------------------------------------------------------- ------------------------------ ------------------------------

transport lag                    +00 00:00:00                                                     day(2) to second(0) interval   07/19/2021 17:25:44

apply lag                        +00 00:00:00                                                     day(2) to second(0) interval   07/19/2021 17:25:44

apply finish time                                                                                 day(2) to second(3) interval   07/19/2021 17:25:44


SQL>

  • Some queries to check the primary and physical standby sync status.

SELECT PID, PROCESS, STATUS, CLIENT_PROCESS, CLIENT_PID, THREAD#, SEQUENCE# SEQ#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY ORDER BY PROCESS;

SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference"

FROM

(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,

(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL

WHERE

ARCH.THREAD# = APPL.THREAD#;

  • On Primary:-

select thread#, max(sequence#) "Last Primary Seq Generated"

from v$archived_log

where first_time between (sysdate-1) and (sysdate+1)

group by thread# order by 1;


  • On Standby:-

select thread#, max(sequence#) "Last Standby Seq Received"

from v$archived_log

group by thread# order by 1;


select thread#, max(sequence#) "Last Standby Seq Applied"

from v$archived_log where applied='YES'

group by thread# order by 1;


SELECT THREAD#, SEQUENCE#, APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE# ASC;


select process, thread#, sequence#, status from v$managed_standby where process='MRP0';


DGMGRL : Failover and Reinstate from primary database to standby database using dgmgrl

DGMGRL : Failover and Reinstate from primary database to standby database using dgmgrl prompt 

Primary database : ZABBIX 

hostname: srv3.example.com

version :  12.2.0.1.0


Physical standby database : ZABBIXDR

hostname: srv4.example.com

version :  12.2.0.1.0

  • Enable flashback ON  and create restore point before failover on both primary and standby database 

  
 
[oracle@srv3 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Aug 13 16:40:44 2021

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>  select flashback_on from v$database;

FLASHBACK_ON
------------------
NO

SQL> alter database flashback on;

Database altered.

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

SQL> CREATE RESTORE POINT before_switchover GUARANTEE FLASHBACK DATABASE;

Restore point created.

SQL>
        

  • Similarly Enable flashback ON  and create restore point before failover on standby database 
  • NOTE: stop mrp process on standby before enabling flashback on on DR  


      
    
    SQL> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference"
    FROM
    (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,
    (SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL
    WHERE
    ARCH.THREAD# = APPL.THREAD#
    ;  2    3    4    5    6    7

        Thread Last Sequence Received Last Sequence Applied Difference
    ---------- ---------------------- --------------------- ----------
             1                    348                   348          0

    SQL> select flashback_on from v$database;

    FLASHBACK_ON
    ------------------
    NO

    SQL> alter database flashback on;
    alter database flashback on
    *
    ERROR at line 1:
    ORA-01153: an incompatible media recovery is active


    SQL> alter database recover managed standby database cancel;

    Database altered.

    SQL> alter database flashback on;

    Database altered.

    SQL> alter database recover managed standby database disconnect from session;

    Database altered.

    SQL> select flashback_on from v$database;

    FLASHBACK_ON
    ------------------
    YES

    SQL> CREATE RESTORE POINT before_switchover GUARANTEE FLASHBACK DATABASE;
    CREATE RESTORE POINT before_switchover GUARANTEE FLASHBACK DATABASE
    *
    ERROR at line 1:
    ORA-38784: Cannot create restore point 'BEFORE_SWITCHOVER'.
    ORA-01153: an incompatible media recovery is active


    SQL> alter database recover managed standby database cancel;

    Database altered.

    SQL> CREATE RESTORE POINT before_switchover GUARANTEE FLASHBACK DATABASE;

    Restore point created.

    SQL> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference"
      2  FROM
      3  (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,
    (SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL
      4    5  WHERE
      6  ARCH.THREAD# = APPL.THREAD#
    ;  7

        Thread Last Sequence Received Last Sequence Applied Difference
    ---------- ---------------------- --------------------- ----------
             1                    348                   348          0

    SQL>


    DGMGRL> EDIT DATABASE zabbixdr SET STATE=APPLY-ON;
    Succeeded.
    DGMGRL>

     

  • Shutdown abort Primary database for creating failover scenario.

  • SQL> shut abort; ORACLE instance shut down.


  • Connect to physical standby database using dgmrl and perform the failover.

  •   
    
    [oracle@srv4 ~]$ dgmgrl sys/system123@zabbixdr
    DGMGRL for Linux: Release 12.2.0.1.0 - Production on Fri Aug 13 16:58:28 2021

    Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

    Welcome to DGMGRL, type "help" for information.
    Connected to "ZABBIXDR"
    Connected as SYSDBA.

    DGMGRL> show configuration;

    Configuration - zabbix

      Protection Mode: MaxPerformance
      Members:
      zabbix   - Primary database
        Error: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

        zabbixdr - Physical standby database

    Fast-Start Failover: DISABLED

    Configuration Status:
    ERROR   (status updated 0 seconds ago)

    DGMGRL> FAILOVER TO zabbixdr;
    Performing failover NOW, please wait...
    Failover succeeded, new primary is "zabbixdr"
    DGMGRL> SHOW CONFIGURATION;

    Configuration - zabbix

      Protection Mode: MaxPerformance
      Members:
      zabbixdr - Primary database
        zabbix   - Physical standby database (disabled)
          ORA-16661: the standby database needs to be reinstated

    Fast-Start Failover: DISABLED

    Configuration Status:
    SUCCESS   (status updated 23 seconds ago)

    DGMGRL> SHOW DATABASE zabbix

    Database - zabbix

      Role:               PHYSICAL STANDBY
      Intended State:     APPLY-ON
      Transport Lag:      (unknown)
      Apply Lag:          (unknown)
      Average Apply Rate: (unknown)
      Real Time Query:    OFF
      Instance(s):
        ZABBIX

    Database Status:
    ORA-16661: the standby database needs to be reinstated

    DGMGRL> SHOW DATABASE zabbixdr

    Database - zabbixdr

      Role:               PRIMARY
      Intended State:     TRANSPORT-ON
      Instance(s):
        ZABBIXDR

    Database Status:
    SUCCESS

    DGMGRL>

  • Start old primary database in mount stage for preparing in reinstate.


  •   
    [oracle@srv3 ~]$ sqlplus / as sysdba

    SQL*Plus: Release 12.2.0.1.0 Production on Fri Aug 13 17:02:43 2021

    Copyright (c) 1982, 2016, Oracle.  All rights reserved.

    Connected to an idle instance.

    SQL> STARTUP MOUNT;
    ORACLE instance started.

    Total System Global Area 3221225472 bytes
    Fixed Size                  8797928 bytes
    Variable Size             855638296 bytes
    Database Buffers         2348810240 bytes
    Redo Buffers                7979008 bytes
    Database mounted.
    SQL>

  • Before reinstate check the current status in dgmrl comand prompt.


  • [oracle@srv4 ~]$ dgmgrl sys/system123@zabbixdr
    DGMGRL for Linux: Release 12.2.0.1.0 - Production on Fri Aug 13 16:58:28 2021
    
    Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
    
    Welcome to DGMGRL, type "help" for information.
    Connected to "ZABBIXDR"
    Connected as SYSDBA.
    
    DGMGRL> show configuration;
    
    Configuration - zabbix
    
      Protection Mode: MaxPerformance
      Members:
      zabbix   - Primary database
        Error: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    
        zabbixdr - Physical standby database
    
    Fast-Start Failover: DISABLED
    
    Configuration Status:
    ERROR   (status updated 0 seconds ago)
    
    DGMGRL> FAILOVER TO zabbixdr;
    Performing failover NOW, please wait...
    Failover succeeded, new primary is "zabbixdr"
    DGMGRL> SHOW CONFIGURATION;
    
    Configuration - zabbix
    
      Protection Mode: MaxPerformance
      Members:
      zabbixdr - Primary database
        zabbix   - Physical standby database (disabled)
          ORA-16661: the standby database needs to be reinstated
    
    Fast-Start Failover: DISABLED
    
    Configuration Status:
    SUCCESS   (status updated 23 seconds ago)
    
    DGMGRL> SHOW DATABASE zabbix
    
    Database - zabbix
    
      Role:               PHYSICAL STANDBY
      Intended State:     APPLY-ON
      Transport Lag:      (unknown)
      Apply Lag:          (unknown)
      Average Apply Rate: (unknown)
      Real Time Query:    OFF
      Instance(s):
        ZABBIX
    
    Database Status:
    ORA-16661: the standby database needs to be reinstated
    
    DGMGRL> SHOW DATABASE zabbixdr
    
    Database - zabbixdr
    
      Role:               PRIMARY
      Intended State:     TRANSPORT-ON
      Instance(s):
        ZABBIXDR
    
    Database Status:
    SUCCESS
    
    DGMGRL> exit
    [oracle@srv4 ~]$ dgmgrl sys/system123@zabbixdr
    DGMGRL for Linux: Release 12.2.0.1.0 - Production on Fri Aug 13 17:03:34 2021
    
    Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
    
    Welcome to DGMGRL, type "help" for information.
    Connected to "ZABBIXDR"
    Connected as SYSDBA.
    DGMGRL> REINSTATE DATABASE ZABBIX;
    Reinstating database "zabbix", please wait...
    Reinstatement of database "zabbix" succeeded
    DGMGRL>
    
    DGMGRL> SHOW CONFIGURATION;
    
    Configuration - zabbix
    
      Protection Mode: MaxPerformance
      Members:
      zabbixdr - Primary database
        zabbix   - Physical standby database
    
    Fast-Start Failover: DISABLED
    
    Configuration Status:
    SUCCESS   (status updated 50 seconds ago)
    
    DGMGRL> SHOW DATABASE zabbixdr;
    
    Database - zabbixdr
    
      Role:               PRIMARY
      Intended State:     TRANSPORT-ON
      Instance(s):
        ZABBIXDR
    
    Database Status:
    SUCCESS
    
    DGMGRL>  SHOW DATABASE zabbix;
    
    Database - zabbix
    
      Role:               PHYSICAL STANDBY
      Intended State:     APPLY-ON
      Transport Lag:      0 seconds (computed 0 seconds ago)
      Apply Lag:          0 seconds (computed 0 seconds ago)
      Average Apply Rate: 4.00 KByte/s
      Real Time Query:    OFF
      Instance(s):
        ZABBIX
    
    Database Status:
    SUCCESS
    
    DGMGRL>
      
        

    Tuesday 10 August 2021

    DGMGRL - Switchover primary to standby database using dataguard

     Switchover primary to standby database using dataguard

    Primary database : ZABBIX 

    hostname: srv3.example.com

    version :  12.1.0.2.0

    Standby  Database - ZABBIXDR 

    hostname: srv4.example.com

    version :  12.1.0.2.0

    • Connect primary Database  and check both primary and dr configuration status:

     [oracle@srv3 ~]$ dgmgrl sys/system123@zabbix

    DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production


    Copyright (c) 2000, 2013, Oracle. All rights reserved.


    Welcome to DGMGRL, type "help" for information.

    Connected as SYSDBA.

    DGMGRL> show configuration;


    Configuration - zabbix


      Protection Mode: MaxPerformance

      Members:

      zabbix   - Primary database

        zabbixdr - Physical standby database


    Fast-Start Failover: DISABLED


    Configuration Status:

    SUCCESS   (status updated 9 seconds ago)


    DGMGRL> show database zabbix


    Database - zabbix


      Role:               PRIMARY

      Intended State:     TRANSPORT-ON

      Instance(s):

        ZABBIX


    Database Status:

    SUCCESS


    DGMGRL> show database zabbixdr


    Database - zabbixdr


      Role:               PHYSICAL STANDBY

      Intended State:     APPLY-ON

      Transport Lag:      0 seconds (computed 0 seconds ago)

      Apply Lag:          0 seconds (computed 0 seconds ago)

      Average Apply Rate: 2.00 KByte/s

      Real Time Query:    OFF

      Instance(s):

        ZABBIXDR


    Database Status:

    SUCCESS


    DGMGRL>


  • Create restore point before switchover on both primary and standby database. Used in case of failure. 
  • [oracle@srv3 ~]$ sqlplus / as sysdba


    SQL*Plus: Release 12.1.0.2.0 Production on Mon Jul 19 17:30:32 2021


    Copyright (c) 1982, 2014, Oracle.  All rights reserved.


    Connected to:

    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


    SQL> set lines 200

    SQL> select name, instance_name,db_unique_name, open_mode, database_role, flashback_on  current_scn,to_char(standby_became_primary_scn) failover_scn from v$database,v$instance;


    NAME      INSTANCE_NAME    DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    CURRENT_SCN        FAILOVER_SCN

    --------- ---------------- ------------------------------ -------------------- ---------------- ------------------ ----------------------------------------

    ZABBIX    ZABBIX           ZABBIX                         READ WRITE           PRIMARY          NO                 0


    SQL>


    SQL> CREATE RESTORE POINT before_switchover GUARANTEE FLASHBACK DATABASE;


    Restore point created.


    SQL>

  • Create restore point before switchover on  standby database. Used in case of failure. 
  •    

    [oracle@srv4 ~]$ sqlplus / as sysdba


    SQL*Plus: Release 12.1.0.2.0 Production on Mon Jul 19 17:31:49 2021


    Copyright (c) 1982, 2014, Oracle.  All rights reserved.


    Connected to:

    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


    SQL> set lines 200

    SQL> select name, instance_name,db_unique_name, open_mode, database_role, flashback_on  current_scn,to_char(standby_became_primary_scn) failover_scn from v$database,v$instance;


    NAME      INSTANCE_NAME    DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    CURRENT_SCN        FAILOVER_SCN

    --------- ---------------- ------------------------------ -------------------- ---------------- ------------------ ----------------------------------------

    ZABBIX    ZABBIXDR         ZABBIXDR                       MOUNTED              PHYSICAL STANDBY NO                 0


    SQL> CREATE RESTORE POINT before_switchover GUARANTEE FLASHBACK DATABASE;

    CREATE RESTORE POINT before_switchover GUARANTEE FLASHBACK DATABASE

    *

    ERROR at line 1:

    ORA-38784: Cannot create restore point 'BEFORE_SWITCHOVER'.

    ORA-01153: an incompatible media recovery is active

    SQL>

  • NOTE : Disable  redo apply on data guard om dgmrl console . Create restore point on standby and apply on again .
  • DGMGRL> EDIT DATABASE zabbixdr SET STATE=APPLY-OFF;

    Succeeded.

    DGMGRL>


    SQL>  CREATE RESTORE POINT before_switchover GUARANTEE FLASHBACK DATABASE;


    Restore point created.


    SQL>


    DGMGRL> EDIT DATABASE zabbixdr SET STATE=APPLY-ON;

    Succeeded.


    DGMGRL> show database zabbixdr


    Database - zabbixdr


      Role:               PHYSICAL STANDBY

      Intended State:     APPLY-ON

      Transport Lag:      0 seconds (computed 0 seconds ago)

      Apply Lag:          0 seconds (computed 0 seconds ago)

      Average Apply Rate: 2.00 KByte/s

      Real Time Query:    OFF

      Instance(s):

        ZABBIXDR


    Database Status:

    SUCCESS


    DGMGRL>

  • Login primary database and check status before switchover 
  •  

    SQL> SELECT CLIENT_PROCESS,PROCESS,SEQUENCE#,STATUS FROM V$MANAGED_STANDBY;


    CLIENT_P PROCESS    SEQUENCE# STATUS

    -------- --------- ---------- ------------

    ARCH     ARCH              54 OPENING

    ARCH     ARCH               0 CONNECTED

    ARCH     ARCH              53 CLOSING

    ARCH     ARCH              55 CLOSING

    LNS      LNS               56 WRITING


    SQL>

  • Login standby database and check status before switchover 
  •  

    SQL> SELECT STATUS FROM V$MANAGED_STANDBY WHERE PROCESS LIKE 'MRP%';


    STATUS

    ------------

    APPLYING_LOG


    SQL>

  • After checking the status. login to dgmgrl console and perform switchover.
  • DGMGRL> SWITCHOVER TO zabbixdr;

    Performing switchover NOW, please wait...

    New primary database "zabbixdr" is opening...

    Operation requires start up of instance "ZABBIX" on database "zabbix"


    Unable to connect to database using (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=srv3.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ZABBIX_DGMGRL)(INSTANCE_NAME=ZABBIX)(SERVER=DEDICATED)))

    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor


    Failed.

    Warning: You are no longer connected to ORACLE.


    Please complete the following steps to finish switchover:

            start up and mount instance "ZABBIX" of database "zabbix"


    DGMGRL> DGMGRL>

  • Start new DR database srv3 server  in mount stage  
  •  

    SQL> startup mount;

    ORACLE instance started.


    Total System Global Area 1795162112 bytes

    Fixed Size                  2925456 bytes

    Variable Size             620760176 bytes

    Database Buffers         1157627904 bytes

    Redo Buffers               13848576 bytes

    Database mounted.

    SQL> SELECT CLIENT_PROCESS,PROCESS,SEQUENCE#,STATUS FROM V$MANAGED_STANDBY;


    CLIENT_P PROCESS    SEQUENCE# STATUS

    -------- --------- ---------- ------------

    ARCH     ARCH               0 CONNECTED

    ARCH     ARCH              59 CLOSING

    ARCH     ARCH               0 CONNECTED

    ARCH     ARCH               0 CONNECTED

    UNKNOWN  RFS                0 IDLE

    LGWR     RFS               60 IDLE

    UNKNOWN  RFS                0 IDLE

    N/A      MRP0              60 APPLYING_LOG


    8 rows selected.


    SQL>

  • Check the status of new primary database after switchover
  •  

    DGMGRL> show configuration;


    Configuration - zabbix


      Protection Mode: MaxPerformance

      Members:

      zabbixdr - Primary database

        zabbix   - Physical standby database


    Fast-Start Failover: DISABLED


    Configuration Status:

    SUCCESS   (status updated 0 seconds ago)


    DGMGRL> SHOW DATABASE zabbixdr;


    Database - zabbixdr


      Role:               PRIMARY

      Intended State:     TRANSPORT-ON

      Instance(s):

        ZABBIXDR


    Database Status:

    SUCCESS


    DGMGRL> SHOW DATABASE zabbix;


    Database - zabbix


      Role:               PHYSICAL STANDBY

      Intended State:     APPLY-ON

      Transport Lag:      0 seconds (computed 0 seconds ago)

      Apply Lag:          0 seconds (computed 0 seconds ago)

      Average Apply Rate: 107.00 KByte/s

      Real Time Query:    OFF

      Instance(s):

        ZABBIX


    Database Status:

    SUCCESS


    DGMGRL>