[Oracle] Analysis of Data Guard switchover and Failover_oracle

Source: Internet
Author: User
Tags failover

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 Execution switchover
1 Confirm whether Pirmary can be switched to standby
Primary>select switchover_status from V$database;
Switchover_status
--------------------
To STANDBY
2) switch primary to standby
Primary>alter database commit to switchover to physical standby;
3) Starting the original primary to Mount state
At this time the original primary is to standby identity in operation.
4 Confirm whether standby can be switched to primary
Standby>select switchover_status from V$database;
Switchover_status
--------------------
To PRIMARY
5) switch standby to Primary
Standby>alter database commit to switchover to primary;
Database altered.
Standby>alter database open;
Database altered.
6) Verify
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 new primary log_archive_dest parameters 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 at new primary end:
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 tallies, indicating switchover success.

2. Physical Standby execution failover
1). Check Standby archive for continuous
Standby>select thread#, low_sequence#, high_sequence# from V$archive_gap;
No rows selected
This step is important to ensure that all the generated archives have been uploaded to the standby server.
If the above 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 Last
---------- ----------
1 479
The above statement allows you to find that standby currently has the largest archive log of 479, and if you have more than 479 archived logs on the primary side, copy them, and then add them 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) Switches Primaryter database COMMIT 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.