DATAGUARD BROKER - How to create and configure
data guard broker
Assumption:
My database name: mydb
My primary database (SID): mydb_p
My standby database (SID): mydb_s
To use the dataguard broker, make sure that the dg_broker_start
parameter was set to TRUE on
both Primary and Standby sites:
SQL>
Alter system set dg_broker_start=True scope=both;
On any servers (primary or standby):
# dgmgrl sys/oracle@mydb_p -- on primary
DGMGRL>
create configuration 'dg_mydb' as
> primary database is 'mydb_p'
> connect identifier is mydb_p;
DGMGRL>
Add database 'mydb_s' as
> connect identifier is mydb_s
> maintained as physical;
To enable the configuration and see the output do the following
commands.
DGMGRL>
enable configuration;
DGMGRL>
show configuration
Switchover to your standby database:
Notice with switchover, your standby becomes primary and your primary
becomes standby:
DGMGRL>
switchover to 'mydb_s';
Failover to your standby:
Notice that with the failover, your old primary no longer syncing and
your standby become primary.
DGMGRL> failover
to 'mydb_s';
Failover to standby succeeded.
Make sure to enable FLAHBACK ON.
SQL>
alter database flashback on;
SQL> Alter System set Log_archive_dest_2='Service=to_primary LGWR AFFIRM
SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)db_unique_name=primary';
SQL> Alter database set primary database to maximize availability;
# dgmgrl sys/oracle@mydb_p
DGMGRL> show configuration; --If a configuration is displayed then
remove it.
To remove your configuration:
DGMGRL>
remove configuration;
To edit configuration for each databases:
DGMGRL>
show database verbose mydb_p;
DGMGRL>
edit database PRIMARY set property LogXptMode='SYNC';
DGMGRL>
edit database STANDBY set property LogXptMode='SYNC';
DGMGRL>
edit configuration set protection mode as MaxAvailability;
DGMGRL>
enable fast_start failover;
DGMGRL>
show configuration;
To start observer:
DGMGRL>
start observer;
Good Luck!
|