Oracle 11g Data Guard Broker operation notes
I. Settings
1. Set broker
2. operate on the master database
DGMGRL> help
DGMGRL> help create
DGMGRL> create configuration c1 as primary database is PROD1 connect identifier is PROD1;
DGMGRL> help add
DGMGRL> add database dg as connect identifier is dg;
DGMGRL> help enable
DGMGRL> enable configuration;
DGMGRL> help show
DGMGRL> show configuration;
SQL> startup open read only;
It is best to add read only, because sometimes the broker will pull it back to the mount state !!!
SQL> select open_mode from v $ database;
OPEN_MODE
SQL> select flashback_on from v $ database;
FLASHBACK_ON
SQL> show parameter recovery
NAME TYPE VALUE
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database flashback on;
Ii. snapshot
1. master database
DGMGRL> help convert
DGMGRL> convert database dg to snapshot standby; --- if there is a failure, it may be because the DG_DGMGRL is not set.
DGMGRL> show configuration;
2. Slave Database
Table created.
SQL> insert into t1 values (1, 'aaa ');
1 row created.
SQL> commit;
Commit complete.
Iii. restore to the physical standby Database
1. master database
DGMGRL> convert database dg to physical standby; --- if there is a failure, it may be because the DG_DGMGRL is not set.
Iv. back-and-forth database Switching
1. operate on the master database PROD1
Configuration
Fast-Start Failover: DISABLED
Current status for "c1 ":
DGMGRL> help switch
Switch roles between the primary database and a standby database
Syntax:
Switchover to <standby database name>;
DGMGRL> switchover to dg;
Database dismounted.
DGMGRL> SHOW CONFIGURATION
Configuration
Fast-Start Failover: DISABLED
Current status for "c1 ":
DGMGRL> switchover to PROD1
Database dismounted.
V. Modify Transmission Mode
DGMGRL> show database verbose PROD1
DGMGRL> help edit
DGMGRL> edit database PROD1 set property LogXptMode = SYNC; --- master DATABASE
Failed.
DGMGRL> edit database PROD1 set property LogXptMode = SYNC; --- master DATABASE
DGMGRL> edit configuration set protection mode as MaxAvailability; --- master database
Above Error: ORA-16627: Error disappears immediately ....
You can write down some basic commands of the slave database:
Database altered.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
Database altered.
Vi. Failover
1. master database
DGMGRL> ENABLE FAST_START FAILOVER;
2. Slave Database
DGMGRL> help start
DGMGRL> START OBSERVER
3. master database
4. Slave Database
17:05:29. 04 Friday, November 21,201 4
(2) stop observer (stop after observing the above information to prevent switching back and forth)
5. master database
SQL * Plus: Release 11.1.0.7.0-Production on Fri Nov 21 17:10:14 2014
Copyright (c) 1982,200 8, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
Total System Global Area 418484224 bytes
6. Switch back
Configuration
Fast-Start Failover: ENABLED
Current status for "c1 ":
DGMGRL> switchover to PROD1
Failed.
DGMGRL> DISABLE FAST_START FAILOVER;
Failed.
DGMGRL> show configuration;
Configuration
Fast-Start Failover: DISABLED
Current status for "c1 ":
DGMGRL> switchover to prod1;-----------------------------------> This error is generally reported in the VM...
Ming switchover NOW, please wait...
Failed.
Current status for "prod1 ":
Database dismounted.
Configuration
Fast-Start Failover: DISABLED
Current status for "c1 ":
Database dismounted.
DGMGRL> show configuration;
Configuration
Fast-Start Failover: DISABLED
Current status for "c1 ":