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

[Enmo College] in-depth analysis: one active and multi-standby DG environment, detailed explanation of the implementation process of failover

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

[Enmo College] in-depth analysis: one active and multi-standby DG environment, detailed explanation of the implementation process of failover

Introduction to the author

The current cloud and Enmo database technical consultant, specializes in Oracle database installation and configuration, fault diagnosis, performance diagnosis, performance optimization, backup disaster recovery solution design and implementation.

Personal technology blog: https://www.cnblogs.com/jyzhao

Switchover and failover are two important concepts in DG, and they are also the core of DG implementation. Depending on the DG configuration, switchover and failover are also different. How to operate DG foilover when the main library is crash?

Overview

This document is a report on failover operation and subsequent recovery in DG disaster recovery environment.

Test environment

Database version: Oracle 11.2.0.4

Site A: main library db_unique_name=jyzhao

Site B: prepare the library (real-time application) db_unique_name=mynas

Site C: prepare the library (delayed application by 1 hour) db_unique_name=jyzhao_s

Abbreviated comment

A library = > Site A: main library

B library = > Site B: prepare the library (real-time application)

C library = > Site C: prepare the library (delayed application by 1 hour)

After A library crash, do failover in B library to switch B to the new main library. After confirming failover, what should A library and C library do before they can be used as new standby libraries? Do you need to rebuild? If rebuilt, do you need a new backup to restore, and can previous backups be used to create a backup library?

problem

Verification process

1. Library An is closed abnormally.

Library A:

SQL > shutdown abort

2. B library is switched from failover to new main library.

The standard steps for failover are as follows:

# cancel DG application

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL

# restart the database (recommended)

Shutdown immediate

Startup

# the operation is irreversible. Failover is required to determine the actual situation.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH force

SELECT OPEN_MODE, DATABASE_ROLE, SWITCHOVER_STATUS, FORCE_LOGGING, DATAGUARD_BROKER, GUARD_STATUS FROM V$DATABASE

# try switching to the main library routinely

ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN

If the regular switch at this step fails, indicating that media recovery is required, then:

1) restore slave recover standby database until cancel

2) activate slave alterdatabaseactivatestandbydatabase

# finally restart the database

Shutdownimmediate

Startup

View the information of the B library at this time:

SQL > selectname, database_role, open_mode fromgv$database

As you can see, the B library has become the new main library, and the sequence of the redo log starts again.

3. C library is required to be the standby library for the new main library.

C library is now required to be the standby library for the new main library. Do you need to rebuild the C library? The answer is no. Let's take a look at the verification process in detail.

Alert log of the C library:

You can see that after the A library crash, the C library received an alarm that the network could not connect to the A library, indicating that there is no new operation in the C library.

Next, if you want the C library to become the standby library for the B library (the new main library), you need to try to configure the DG parameter on the B library so that the archive of the B library can be transferred to the C library.

At the same time, add a connection to the C library in the tnsnames.ora file of the B library:

# StandbySingle Instance

JYZHAO_S=

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.111) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = jyzhao_s)

After the B library is set up, observe the alarm of B library:

Then return to the C library operation and open the real-time log application to the C library:

SQL > alter database recover managed standby database cancel

Databasealtered.

SQL > alter database recover managed standby database using current logfile disconnect from session

Databasealtered.

At this point, observe the alarm log of C library:

In fact, we can see that the C library has been able to apply logs normally. It shows that the C library does not need to be rebuilt to become the new standby library of the new main library B through simple configuration.

4. Library An is required to be the standby library for the new main library.

If Library A starts at this time, it is an independent database. If you want to set Library An as the main database, then it is certainly feasible to use the latest backup of the new main database, but if the amount of data is large, library An itself has a historical backup before, can it no longer take time to back up the new main database and restore it directly through historical backup? In fact, it can be inferred that the C library above no longer needs to be rebuilt to directly become the backup library of the new main library. Just make sure that the backup was done before failover. Let's go to specific experiments to verify the feasibility.

Create a new standby control file in library B and transfer it to the same path in library A.

Backupcurrentcontrolfileforstandbyformat'/tmp/std_control02.ctl'

Boot to nomount in library A, and restore new backup control files

Restorestandbycontrolfilefrom'/tmp/std_control02.ctl'

Check the checkpoint of the data file header in Library An and confirm that it is before failover:

The checkpoint of the above data file header is 0, indicating that the data file was not obtained correctly. In fact, it is due to a change in the name of OMF. Catalog the data file path directly to the backup set, and then switch it.

Catalogstartwith'+DATA1/jyzhao/datafile/'

Switchdatabase to copy

Query again:

Open the log application in mount:

Alter database recover managed standby database disconnect from session

Observe from the alarm log and cancel the log application when confirming that the application is up to date:

Alter database recover managed standby database cancel

Open the database and open the real-time application:

Alter database recover managed standby database USING CURRENT LOGFILE disconnect from session

Finally, the query can be applied in real time.

Conclusion

Generally speaking, after the A library crash, the B library failover becomes the new main library, then the C library which was originally set to be applied with a delay of 1 hour can be directly configured as the standby library of the new main library. After the A library is repaired, the existing backup set before failover can also be used to restore the state before failover, without the need to re-backup in the new main library.

Enmo College, a subsidiary of Yunhe Enmo (Beijing) Information Technology Co., Ltd., is committed to providing professional and high-level oracle database and big data training services, mining and training big data and database talents. Enmo College provides a full range of big data and database technology training, including individual practical skills training, personal certification training, and enterprise internal training. ACE-level super teachers, equipped with professional laboratories, immersion learning and training, professional laboratories, equipped with professional teaching assistants to guide training. Can quickly integrate into the circle of experts, rich in resources in the industry, and quickly accumulate workplace contacts. Oracle database courses include: Oracle DBA practical class, Oracle OCM examination, Oracle OCP examination and so on.

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