Oracle Data Guard Learning (6) Role transformation

Source: Internet
Author: User
Tags commit failover

DG's core function is to provide high availability disaster, so the role-switching content described in this section is the most important part of DG. The role switching between DG Master and slave Libraries is divided into the following two kinds:

1) Switchover

Swithchover refers to the master-slave library for role swaps (master Library, reserve library variable main library), usually man-made, planned, such as the use of switchover can reduce the database upgrade downtime, so do not cause data loss.

2) Failover

Failover refers to the main library because the failure can not be recovered in a short time, in order to ensure the availability of data, the repository has to temporarily act as the role of the main library, if the DG Data protection mode is the maximum performance mode, this switch is likely to lead to data loss.

The following shows the switchover and failover of the physical and logical repositories respectively

Switchover and failover of physical repositories

1. Switchover of the physical reserve library

1 confirm that the main library can be switched to a standby library

Sql>select switchover_status from V$database;  
      
Switchover_status  
--------------------to  
STANDBY

2 Switch the main library into a physical standby library

Sql>alter database commit to switchover to physical standby;

3) Close the main library and reboot to Mount state

Sql>shutdown Abort

Sql>startup Mount

At this point the identity of the main library has changed to become a physical repository.

4 Confirm that the physical repository can be switched to the main library

Sql>select switchover_status from V$database;  
      
Switchover_status  
--------------------to  
PRIMARY

5 switching the original physical repository to the new main library

Sql>alter database commit to switchover to primary;  
      
Database altered.  
Sql>alter database open;  
      
Database altered.

6 Start the log application in the new home library

sql> ALTER database RECOVER MANAGED STANDBY database USING current LOGFILE DISCONNECT from session;

7) Verify

Sql>select database_role from V$database;  
      
Database_role  
----------------  
physical STANDBY  
sql>select database_role from V$database;  
      
Database_role  
----------------  
PRIMARY

From the above you can see that the original main library has now become physical, the original physical repository into the main library.

Check that the log_archive_dest_n parameters for the new home library are set correctly:

Sql>show parameter log_archive_dest_2  
      
NAME                                 TYPE        VALUE  
--------------------------------------- --------------------------------------  
log_archive_dest_2            string      service=o01dms0 ARCH valid_for  
                                                              =

(online_logfiles,primary_role  
                                                               ) db_unique_name=o01dms0  
sql>show parameter Log_archive_dest_ state_2  
      
NAME                                 TYPE        VALUE  
------------------------------------------------------------------ --  
log_archive_dest_state_2             string      ENABLE

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.