Disclaimer

Saturday, 14 December 2024

DG BROKER Commands

 


1) How to configure Data Guard broker:
How to configure Data Guard broker:

1.Start the DMON process on both the primary and standby databases:

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

System altered.


2) Set the log_archive_dest_2 settings from both the Primary and Standby databases
to be nothing , then try to create the broker configuration (it will automatically 
set the log_archive_dest_n when you'll add a database to the configuration)
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='';
System altered.


3) Connect DGMGRL on the primary DB and create the configuration 
[oracle@primary ~]$ 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/sys123
Connected as SYSDG.

DGMGRL> CREATE CONFIGURATION 'DG_ORCL_CONFIG' AS PRIMARY DATABASE IS 'ORCL' CONNECT IDENTIFIER IS ORCL;
Configuration "DG_ORCL_CONFIG" created with primary database "ORCL"

Next add a standby database to the Data Guard broker configuration:

DGMGRL> ADD DATABASE 'ORCLDG' AS CONNECT IDENTIFIER IS 'ORCLDG';
Database "ORCL" added

Enable dataguard broker configuration 

DGMGRL> enable configuration;
Enabled.

DGMGRL> show configuration;

Configuration - DG_ORCL_CONFIG

 Protection Mode: MaxPerformance
 Members:
 ORCL - Primary database
 ORCLDG - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS (status updated 40 seconds ago)



4) To remove DG broker configuration:

DGMGRL> remove configuration;
Removed configuration


5) Rename the database name in the Data Guard broker as follows:

DGMGRL> edit database 'ORCLDG' rename to 'STBY';




6) To turn off redo transport to all remote destinations on the primary database:

DGMGRL> edit database 'ORCL' SET STATE="LOG-TRANSPORT-OFF";


7) To stop and start redo transport services to specific standby databases:

DGMGRL> edit database 'ORCLDG' SET PROPERTY 'LogShipping'='OFF';
Property "LogShipping" updated

DGMGRL> SHOW DATABASE 'ORCLDG' 'LogShipping';
 LogShipping = 'OFF'

DGMGRL> edit database 'ORCLDG' SET PROPERTY 'LogShipping'='ON';
Property "LogShipping" updated

DGMGRL> SHOW DATABASE 'ORCLDG' 'LogShipping';
 LogShipping = 'ON'


8) To change the state of the standby database to read-only and back APPLY-ON:

DGMGRL> EDIT DATABASE 'ORCL' SET STATE='READ-ONLY';
Succeeded.

DGMGRL> show database ORCL
Database - ORCL

 Role: PHYSICAL STANDBY
 Intended State: READ-ONLY
<<OUTPUT TRIMMED>>
Database Status:
SUCCESS


9) To change back:

DGMGRL> shutdown 
DGMGRL> startup mount;
DGMGRL> show database ORCL

Database - ORCL
 Role: PHYSICAL STANDBY
 Intended State: OFFLINE
  <<OUTPUT TRIMMED>>

DGMGRL> EDIT DATABASE ORCL SET STATE = APPLY-ON;
Succeeded.
DGMGRL> show database ORCL

Database - ORCL

 Role: PHYSICAL STANDBY
 Intended State: APPLY-ON
 <<OUTPUT TRIMMED>>













No comments:

Post a Comment

Understanding SQL Plan Baselines in Oracle Database

  Understanding SQL Plan Baselines in Oracle Database SQL Plan Baseline is the feature in Oracle started from Database 11g that helps to pre...