DataGuard-physical Master/Slave database Switch

Source: Internet
Author: User
Recently, due to work needs, I have studied some of DG's things. The following are the operation steps of mongomingaswitchovertoaphysicalstandbydatabase, which are mainly compiled by referring to official documents and online materials: 1. Before switching instances, you must reduce the database to one instance. That is, if RAC is used, only one node is left. Shutdo

Recently, due to work needs, I have studied some of DG's things. The following are the operation steps for using Ming a Switchover to a Physical Standby Database, which are mainly compiled by referring to official documents and online materials: 1. Before switching instances, you must reduce the database to one instance. That is, if RAC is used, only one node is left. Shutdo

Recently, due to work needs, I have studied some of DG's things. The following are the operation steps for using Ming a Switchover to a Physical Standby Database, which are mainly compiled by referring to official documents and online materials:

1. reduce instances

Before switching, you must reduce the database to an instance, that is, if RAC is used, only one node is left.

Shutdown immediate

Or (in case of emergency assistance)

Shutdown abort

2. check whether there is a log gap in the master database.

SQL> select STATUS, GAP_STATUS from V $ ARCHIVE_DEST_STATUS where DEST_ID = 2;

VALID and no gap should be returned.

Delete all delayed applications (delay) in the LOG_ARCHIVE_DEST_N parameter and redo the log settings. Make sure that all changes are applied in the slave database to ensure that no data is lost.

Check that all the redo logs are applied in the standby database. query the standby database:

SQL> select NAME, VALUE, DATUM_TIME from V $ DATAGUARD_STATS;

Transport lag or apply lag should not be returned, and finish time should be 0.

3. Check prerequisites

After checking these prerequisites, confirm that the master database can switch roles and query the master database:

SQL> select SWITCHOVER_STATUS from V $ DATABASE;

If the return value is to standby or sessions active, the master database can be switched.

The command for switching the master database to the slave database is:

Alter database commit to switchover to physical standby with session shutdown;

Shutdown immediate

Startup mount

4. Switch the slave database to the master database

Check whether the slave database can be switched to the master database

Select SWITCHOVER_STATUS from V $ DATABASE;

If you return to primary or sessions active, you can switch between them.

If switchover latent or switchover pending is returned, check the alarm log to see if there is any problem. Generally, you need to apply some logs.

To apply logs, run the following command in the slave database:

Recover standby database using backup controlfile;

The Application Log should be in the switchover pending state. After the application is completed, it will change TO the to primary or sessions active state.

Switch the slave database to the master database:

Alter database commit to switchover? Primary with session shutdown;

Open the new master database:

Alter database open;

5. Enable log application in the original master database (current slave database)

If other physical standby databases are stopped, you must enable the log application.

Alter database recover managed standby databse using current logfile disconnect from session;

Original article address: Data Guard-switch between the physical master and slave databases. Thank you for sharing it with the original author.

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.