Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of DataGuard switching?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what is the method of DataGuard switching". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Environment:

Db version:11.2.0.3

Main library: RAC of two nodes

Standby library: RAC of two nodes

It is remote disaster preparedness, and the quality of the network is not very good.

Steps:

1. Check the log application

Standby database (ready for library check):

SQL > select thread#,SEQUENCE#,FIRST_TIME,next_time,applied from gv$archived_log order by sequence#; (make sure that all logs have been applied)

two。 Check for log transfer errors

SQL > SELECT STATUS, GAP_STATUS FROM V$ARCHIVE_DEST_STATUS WHERE DEST_ID = 2; STATUS GAP_STATUS

-

VALID NO GAP

3. Evaluate the switching time-only one instance of the slave database in the rac environment can be open.

Set linesize 200

SQL > column name format A22

SQL > column value format A16

SQL > column unit format A28

SQL > column time_computed format A25

SQL > select * from v$dataguard_stats

NAME VALUE UNIT TIME_COMPUTED DATUM_TIME

Transport lag + 00 01:47:32 day (2) to second (0) interval 10 max 2014 10:48:15 10 max 2014 10:47:58

Apply lag + 00 01:47:32 day (2) to second (0) interval 10 max 2014 10:48:15 10 max 2014 10:47:58

Apply finish time day (2) to second (3) interval 10 take 29 Universe 10:48:15 in 2014

Estimated startup time 20 second 10/29/2014 10:48:15

4. Since both the master and slave databases are rac, only one instance of both the master and slave databases survives in this environment.

Srvctl stop instance-d EM-I EM2-- stop the main library first

Srvctl stop instance-d EM_SH-I EMP2-stop preparing the library

NOTE: if both instances of the main database survive, an error will be reported as follows:

SQL > alter database commit to switchover to physical standby with session shutdown

Alter database commit to switchover to physical standby with session shutdown

*

ERROR at line 1:

ORA-01105: mount is incompatible with mounts by other instances

5. Log in to the main library operation

SQL > SELECT SWITCHOVER_STATUS FROM database database;-- make sure the status is SESSION_ACTIVE or TO STANDBY (because it is remote, there may be a delay in the redo application after an instance of shut. If the network quality is not good, you can wait)

Alter database commit to switchover to physical standby with session shutdown;-perform a switch (preferably stop the application)-after performing this operation, the database will automatically shut

STARTUP MOUNT;-- Boot the original main library to mount

6. Log in to slave database operation

SELECT SWITCHOVER_STATUS FROM data database;-- make sure the status is SESSION_ACTIVE or TO PRIMARY.

ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;-perform role switching

ALTER DATABASE OPEN;-- opens the new main library

Srvctl start instance-d databasename-I instance_name-- start another node

7. Log in to the new repository

ALTER DATABASE OPEN;-Startup Library

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;-launch real-time applications

Srvctl start instance-d databasename-I instance_name;-- start other instances

8. Conduct the transaction and find that it is not synchronized.

Archive log list found that scn didn't even have it.

It has been checked because there is no log transfer in the main database.

Alter system set log_archive_dest_state_2='enable' sid='*';-execute in the new main library and start the log transfer service

It is possible to query the status of data as follows:

SQL > SELECT SWITCHOVER_STATUS FROM V$DATABASE

SWITCHOVER_STATUS

-

FAILED DESTINATION

Check that the scn of the slave database has not changed, and restart the slave database.

9. Check whether it is synchronized

SELECT MAX (SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG

WHERE RESETLOGS_CHANGE# = (SELECT MAX (RESETLOGS_CHANGE#) FROM V$ARCHIVED_LOG) GROUP BY THREAD#

This is the end of the content of "what is the method of DataGuard switching". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report