Oracle] Data Guard analysis switchover and failover

Source: Internet
Author: User
Tags commit failover
The following is a detailed analysis of the use of Oracle switchover and failover, the need for friends under the reference

The role switching between Data guard master and subordinate libraries is divided into the following two kinds:
1) Switchover
Swithchover are usually artificial and planned for role swaps, such as upgrades. It is usually lossless, that is, there will be no loss of data. its implementation is mainly divided into two stages:
1.Primary switch to Standby
2.Standby (one) converted to primary
2) Failover
failover means that because primary failure cannot be recovered for a short time, standby has to act as a primay role, which is likely to result in data loss if in the highest performance mode.

The following shows the physical standby switchover and failover (logical standby switching is similar).

1. Physical Standby Implementation Switchover
1 Confirm whether Pirmary can be switched to standby
primary>select switchover_status from V$database;


Switchover_status


--------------------


to STANDBY


2) toggle Primary to Standby
Primary>alter Database commit to switchover to physical standby;


3) Start the original primary to Mount state
at this time the original primary is standby identity in the run.


4 Confirm whether standby can be switched to primary
standby>select switchover_status from V$database;


Switchover_status


--------------------


to PRIMARY


5) toggle standby to Primary
Standby>alter Database commit to switchover to primary;


Database altered.


standby>alter database open;


Database altered.


6) validation
primary>select database_role from V$database;


Database_role


----------------


Physical STANDBY


standby>select database_role from V$database;


Database_role


----------------


PRIMARY


can see the original primary now become standby, the original standby into primary.


Check that the log_archive_dest parameters for the new primary are set correctly:


standby>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


standby>show parameter log_archive_dest_state_2


NAME TYPE VALUE


------------------------------------ ----------- ---------------------


log_archive_dest_state_2 string ENABLE


Log switch on new primary:


standby>alter system switch logfile;


System altered.


standby>select Max (sequence#) from V$archived_log;


MAX (sequence#)


--------------


479


at the new Standby end view:
primary>select Max (sequence#) from V$archived_log;


MAX (sequence#)


--------------


479

The maximum serial number of the archived logs on both sides of the
is consistent, indicating switchover success.

2. Physical STANDBY execution Failover
1. Check STANDBY Archive for consecutive
standby>select thread#, Low _sequence#, high_sequence# from V$archive_gap;
No rows selected
This is an important step, and you must make sure that all of the generated archive files are uploaded to the standby server.
If the preceding statement has a return result, you must copy the missing archive from the primary side to the STANDBY end and then add it to the database by using the following command:
Standby>alter Database Register physical LogFile ' filespec '
2). Check that the STANDBY archive is complete
standby>select UNIQUE thread# as THREAD, MAX ( sequence#) over (PARTITION by Threa
d#) as last from V$archived_log;
    thread   & nbsp;   last
--------------------
         1         479
Through the above statement can detect standby current serial number of the largest archive log is 479, if the primary end of a larger than 479 archive logs, copy them over, It is then added to the database by using the following command:
Standby>alter database Register physical logfile ' filespec '
3) Start failover
ALTER database RECOVER MANAGED STANDBY database FINISH force;4) switch to Primaryter databaseCOMMIT to switchover to PRIMARY;
ALTER DATABASE OPEN; Standby>select database_role from V$database;database_role----------------PRIMARY

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.