Archives October 2021

ORA-19910: can not change recovery target incarnation in control file

Cause:

I try to reset the incarnation to previous state without knowing that database is in open state. This error is because of consistency mismatch prevention when database is in open mode.

RMAN> reset database to incarnation 1;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of reset database command on default channel at 10/12/2021 22:56:33
ORA-19910: can not change recovery target incarnation in control file

Workaround:

Bounce the database to mount state

kish@PRIM>shu immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
kish@PRIM>startup mount;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 3238002688 bytes
Fixed Size                  2929600 bytes
Variable Size            1946160192 bytes
Database Buffers         1275068416 bytes
Redo Buffers               13844480 bytes
Database mounted.
kish@PRIM>exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

Reset the incarnation

[oracle@dc01x01 ~]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Tue Oct 12 23:02:09 2021

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

connected to target database: DBX00 (DBID=2195240283, not open)

RMAN> reset database to incarnation 1;

using target database control file instead of recovery catalog
database reset to incarnation 1
ORA-16525: The Oracle Data Guard broker is not yet available.

Cause:

If broker is not enabled , then you end up with this error

DGMGRL> disable configuration;
ORA-16525: The Oracle Data Guard broker is not yet available.

Configuration details cannot be determined by DGMGRL

Workaround:

Enable broker

kish@PRIM>alter system set dg_broker_start=true;

System altered.

DGMGRL> disable configuration;
Disabled.

DGMGRL> remove configuration;
Removed configuration

INSTALL SWINGBENCH IN LINUX

Download swingbench from the link

http://www.dominicgiles.com/downloads.html

Copy the file using winscp to linux from windows

Unzip the file

[oracle@dc01x01 ~]$ unzip swingbenchlatest.zip

Locate to the swingbench directory

[oracle@dc01x01 ~]$ cd swingbench/
[oracle@dc01x01 swingbench]$ ls
bin      launcher  log         source  utils   wizardconfigs
configs  lib       README.txt  sql     winbin

Invoke oewizard script from the installation bin directory in swingbench

[oracle@dc01x01 swingbench]$ cd bin/
[oracle@dc01x01 bin]$ ./oewizard

Click on next

Check the recommended version of swingbench

Create the OE schema with its metadata objects

Give the connection details of the database and their credentials

Enter the owner of the tables and indexes to be created on the database

Choose different options you would like to eg : (partition,compression,tablespace size, indexes used) etc

Select the size details of the data objects to be generated

Choose parallel degree

Monitor the logs for the schema and table creation on the database. Wait for data generation to complete

SWITCHOVER USING DGMGRL BROKER IN ORACLE DATAGUARD

Switchover is an activity which acts as a role reversal with guaranteed protection to data.

Here primary database acts as a standby and standby database acts as a primary!!

We can perform switchover in situations like maintenance of primary database like patching,migration of a database from one server to another etc..

Switchover using broker is easy process compared to manual switchover. One command in broker and switchover is completed.

Prechecks:

Check the primary database status and parameters

DGMGRL> show database verbose dbx00

Database - dbx00

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

  Properties:
    DGConnectIdentifier             = 'dbx00'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'ASYNC'
    RedoRoutes                      = ''
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    LogShipping                     = 'ON'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyLagThreshold               = '0'
    TransportLagThreshold           = '0'
    TransportDisconnectedThreshold  = '30'
    ApplyParallel                   = 'AUTO'
    StandbyFileManagement           = 'AUTO'
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '4'
    LogArchiveMinSucceedDest        = '1'
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    FastStartFailoverTarget         = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    SendQEntries                    = '(monitor)'
    LogXptStatus                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.11)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dbx00_DGMGRL)(INSTANCE_NAME=dbx00_1)(SERVER=DEDICATED)))'
    StandbyArchiveLocation          = 'USE_DB_RECOVERY_FILE_DEST'
    AlternateLocation               = ''
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = '%t_%s_%r.dbf'
    TopWaitEvents                   = '(monitor)'

Database Status:
SUCCESS

Check standby database status

DGMGRL> show database dbx01

Database - dbx01

  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: 11.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    dbx01

Database Status:
SUCCESS

Validate the database for switchover readiness of primary and standby database. Thanks to 12c feature. Below error on standby can be safely ignored for standby redologs as it is a reported bug.

DGMGRL> validate database dbx00

  Database Role:    Primary database

  Ready for Switchover:  Yes

  Flashback Database Status:
    dbx00:  Off

DGMGRL> validate database dbx01

  Database Role:     Physical standby database
  Primary Database:  dbx00

  Ready for Switchover:  Yes
  Ready for Failover:    Yes (Primary Running)

  Flashback Database Status:
    dbx00:  Off
    dbx01:  On

  Current Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (dbx00)                 (dbx01)
    1         8                       3                       Insufficient SRLs

  Future Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (dbx01)                 (dbx00)
    1         8                       0                       Insufficient SRLs
    Warning: standby redo logs not configured for thread 1 on dbx00

Check the configuration at last

DGMGRL> show configuration

Configuration - dgb

  Protection Mode: MaxPerformance
  Members:
  dbx00 - Primary database
    dbx01 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 29 seconds ago)

While switchover:

Issue the below command for a hassle free switchover

DGMGRL> switchover to dbx01
Performing switchover NOW, please wait...
Operation requires a connection to instance "dbx01" on database "dbx01"
Connecting to instance "dbx01"...
Connected as SYSDBA.
New primary database "dbx01" is opening...
Oracle Clusterware is restarting database "dbx00" ...
Switchover succeeded, new primary is "dbx01"
DGMGRL> show configuration

Configuration - dgb

  Protection Mode: MaxPerformance
  Members:
  dbx01 - Primary database
    dbx00 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 111 seconds ago)

To switch back to old primary database, issue switchover command to primary database

DGMGRL> switchover to dbx00
Performing switchover NOW, please wait...
Operation requires a connection to instance "dbx00_1" on database "dbx00"
Connecting to instance "dbx00_1"...
Connected as SYSDBA.
New primary database "dbx00" is opening...
Operation requires start up of instance "dbx01" on database "dbx01"
Starting instance "dbx01"...
Unable to connect to database using (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.197)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dbx01_DGMGRL)(INSTANCE_NAME=dbx01)(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 "dbx01" of database "dbx01"

For completeness of switchback, start the standby database in mount state and enable MRP if not enabled

kish@STDBY>startup mount;
ORACLE instance started.

Total System Global Area 1509949440 bytes
Fixed Size                  2924640 bytes
Variable Size             989859744 bytes
Database Buffers          503316480 bytes
Redo Buffers               13848576 bytes
Database mounted.
kish@STDBY>alter database recover managed standby database using current logfile disconnect from session;
alter database recover managed standby database using current logfile disconnect from session
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active

Check the synchronization between primary and standby

kish@STDBY>select process,status,sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CLOSING             108
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
RFS       IDLE                  0
RFS       IDLE                109
RFS       IDLE                  0
RFS       IDLE                  0
MRP0      APPLYING_LOG        109

9 rows selected.
Warning: standby redo logs not configured for thread 1 on dbx00

Cause:

While validation of standby database during switchover, below message is displayed.

DGMGRL> validate database dbx01

  Database Role:     Physical standby database
  Primary Database:  dbx00

  Ready for Switchover:  Yes
  Ready for Failover:    Yes (Primary Running)

  Flashback Database Status:
    dbx00:  Off
    dbx01:  On

  Current Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (dbx00)                 (dbx01)
    1         8                       3                       Insufficient SRLs

  Future Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (dbx01)                 (dbx00)
    1         8                       0                       Insufficient SRLs
    Warning: standby redo logs not configured for thread 1 on dbx00

Workaround:

Error can be ignored. Check oracle MOS for more details on the potential bug.

Doc ID 20582405.8

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

Cause:

I thought dgmgrl is already configured for dataguard. But actually it is not which cause the error

[oracle@dc01x01 ~]$ dgmgrl
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.
DGMGRL> connect sys/password
Connected as SYSDG.
DGMGRL> show configuration
ORA-16532: Oracle Data Guard broker configuration does not exist

Workaround:

Check if the below parameters are enabled

kish@PRIM>show parameter dg_broker

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1               string      /u01/oracle/product/12.1.0/db/
                                                 dbs/dr1dbx00.dat
dg_broker_config_file2               string      /u01/oracle/product/12.1.0/db/
                                                 dbs/dr2dbx00.dat
dg_broker_start                      boolean     TRUE

Create a configuration for primary database and add the database to it.

DGMGRL> create configuration dgb AS primary database IS dbx00 CONNECT IDENTIFIER IS dbx00;
Configuration "dgb" created with primary database "dbx00"
DGMGRL> add database dbx01 AS CONNECT IDENTIFIER IS dbx01 MAINTAINED AS PHYSICAL;
Database "dbx01" added

Enable and verify the configuration

DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration

Configuration - dgb

  Protection Mode: MaxPerformance
  Members:
  dbx00 - Primary database
    dbx01 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 8 seconds ago)

DGMGRL> show database dbx01

Database - dbx01

  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: 15.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    dbx01

Database Status:
SUCCESS
ORA-16839: one or more user data files are missing

Cause:

I have two node RAC with standby database configured. After configuration of dg broker in physical standby database, i get datafiles consistency error due to unknown reasons

DGMGRL> show database dbx01

Database - dbx01

  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: 18.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    dbx01

  Database Error(s):
    ORA-16839: one or more user data files are missing

Database Status:
ERROR

I checked for failures from RMAN for datafile issues and found one

RMAN> advise failure all;

using target database control file instead of recovery catalog
Database Role: PHYSICAL STANDBY

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
1258       HIGH     OPEN      21-SEP-21     Datafiles are mutually inconsistent

Mandatory Manual Actions
========================
1. Ensure the primary database is up and recover database using ALTER DATABASE RECOVER MANAGED STANDBY DATABASE UNTIL CONSISTENT command.  Check alert log for potential failures that may cause recovery not to run.  Potential problems may include missing archived logs or datafiles being in an orphaned incarnation.
2. Contact Oracle Support Services if the preceding recommendations cannot be used, or if they do not fix the failures selected for repair

Optional Manual Actions
=======================
no manual actions available

Automated Repair Options
========================
no automatic repair options available

As per the advisory , i manually followed the steps mentioned under Mandatory Manual Actions

I cancelled MRP and ran the MRP with ‘until consistent’ clause to recover the logs

kish@STDBY>alter database recover managed standby database cancel;

Database altered.

kish@STDBY>alter database recover managed standby database until consistent;

Database altered.

Enable MRP again

kish@STDBY>alter database recover managed standby database using current logfile disconnect from session;

Database altered.

Now failure is not reflecting after the recommendation action

RMAN> advise failure all;

using target database control file instead of recovery catalog
Database Role: PHYSICAL STANDBY

no failures found that match specification

Workaround:

Still after fixing the failure, i face the same error. As per Doc ID 21495155.8 , the error is a reported bug Bug 21495155 in RAC

I straced dgmgrl utility and couldnot find any cause

read(7, "\23\0\210\23\0\0z\0\211\23\0\0\217\0\212\23\0\0\224\0\213\23\0\0\244\0\214\23\0\0\275\0"..., 512) = 512
close(7)                                = 0
write(1, "Database Error(s):\n", 19Database Error(s):
)    = 19
open("/u01/oracle/product/12.1.0/db/rdbms/mesg/oraus.msb", O_RDONLY) = 7
fcntl(7, F_SETFD, FD_CLOEXEC)           = 0
lseek(7, 0, SEEK_SET)                   = 0
read(7, "\25\23\"\1\23\3\t\t\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 256) = 256
lseek(7, 512, SEEK_SET)                 = 512
read(7, "\3\31\0243-A\311a\232u\250\204\254\217\247\256\16\331\377\377\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(7, 1024, SEEK_SET)                = 1024
read(7, "\30\0$\0.\09\0B\0N\0Y\0d\0l\0v\0\203\0\231\0\244\0\316\0\327\0\336\0"..., 512) = 512
lseek(7, 1536, SEEK_SET)                = 1536
read(7, "\36\31&\31.\31l\31v\31\203\31\217\31\231\31\241\31\253\31\264\31\306\31\320\31\335\0315\32N\32"..., 512) = 512
lseek(7, 2048, SEEK_SET)                = 2048
read(7, ";3G3X3d3\2053\2213\2323\2443\2543\2673\3173\3303\3443\3603\0324#4"..., 512) = 512
lseek(7, 2560, SEEK_SET)                = 2560
read(7, "4A<AEAMAUA]AdAkAuA\201A\212A\222A\233A\243A\254A\264A"..., 512) = 512
lseek(7, 3072, SEEK_SET)                = 3072
read(7, "\21b\31b\"b*b3b<bEbWb`bfbnbvb}b\204b\213b\224b"..., 512) = 512
lseek(7, 3584, SEEK_SET)                = 3584
read(7, "\245u\266u\315u\341u\353u\372unv\205v\216v\226v\237v\250v\261v\271v\336v\347v"..., 512) = 512
lseek(7, 4096, SEEK_SET)                = 4096
read(7, "\260\204\267\204\277\204\312\204\321\204\332\204\343\204\352\204\362\204\372\204\6\205\20\205\36\205(\2054\205@\205"..., 512) = 512
lseek(7, 4608, SEEK_SET)                = 4608
read(7, "\300\217\312\217\321\217\332\217\344\217\352\217\362\217\n\220\24\220&\2201\220<\220V\220\\\220d\220l\220"..., 512) = 512
lseek(7, 5120, SEEK_SET)                = 5120
read(7, "\273\256\305\256\315\256\324\256\353\256\0\257\f\257\30\2579\257A\257F\257N\257Y\257a\257j\257\230\257"..., 512) = 512
lseek(7, 5632, SEEK_SET)                = 5632
read(7, "0\3319\331B\331I\331O\331U\331\\\331c\331\237\331_\332i\332t\332~\332\207\332\270\334\302\334"..., 188) = 188
lseek(7, 408576, SEEK_SET)              = 408576
read(7, "\n\0\303A\0\0D\0\304A\0\0\210\0\305A\0\0\261\0\306A\0\0\332\0\307A\0\0\3\1"..., 512) = 512
close(7)                                = 0
write(1, "    ORA-16839: one or more user "..., 55    ORA-16839: one or more user data files are missing
) = 55
write(1, "\n", 1
)                       = 1
open("/u01/oracle/product/12.1.0/db/rdbms/mesg/dgmus.msb", O_RDONLY) = 7
fcntl(7, F_SETFD, FD_CLOEXEC)           = 0
lseek(7, 0, SEEK_SET)                   = 0
read(7, "\25\23\"\1\23\3\t\t\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 256) = 256
lseek(7, 512, SEEK_SET)                 = 512
read(7, "\211B\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(7, 1024, SEEK_SET)                = 1024
read(7, "\232\23\265\23\316\23\337\23\360\23\0\24\r\24 \24/\24\tB\24B\"B+B8BIBUB"..., 42) = 42
lseek(7, 1536, SEEK_SET)                = 1536
read(7, "\23\0\210\23\0\0z\0\211\23\0\0\217\0\212\23\0\0\224\0\213\23\0\0\244\0\214\23\0\0\275\0"..., 512) = 512
close(7)                                = 0
write(1, "Database Status:\n", 17Database Status:
)      = 17
open("/u01/oracle/product/12.1.0/db/rdbms/mesg/dgmus.msb", O_RDONLY) = 7
fcntl(7, F_SETFD, FD_CLOEXEC)           = 0
lseek(7, 0, SEEK_SET)                   = 0
read(7, "\25\23\"\1\23\3\t\t\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 256) = 256
lseek(7, 512, SEEK_SET)                 = 512
read(7, "\211B\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(7, 1024, SEEK_SET)                = 1024
read(7, "\232\23\265\23\316\23\337\23\360\23\0\24\r\24 \24/\24\tB\24B\"B+B8BIBUB"..., 42) = 42
lseek(7, 1536, SEEK_SET)                = 1536
read(7, "\23\0\210\23\0\0z\0\211\23\0\0\217\0\212\23\0\0\224\0\213\23\0\0\244\0\214\23\0\0\275\0"..., 512) = 512
close(7)                                = 0
write(1, "ERROR\n", 6ERROR
)                  = 6
write(1, "\n", 1
)                       = 1
write(1, "DGMGRL> ", 8DGMGRL> )                 = 8

Move the HM_FINDING.ams file to a backup file

[oracle@dc01x02 ~]$ mv /u01/oracle_base/diag/rdbms/dbx01/DBX01_1/metadata/HM_FINDING.ams /u01/oracle_base/diag/rdbms/dbx01/DBX01_1/metadata/HM_FINDING.ams.bak
[oracle@dc01x02 ~]$ mv /u01/oracle_base/diag/rdbms/dbx00/dbx00_1/metadata/HM_FINDING.ams /u01/oracle_base/diag/rdbms/dbx00/dbx00_1/metadata/HM_FINDING.ams.bak

New file will be created automatically after moving the HM_FINDING file. After checking the logfiles i am able to see some errors during recovery of a failure

ORA-48223: Interrupt Requested - Fetch Aborted - Return Code [448] [HM_FINDING]
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '+RECOC1/DBX00/ONLINELOG/group_3.259.1083714915'
ORA-17503: ksfdopn:2 Failed to open file +RECOC1/DBX00/ONLINELOG/group_3.259.1083714915
ORA-15001: diskgroup "RECOC1" does not exist or is not mounted
ORA-00450: background process 'ASMB' did not start
ORA-00444: background process "ASMB" failed while starting
ORA-01089: immediate shutdown or close in progress - no operations are permitted
ORA-00312: online log 3 thread 1: '/apps01/base/oradata/dbx01//onlinelog/group_3.264.1083714915'
ORA-27037: unable to obtain file status

After moving the file, there is a message display as below in alert logfile

Thu Oct 07 12:42:41 2021
Create Relation HM_FINDING

Issue is resolved

DGMGRL> show database dbx01

Database - dbx01

  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: 1.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    dbx01

Database Status:
SUCCESS
CONFIGURE DATAGUARD BROKER IN ORACLE DATAGUARD

Check the status of parameter db_broker_start. If it is set to FALSE, then set it to TRUE

kish@PRIM>show parameter dg_broker

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1               string      /u01/oracle/product/12.1.0/db/
                                                 dbs/dr1dbx00.dat
dg_broker_config_file2               string      /u01/oracle/product/12.1.0/db/
                                                 dbs/dr2dbx00.dat
dg_broker_start                      boolean     FALSE
kish@PRIM>alter system set dg_broker_start=true;

System altered.

Refer below link for a common error while creating configuration file for broker.

http://alphaoragroup.com/2021/10/05/error-ora-16698-log_archive_dest_n-parameter-set-for-object-to-be-added/

Invoke dgmgrl utility and create configuration file for the broker

kish@PRIM>!dgmgrl
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.
DGMGRL> connect sys/password
Connected as SYSDG.
DGMGRL> create configuration dgb AS primary database IS dbx00 CONNECT IDENTIFIER IS dbx00;
Configuration "dgb" created with primary database "dbx00"

Add the service of standby database as connection identifier

DGMGRL> add database dbx01 AS CONNECT IDENTIFIER IS dbx01 MAINTAINED AS PHYSICAL;
Database "dbx01" added

Enable the configuration to make broker effective.

DGMGRL> enable configuration;
Enabled.

Verify the configurations of primary and standby

DGMGRL> show configuration

Configuration - dgb

  Protection Mode: MaxPerformance
  Members:
  dbx00 - Primary database
    dbx01 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 2 seconds ago)

Check the status of primary and standby databases

DGMGRL> show configuration

Configuration - dgb

  Protection Mode: MaxPerformance
  Members:
  dbx00 - Primary database
    dbx01 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 8 seconds ago)

DGMGRL> show database dbx01

Database - dbx01

  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: 15.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    dbx01

Database Status:
SUCCESS

DGMGRL> show database dbx00

Database - dbx00

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

Database Status:
SUCCESS
Error: ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added

Cause:

While configure of broker, get an error after creating configuration file for broker due to settings of log_archive_dest_n parameter on both primary and standby database. This is due to service name specified in the log_archive_dest_n parameter

DGMGRL> create configuration dgb AS primary database IS dbx00 CONNECT IDENTIFIER IS dbx00;
Error: ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added

Workaround:

Take a backup of exisiting configuration for LOG_ARCHIVE_DEST_2 parameter in a spool file

kish@PRIM>show parameter LOG_ARCHIVE_DEST_2

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string      service=dbx01 async valid_for=
                                                 (online_logfiles,primary_role)
                                                  db_unique_name=dbx01
log_archive_dest_20                  string
log_archive_dest_21                  string
log_archive_dest_22                  string
log_archive_dest_23                  string
log_archive_dest_24                  string
log_archive_dest_25                  string
log_archive_dest_26                  string
log_archive_dest_27                  string
log_archive_dest_28                  string
log_archive_dest_29                  string
kish@PRIM>spool off
kish@PRIM>!vi log_archive_dest
kish@PRIM>!cat log_archive_dest
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string      service=dbx01 async valid_for=
                                                 (online_logfiles,primary_role)
                                                  db_unique_name=dbx01
kish@PRIM>
kish@PRIM>alter system set log_archive_dest_2='';

System altered.

Create the configuration file

kish@PRIM>!dgmgrl
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.
DGMGRL> connect sys/password
Connected as SYSDG.
DGMGRL> create configuration dgb AS primary database IS dbx00 CONNECT IDENTIFIER IS dbx00;
Configuration "dgb" created with primary database "dbx00"
CONVERT PHYSICAL STANDBY DATABASE TO ACTIVE DATAGUARD USING MANUAL METHOD

Active dataguard is a licensed extension feature to physical standby database which operate in ‘open read only with log apply mode’

Advantages:

  • Analytical queries can be offloaded for reports
  • Backup,export import jobs or other jobs can be offloaded to reduce overhead to primary system

Steps to launch active dataguard:

Cancel MRP in standby database and open the database.

kish@STDBY>alter database recover managed standby database cancel;

Database altered.

kish@STDBY>alter database flashback on;

Database altered.

kish@STDBY>alter database open;

Database altered.

kish@STDBY>select name, open_mode, database_role from v$database;


NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
DBX00     READ ONLY  PHYSICAL STANDBY

After open of database, enable MRP with the below syntax and check the status. If you see ‘read only with apply’ status ,then active dataguard is at your service!

kish@STDBY>alter database recover managed standby database using current logfile disconnect from session;

Database altered.

kish@STDBY>select name, open_mode, database_role from v$database;


NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
DBX00     READ ONLY WITH APPLY PHYSICAL STANDBY

Check the status of MRP

kish@STDBY>select process, status, sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
RFS       IDLE                  0
RFS       IDLE                 80
MRP0      WAIT_FOR_LOG         80

7 rows selected.

I test the effectiveness of active dataguard by using sample table and switch the logfile in primary

kish@PRIM>create table t2 as select * from t;

Table created.
kish@PRIM>insert into t2 values('activedg_work_or_not?',2);

1 row created.

kish@PRIM>commit;

Commit complete.

kish@PRIM>alter system switch logfile;

System altered.

Check if you can insert data in standby database. As the standby database is in open read only mode, you cannot perform any DML transactions on standby. But we can read the table data!

kish@STDBY>insert into t values('activedg_work_or_not?',2);
insert into t values('activedg_work_or_not?',2)
            *
ERROR at line 1:
ORA-16000: database or pluggable database open for read-only access

kish@STDBY>select * from t2;
select * from t2
              *
ERROR at line 1:
ORA-00942: table or view does not exist

kish@STDBY>select * from t2;

NAME                                   ID
------------------------------ ----------
abc                                     1
abc                                     1
snapshot_work_or_not?                   2
rechechk_work_or_not?                   3
rechechk_again                          4
activedg_work_or_not?                   2

6 rows selected.

kish@STDBY>select process, status, sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
RFS       IDLE                  0
RFS       IDLE                 81
MRP0      WAIT_FOR_LOG         81

7 rows selected.

Log file details after converting to active dataguard. As you can observe that the database is operating on read only mode with logs applied parallely

alter database open
Sat Oct 02 19:55:55 2021
Ping without log force is disabled
.
Sat Oct 02 19:55:57 2021
SMON: enabling cache recovery
Sat Oct 02 19:55:57 2021
Dictionary check beginning
Dictionary check complete
Database Characterset is AL32UTF8
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Pluggable database PDB$SEED dictionary check beginning
Sat Oct 02 19:55:58 2021
===========================================================
Dumping current patch information
===========================================================
No patches have been applied
===========================================================
Sat Oct 02 19:55:58 2021
Pluggable Database PDB$SEED Dictionary check complete
Database Characterset for PDB$SEED is AL32UTF8
Opening pdb PDB$SEED (2) with no Resource Manager plan active
Physical standby database opened for read only access.
Completed: alter database open
Sat Oct 02 19:56:33 2021
Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE has been deprecated.
alter database recover managed standby database using current logfile disconnect from session
Standby redo logs should be configured for real time apply. Real time apply will be ignored.
Sat Oct 02 19:56:33 2021
Attempt to start background Managed Standby Recovery process (dbx01)
Starting background process MRP0
Sat Oct 02 19:56:33 2021
MRP0 started with pid=28, OS id=13057
Sat Oct 02 19:56:33 2021
MRP0: Background Managed Standby Recovery process started (dbx01)
Sat Oct 02 19:56:39 2021
Serial Media Recovery started
Managed Standby Recovery not using Real Time Apply
Sat Oct 02 19:56:39 2021
Waiting for all non-current ORLs to be archived...
Sat Oct 02 19:56:39 2021
All non-current ORLs have been archived.
Media Recovery Waiting for thread 1 sequence 80 (in transit)
Completed: alter database recover managed standby database using current logfile disconnect from session
Sat Oct 02 19:59:03 2021
Archived Log entry 64 added for thread 1 sequence 80 rlc 1083714910 ID 0x82d9615a dest 2:
Sat Oct 02 19:59:04 2021
Media Recovery Log /apps01/FRA/DBX01/archivelog/2021_10_02/o1_mf_1_80_jojpxy2r_.arc
Sat Oct 02 19:59:05 2021
Primary database is in MAXIMUM PERFORMANCE mode
RFS[3]: Assigned to RFS process (PID:13137)
RFS[3]: No standby redo logfiles created
RFS[3]: Opened log for thread 1 sequence 81 dbid 2195240283 branch 1083714910
Sat Oct 02 19:59:10 2021
Media Recovery Waiting for thread 1 sequence 81 (in transit)

To get back to physical standby from active dataguard, follow the below steps

kish@STDBY>alter database recover managed standby database cancel;

Database altered.

kish@STDBY>shu immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
kish@STDBY>startup mount;
ORACLE instance started.

Total System Global Area 1509949440 bytes
Fixed Size                  2924640 bytes
Variable Size             989859744 bytes
Database Buffers          503316480 bytes
Redo Buffers               13848576 bytes
Database mounted.
kish@STDBY>select name, open_mode, database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
DBX00     MOUNTED              PHYSICAL STANDBY

kish@STDBY>alter database recover managed standby database using current logfile disconnect from session;

Database altered.

kish@STDBY>select process, status, sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------ ----------
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
ARCH      CONNECTED             0
RFS       IDLE                  0
RFS       IDLE                 81
MRP0      WAIT_FOR_LOG         81

7 rows selected.