Oracle 11g Data Guard Broker operation notes, 11 gbroker

Source: Internet
Author: User

Oracle 11g Data Guard Broker operation notes, 11 gbroker

Reprinted please indicate the source: http://blog.csdn.net/guoyjoe/article/details/41548669

I. Settings

 

1. Set broker
Set to true on both the master and slave databases.
SQL> alter system set dg_broker_start = true;

2. operate on the master database
[Oracle @ edsir5p17 admin] $ dgmgrl sys/oracle @ PROD1

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;


3. Slave database operations
SQL> shutdown immediate;

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
----------
READ ONLY

SQL> select flashback_on from v $ database;

FLASHBACK_ON
------------------
NO

SQL> show parameter recovery

NAME TYPE VALUE
-----------------------------------------------------------------------------
Db_recovery_file_dest string/flash
Db_recovery_file_dest_size big integer 1G

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database flashback on;

 


Ii. snapshot


1. master database
DGMGRL> SHOW CONFIGURATION

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
Data can be written to the TEST database.
SQL> create table t1 (id int, name varchar2 (10 ));

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> help convert

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
DGMGRL> SHOW CONFIGURATION

Configuration
Name: c1
Enabled: YES
Protection Mode: MaxPerformance
Databases:
Prod1-Primary database
Dg-Physical standby database

Fast-Start Failover: DISABLED

Current status for "c1 ":
SUCCESS

DGMGRL> help switch
Unrecognized command "switch", try "help"
DGMGRL> help switchover

Switch roles between the primary database and a standby database

Syntax:

Switchover to <standby database name>;

DGMGRL> switchover to dg;
Ming switchover NOW, please wait...
New primary database "dg" is opening...
Operation requires shutdown of instance "PROD1" on database "prod1"
Shutting down instance "PROD1 "...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "PROD1" on database "prod1"
Starting instance "PROD1 "...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "dg"

DGMGRL> SHOW CONFIGURATION

Configuration
Name: c1
Enabled: YES
Protection Mode: MaxPerformance
Databases:
Dg-Primary database
Prod1-Physical standby database

Fast-Start Failover: DISABLED

Current status for "c1 ":
SUCCESS

DGMGRL> switchover to PROD1
Ming switchover NOW, please wait...
New primary database "prod1" is opening...
Operation requires shutdown of instance "DG" on database "dg"
Shutting down instance "DG "...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "DG" on database "dg"
Starting instance "DG "...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "prod1"

 

 

V. Modify Transmission Mode

 

DGMGRL> show database verbose PROD1

DGMGRL> help edit

DGMGRL> edit database PROD1 set property LogXptMode = SYNC; --- master DATABASE
DGMGRL> edit configuration set protection mode as MaxAvailability; --- master database
Error: ORA-16627: operation disallowed since no standby databases wowould remain to support protection mode

Failed.
The main cause of this error is (both the master DATABASE and the slave DATABASE must change the edit database xxxx set property)

DGMGRL> edit database PROD1 set property LogXptMode = SYNC; --- master DATABASE
DGMGRL> edit database dg set property LogXptMode = SYNC; --- standby DATABASE

DGMGRL> edit configuration set protection mode as MaxAvailability; --- master database
DGMGRL> edit configuration set protection mode as MaxAvailability; --- standby Database

Above Error: ORA-16627: Error disappears immediately ....

You can write down some basic commands of the slave database:
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database open;

Database altered.


 

 

 

Vi. Failover


1. master database
DGMGRL> help enable;

DGMGRL> ENABLE FAST_START FAILOVER;

2. Slave Database
[Oracle @ edsir5p18 ~] $ Dgmgrl sys/oracle @ DG

DGMGRL> help start

DGMGRL> START OBSERVER

3. master database
[Oracle @ edsir5p17 ~] $ Ps-ef | grep pmon
Oracle 3444 1 0? 00:00:00 ora_pmon_PROD1
Oracle 4534 29892 0 00:00:00 pts/2 grep pmon
Oracle 10888 1 0? 00:00:00 ora_pmon_PROD2
[Oracle @ edsir5p17 ~] $ Kill-9 3444

4. Slave Database
(1) Information discovery
DGMGRL> START OBSERVER
Observer started

17:05:29. 04 Friday, November 21,201 4
Initiating Fast-Start Failover to database "dg "...
Please Ming failover NOW, please wait...
Failover succeeded, new primary is "dg"
17:05:37. 62 Friday, November 21,201 4

(2) stop observer (stop after observing the above information to prevent switching back and forth)

Use ctr + c

5. master database
[Oracle @ edsir5p17 ~] $ Sqlplus/as sysdba

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;
ORACLE instance started.

Total System Global Area 418484224 bytes
Fixed Size 1313792 bytes
Variable Size 176161792 bytes
Database Buffers 234881024 bytes
Redo Buffers 6127616 bytes
Database mounted.

6. Switch back
DGMGRL> show configuration;

Configuration
Name: c1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
Dg-Primary database
Prod1-Physical standby database (disabled)
-Fast-Start Failover target

Fast-Start Failover: ENABLED

Current status for "c1 ":
Warning: ORA-16607: one or more databases have failed

DGMGRL> switchover to PROD1
Ming switchover NOW, please wait...
Error: ORA-16541: database is not enabled

Failed.

DGMGRL> DISABLE FAST_START FAILOVER;
Error: ORA-16652: fast-start failover target standby database is disabled

Failed.
DGMGRL> DISABLE FAST_START FAILOVER force;
Disabled.

DGMGRL> show configuration;

Configuration
Name: c1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
Dg-Primary database
Prod1-Physical standby database (disabled)

Fast-Start Failover: DISABLED

Current status for "c1 ":
Warning: ORA-16608: one or more databases have warnings

 

DGMGRL> switchover to prod1;-----------------------------------> This error is generally reported in the VM...
Ming switchover NOW, please wait...
Error: ORA-16541: database is not enabled

Failed.
Unable to switchover, primary database is still "dg"


DGMGRL> show database verbose prod1

Current status for "prod1 ":
Error: ORA-16661: the standby database needs to be reinstated


I can't fix it. I reset it.
DGMGRL> reinstate database PROD1
Reinstating database "prod1", please wait...
Operation requires shutdown of instance "PROD1" on database "prod1"
Shutting down instance "PROD1 "...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "PROD1" on database "prod1"
Starting instance "PROD1 "...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "prod1 "...
Reinstatement of database "prod1" succeeded
DGMGRL> show configuration;

Configuration
Name: c1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
Dg-Primary database
Prod1-Physical standby database

Fast-Start Failover: DISABLED

Current status for "c1 ":
Warning: ORA-16610: command "edit database prod1 set property" in progress


DGMGRL> switchover to PROD1
Ming switchover NOW, please wait...
New primary database "prod1" is opening...
Operation requires shutdown of instance "DG" on database "dg"
Shutting down instance "DG "...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "DG" on database "dg"
Starting instance "DG "...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "prod1"

DGMGRL> show configuration;

Configuration
Name: c1
Enabled: YES
Protection Mode: MaxAvailability
Databases:
Prod1-Primary database
Dg-Physical standby database

Fast-Start Failover: DISABLED

Current status for "c1 ":
SUCCESS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.