[Oracle] Data Guard-Switchover and Failover

Source: Internet
Author: User

[Oracle] role switching between Data Guard-Switchover and Failover Data Guard master/Slave databases can be divided into the following two types: 1) SwitchoverSwithchover is generally artificially scheduled for role switching, such as upgrading. It is usually lossless, that is, there will be no data loss. The execution of StandbyStandby is divided into two phases: converting Primary to StandbyStandby (one) to Primary2) FailoverFailover means that because the Primary fault cannot be recovered in a short time, Standby has to act as the Primay role, this type of switch may cause data loss. The following describes the Switchover and Failover of physical Standby (logical Standby switching is similar ). 1. physical Standby execute Switchover1) Check if pirmary can be switched to standbyPRIMARY> select switchover_status from v $ database; SWITCHOVER_STATUS--------------------TO STANDBY2) Switch primary to standbyPRIMARY> alter database commit to switchover to physical standby; 3) start the original primary to the mount State. At this time, the original primary is running as standby. 4) Check whether standby can be switched to primarySTANDBY> select switchover_status from v $ database; SWITCHOVER_STATUS--------------------TO PRIMARY5) Switch standby to primarySTANDBY> 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 STANDBYSTANDBY> select database_role from v $ databas E; DATABASE_ROLE----------------PRIMARY can see that the original primary now becomes standby, the original standby becomes primary. Check whether the new primary log_archive_dest parameter is set correctly: STANDBY> show parameter name type value =----------- specify parameter string service = O01DMS0 ARCH VALID_FOR = (ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME = O01DMS0STANDBY> show parameter log_archive_dest_state_2 name type value -------------------------------------------------- ------------------ Log_archive_dest_state_2 string ENABLE log switch on the new primary end: STANDBY> alter system switch logfile; System altered. STANDBY> select max (sequence #) from v $ archived_log; MAX (SEQUENCE #) ------------ 479 view on the new standby end: PRIMARY> select max (sequence #) from v $ archived_log; MAX (SEQUENCE #) -------------- 479 the maximum number of archived logs on both sides is consistent, indicating that switchover is successful. 2. the physical Standby executes Failover1 ). check whether the standby archive files are consecutive STANDBY> select thread #, LOW_SEQUENCE #, HIGH_SEQUENCE # from v $ ARCHIVE_GAP; no rows selected, make sure that all generated archive files have been uploaded to the standby server. If the preceding statement returns results, you must copy the missing archive file from the primary end to the standby end, and then add it to the database using the following command: STANDBY> alter database register physical logfile 'filespec '2 ). check whether the standby archive file is complete. STANDBY> select unique thread # as thread, MAX (SEQUENCE #) OVER (partition by thread #) as last from V $ ARCHIVED_LOG; thread last ---------- 1 479 you can use the preceding statement to find that the maximum archive log of standby is 479. If there are archive logs larger than 479 on the primary end, copy them, run the following command to add it to the database: STANDBY> alter DATABASE register physical logfile 'filespec '3) Start failoverALTER database recover managed standby database finish force; 4) switch TO 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.