Oracle 11g Data Guard Broker Action Note

Source: Internet
Author: User
Tags failover

Reprint Please specify source: http://blog.csdn.net/guoyjoe/article/details/41548669

First, set

1. Set Broker
Set each to true on the master repository
Sql> alter system set dg_broker_start=true;

2. Operate on the main library
[Email protected] admin]$ DGMGRL sys/[email protected]

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. Prepare the library operation
sql> sql> shutdown Immediate;

sql> startup open Read only;

It is best to add read only, because sometimes the broker pulls it back to 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;


Second, snapshot


1. Main Library
Dgmgrl> SHOW CONFIGURATION

dgmgrl> Help Convert

Dgmgrl> CONVERT DATABASE DG to SNAPSHOT STANDBY; ---if there's a failure here, it could be a surveillance dg_dgmgrl.

Dgmgrl> SHOW CONFIGURATION;

2. Prepare the Library
You can actually write the data after it becomes the test library
sql> CREATE TABLE t1 (ID int,name varchar2 (10));

Table created.

sql> INSERT INTO T1 values (1, ' AAAA ');

1 row created.

Sql> commit;

Commit complete.


Third, restore to the physical standby library


1. Main Library
dgmgrl> Help Convert

Dgmgrl> CONVERT DATABASE DG to physical STANDBY; ---if there's a failure here, it could be a surveillance dg_dgmgrl.


Four, back and forth to switch the library


1, operate on the main library 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;
Performing 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
Performing 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 the transfer mode

dgmgrl> SHOW DATABASE VERBOSE PROD1

Dgmgrl> Help Edit

dgmgrl> EDIT DATABASE PROD1 SET property logxptmode=sync; ---main Library
dgmgrl> EDIT CONFIGURATION SET PROTECTION MODE as maxavailability; ---main Library
Error:ora-16627:operation disallowed since no standby databases would remain to support protection mode

Failed.
The main reason for this error is that (both the master and the repository are changed to edit the database XXXX SET property)

dgmgrl> EDIT DATABASE PROD1 SET property logxptmode=sync; ---main Library
dgmgrl> EDIT DATABASE DG SET property logxptmode=sync; ---standby library

dgmgrl> EDIT CONFIGURATION SET PROTECTION MODE as maxavailability; ---main Library
dgmgrl> EDIT CONFIGURATION SET PROTECTION MODE as maxavailability; ---standby library

Above error:ora-16627: Error disappears immediately ....

Some basic commands for the ++++ repository can be noted:
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.


Six, failover


1. Main Library
Dgmgrl> help enable;

dgmgrl> ENABLE Fast_start FAILOVER;

2. Prepare the Library
[Email protected] ~]$ DGMGRL sys/[email protected]

Dgmgrl> Help Start

Dgmgrl> START OBSERVER

3. Main Library
[Email protected] ~]$ Ps-ef |grep Pmon
Oracle 3444 1 0 16:41? 00:00:00 ora_pmon_prod1
Oracle 4534 29892 0 17:04 pts/2 00:00:00 grep pmon
Oracle 10888 1 0 09:03? 00:00:00 ORA_PMON_PROD2
[Email protected] ~]$ kill-9 3444

4. Prepare the Library
(1) Discovery information
Dgmgrl> START OBSERVER
Observer started

17:05:29.04 Friday, November 21, 2014
Initiating Fast-start Failover to Database "DG" ...
Performing failover now, please wait ...
Failover succeeded, new primary is "DG"
17:05:37.62 Friday, November 21, 2014

(2) Stop observer (observe the above information to stop, in case you switch back and forth)

You can use Ctr+c

5. Main Library
[Email protected] ~]$ Sqlplus/as SYSDBA

Sql*plus:release 11.1.0.7.0-production on Fri Nov 21 17:10:14 2014

Copyright (c) 1982, the 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, cut 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 has failed

Dgmgrl> Switchover to PROD1
Performing 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 has warnings

Dgmgrl> switchover to Prod1; -----------------------------------> This error generally appears in the VM ...
Performing 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'm sorry, 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
Performing 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

Oracle 11g Data Guard Broker Action Note

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.