This articles contains useful dgmgrl commands to manage the dataguard environments.

1. Setup DG broker in the standby setup.(Run on both primary and standby)

- For standalone db  :

ALTER SYSTEM SET dg_broker_config_file1 = '\U01\oradata\dr1node.dat' scope=both sid='*';
ALTER SYSTEM SET dg_broker_config_file2 = '\U01\oradata\dr2node.dat' scope=both sid='*';

-- For oracle RAC/ASM file system;

ALTER SYSTEM SET dg_broker_config_file1 = '+DATA/broker/dr1node.dat' scope=both sid='*';
ALTER SYSTEM SET dg_broker_config_file2 = '+DATA/broker/dr2node.dat' scope=both sid='*';


ALTER SYSTEM SET DG_BROKER_START=TRUE scope=both sid='*'; 

2. Create configuration in dgbroker:

-- on primary
$dgmgl

DGMGRL> CONNECT sys/;
Connected.

-- create configuration with primary db_unique_name and its service name .

DGMGRL> CREATE CONFIGURATION 'PROD_DG' AS PRIMARY DATABASE IS 'PRIMDB' CONNECT IDENTIFIER IS PRIMDB;

Configuration "PRIMDB" created with primary database "PRIMDB"

--- Add standby in the configuration:

DGMGRL> ADD DATABASE 'STYDB' AS CONNECT IDENTIFIER IS STYDB MAINTAINED AS PHYSICAL;

Database "STYDB" added

3. Enable the configuration

DGMGRL> ENABLE CONFIGURATION;
Enabled.

At this stage our dg broker setup is completed.

4. View configuration of dgbroker:

DGMGRL> show configuration
 
DGMGRL> show configuration verbose 

5. view database informations:

-- Here PRIMDB and STYDB are db_unique_name of primary and standby db 


DGMGRL> show database 'PRIMDB'
DGMGRL > show database 'STYDB'
DGMGRL> show database verbose 'PRIMDB'


6. View statusreport of databases

-- Here PRIMDB and STYDB are db_unique_name of primary and standby db 

show database PRIMDB statusreport

7. View database inconsistent properties

-- Here PRIMDB and STYDB are db_unique_name of primary and standby db 

show database PRIMDB InconsistentProperties
show database PRIMDB InconsistentLogXptProps

show database STYDB InconsistentProperties
show database STYDB InconsistentLogXptProps

8. Check whether all logfiles are archived or not( on primary)

show database PRIMDB sendQentries


PRIMARY_SEND_QUEUE
        STANDBY_NAME       STATUS     RESETLOGS_ID           THREAD              LOG_SEQ       TIME_GENERATED       TIME_COMPLETED    FIRST_CHANGE#     NEXT_CHANGE#       SIZE (KBs)
                          CURRENT       1022762318                1                  294  10/30/2019 11:09:26                        12298130044308                            274219

9. Check information of received log sequence(not applied) ( Run for standby)

DGMGRL>show database STYDB recvqentries

STANDBY_RECEIVE_QUEUE
              STATUS     RESETLOGS_ID           THREAD              LOG_SEQ       TIME_GENERATED       TIME_COMPLETED    FIRST_CHANGE#     NEXT_CHANGE#       SIZE (KBs)
         NOT_APPLIED       1022762318                1                  293  10/30/2019 10:03:06  10/30/2019 11:09:26   12298109948824   12298130044308          3487164

10. Check database wait events:

DGMGRL>show database PRIMDB topwaitevents

11.Validate database information:

dgmgrl> validate database verbose 'PRIMDB'

dgmgrl> validate database 'PRIMDB'

dgmgrl> validate database 'STYDB'


12. Enable tracing for troubleshooting:

-- For standalone:

DGMGRL> edit configuration set property tracelevel=support;
DGMGRL> edit database PRIMDB set property LogArchiveTrace=8191;
DGMGRL> edit database STYDB set property LogArchiveTrace=8191;


-- For RAC:

DGMGRL> EDIT INSTANCE * ON DATABASE 'PRIMDB' SET PROPERTY LogArchiveTrace=8191;


13. Disable tracing:

DGMGRL> edit configuration reset property tracelevel ;
DGMGRL> edit database PRIMDB reset property logarchivetrace;
DGMGRL> edit database STYDB reset property logarchivetrace;


14. Switchover using dgmgrl:

DGMGRL> connect sys/oracle
Password:
Connected as sys.



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


15. Convert physical standby to snapshot standby

DGMGRL> convert database 'STYDB' to snapshot standby;

16. Convert snapshot to physical standby db

DGMGRL> CONVERT DATABASE 'STYDB' to PHYSICAL STANDBY;
dataguarddgmgrl DATAGUARD


Related Topics

How to setup dataguard broker configuration (DG broker) in 12c
How to add a tempfile in primary database in dataguard
How to disable enable log shipping in standby using dgmgrl
How to use expdp to export data from physical standby database
Useful DGMGRL commands in oracle dataguard
How to recreate physical standby controlfile
How to enable active dataguard in physical standby database
Standby redologs in oracle dataguard
Flashback primary database in dataguard environment

You May Also Like

Clone a database using dbca command in oracle 19c -New feature
ENABLE_PARALLEL_DML hint in oracle 12c
How to move AUD$ table to another tablespace using DBMS_AUDIT_MGMT
EMCLI command - OEM 12C
How to use oratop tool for oracle database monitoring
How to create encrypted tablespace in PDB( oracle 12c)
Flashback primary database in dataguard environment
How to move controlfile to a new location in oracle
sec_case_sensitive_logon parameter in oracle
Hive installation with mysql database

From This Website

ORA-16855: transport lag has exceeded specified threshold
Oswatcher tool for collecting server diagnostic information
resumable_timeout parameter in oracle database
REUSE_DUMPFILES parameter in EXPDP
how to use DBMS_PRIVILEGE_CAPTURE to capture privs in oracle 12c
Shared Pool Advisory in oracle
What is colored sql_id in dba_hist_colored_sql
Steps for upgrading oracle database to 19c using DBUA
ORA-32774: more than one file was specified for bigfile tablespace
Perform Flashback in pluggable database(PDB) in oracle 12.2