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

How to realize the role switch of Oracle Data Guard master library and backup database

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

How to achieve Oracle Data Guard master library standby library role switch, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Step 1: verify whether the main library can switch roles. TO STANDBY indicates that it can.

SQL > SELECT SWITCHOVER_STATUS FROM V$DATABASE

SWITCHOVER_STATUS

-

TO STANDBY

1 row selected

The TO STANDBY value in the SWITCHOVER_STATUS column indicates that it is

Possible to switch the primary database to the standby role. If the TO STANDBY value

Is not displayed, then verify the Data Guard configuration is functioning correctly (fo

Example, verify all LOG_ARCHIVE_DEST_n parameter values are specified correctly).

If the value in the SWITCHOVER_STATUS column is SESSIONS ACTIVE, perform. The

Steps described in SectionA.4, "Problems Switching Over to a Standby Database" on

PageA-4 to identify and terminate active user or SQL sessions that might prevent a

Switchover from being processed. If, after performing these steps, the SWITCHOVER_

STATUS column still displays SESSIONS ACTIVE, you can successfully perform. A

Switchover by appending the WITH SESSION SHUTDOWN clause to the ALTER

DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY statement

Described in Step 2.

See Oracle Database Reference for information about other valid values for the

SWITCHOVER_STATUS column of the V$DATABASE view.

Step 2: perform a role switch on the master library to the slave role

SQL > ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY

After this statement completes, the primary database is converted into a standby

Database. The current control file is backed up to the current SQL session trace file

Before the switchover. This makes it possible to reconstruct a current control file, if

Necessary.

Step 3: shut down and restart the previous main library instance

SQL > SHUTDOWN IMMEDIATE

SQL > STARTUP MOUNT

At this point in the switchover process, both databases are configured as standby

Databases.

Step 4: view the switching status of the slave database in the V$DATABASE view of the slave database

SQL > SELECT SWITCHOVER_STATUS FROM V$DATABASE

SWITCHOVER_STATUS

-

TO_PRIMARY

1 row selected

If the value in the SWITCHOVER_STATUS column is SESSIONS ACTIVE, perform. The

Steps described in SectionA.4, "Problems Switching Over to a Standby Database" on

PageA-4 to identify and terminate active user or SQL sessions that might prevent a

Switchover from being processed. If, after performing these steps, the SWITCHOVER_

STATUS column still displays SESSIONS ACTIVE, you can proceed to Step 5, and

Append the WITH SESSION SHUTDOWN clause to the switchover statement. See Oracle

Database Reference for information about other valid values for the SWITCHOVER_

STATUS column of the V$DATABASE view

Step 5: switch the standby library to the primary library role

You can switch a physical standby database from the standby role to the primary role

When the standby database instance is either mounted in Redo Apply mode or open

For read-only access. It must be in one of these modes so that the primary database

Switchover request can be coordinated. After the standby database is in an appropriate

Mode, issue the following SQL statement on the physical standby database that you

Want to change to the primary role:

SQL > ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY

Step 6: complete the switch from standby to master

1. If the standby library is not open in read-only mode, execute the following statement directly to open to the new main library.

SQL > ALTER DATABASE OPEN

two。 If the standby library is open in read-only mode, close the data and then restart.

SQL > SHUTDOWN IMMEDIATE

SQL > STARTUP

Step 7: if necessary, restart the redo log application service on the new repository

For the new physical standby database and for each other physical or logical standby

Database in the Data Guard configuration, if log apply services were not previously

Configured to continue operating through a switchover, use an appropriate command

To restart log apply services. See Chapter6, "Log Apply Services" for more information

About how to configure and start log apply services.

SQL > alter database recover managed standby database disconnect from session

(note: you can check the status of the redo log of the application in the slave database through select message from vaildataguardstatus.)

Step 8: start sending redo data to the standby database

Issue the following statement on the new primary database:

SQL > ALTER SYSTEM SWITCH LOGFILE

NOT ALLOWED

The current database is not a primary database with a standby database

PREPARING DICTIONARY

The logical standby database is sending its redo data to a primary database and other standby databases in preparation for switching

PREPARING SWITCHOVER

When accepting redo data for switching, the logical standby configuration uses it

RECOVERY NEEDED

The standby database has not received a handover request

SESSIONS ACTIVE

There are active SQL sessions in the primary database; these sessions must be disconnected before continuing execution

SWITCHOVER PENDING

Suitable for standby databases that have received a primary database switching request but have not yet processed the request

SWITCHOVER LATENT

The switch was not completed and returned to the primary database

TO LOGICAL STANDBY

The primary database has received a complete dictionary from the logical standby database

TO PRIMARY

The standby database can be converted to the primary database

TO STANDBY

The primary database can be converted to a standby database

The meaning of v$database Switchover_ status value

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Servers

Wechat

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

12
Report