検索
ホームページデータベースmysql チュートリアルOracle 11g Data Guard Role Transitions: Switchover

Role Transitions Involving Physical Standby Databases A database operates in one of the following mutuallyexclusive roles: primary or standby . Data Guard enables you to change theseroles dynamically by issuing the SQL statements described

Role Transitions Involving Physical Standby Databases

 

A database operates in one of the following mutuallyexclusive roles:primary or standby. Data Guard enables you to change theseroles dynamically by issuing the SQL statements described in this chapter, orby using either of the Data Guard broker's interfaces. Oracle Data Guardsupports the following role transitions:

 

  • Switchover
    Allows the primary database to switch roles with one of its standby databases. There is no data loss during a switchover. After a switchover, each database continues to participate in the Data Guard configuration with its new role.

 

  • Failover
    Changes a standby database to the primary role in response to a primary database failure. If the primary database was not operating in either maximum protection mode or maximum availability mode before the failure, some data loss may occur. If Flashback Database is enabled on the primary database, it can be reinstated as a standby for the new primary database once the reason for the failure is corrected.

 

 

Performing aSwitchover to a Physical Standby Database

 

Step1   Verify that the primary database can be switched to thestandby role.

Query the SWITCHOVER_STATUS column of the V$DATABASEview on the primary database.For example:

 

SQL>select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,DB_UNIQUE_NAME,SWITCHOVER_STATUSfrom v$database;

 

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    DB_UNIQUE_NAME      SWITCHOVER_STATUS

---------------------------------------- ---------------- -------------------- --------------------

READWRITE           MAXIMUM PROTECTION   PRIMARY          prod                 TO STANDBY

 

A value of TO STANDBY or SESSIONS ACTIVE indicatesthat the primary database can be switched to the standby role. If neither ofthese values is returned, a switchover is not possible because redo transportis either misconfigured or is not functioning properly.

 

Step2   Initiate the switchover on the primary database.

 

Issue the following SQL statement on the primarydatabase to switch it to the standby role:

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

 

This statement converts the primary database into aphysical standby database. The current control file is backed up to the currentSQL session trace file before the switchover. This makes it possible toreconstruct a current control file, if necessary.

 

The WITH SESSION SHUTDOWN clause can be omitted fromthe switchover statement if the query performed in the previous step returned avalue of TO STANDBY.

 

Step3   Shut down and then mount the former primary database.

SQL>startup mount;

At this point in the switchover process, the originalprimary database is a physical standby database

 

Step4   Verify that the switchover target is ready to be switched tothe primary role.

Query the SWITCHOVER_STATUS column of the V$DATABASEview on the standby database.

 

SQL>set linesize 200

SQL>select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,DB_UNIQUE_NAME,SWITCHOVER_STATUSfrom v$database;

 

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    DB_UNIQUE_NAME                 SWITCHOVER_STATUS

---------------------------------------- ---------------- --------------------------------------------------

READONLY WITH APPLY MAXIMUM PROTECTION  PHYSICAL STANDBY standby                        TO PRIMARY

 

 

A value of TO PRIMARY or SESSIONS ACTIVE indicatesthat the standby database is ready to be switched to the primary role. Ifneither of these values is returned, verify that Redo Apply is active and thatredo transport is configured and working properly. Continue to query thiscolumn until the value returned is either TO PRIMARY or SESSIONS ACTIVE.

 

Step5   Switch the target physical standby database role to theprimary role.

Issue the following SQL statement on the targetphysical standby database:

SQL>alter database commit to switchover to primary with session shutdown;

SQL>select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,DB_UNIQUE_NAME,SWITCHOVER_STATUSfrom v$database;

 

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    DB_UNIQUE_NAME                 SWITCHOVER_STATUS

---------------------------------------- ---------------- --------------------------------------------------

MOUNTED              MAXIMUM PROTECTION   PRIMARY          standby                        NOT ALLOWED

 

Step6   Open the new primary database.

 

SQL>alter database open;

SQL>select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,DB_UNIQUE_NAME,SWITCHOVER_STATUSfrom v$database;

 

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    DB_UNIQUE_NAME                 SWITCHOVER_STATUS

---------------------------------------- ---------------- --------------------------------------------------

READWRITE           MAXIMUM PROTECTION   PRIMARY          standby                        TO STANDBY

 

Step7   Start Redo Apply on the new physical standby database.

SQL>select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,DB_UNIQUE_NAME,SWITCHOVER_STATUSfrom v$database;

 

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    DB_UNIQUE_NAME                 SWITCHOVER_STATUS

---------------------------------------- ---------------- --------------------------------------------------

MOUNTED              MAXIMUM PROTECTION   PHYSICAL STANDBY prod                           RECOVERY NEEDED

 

SQL>alter database open read only;

SQL>select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,DB_UNIQUE_NAME,SWITCHOVER_STATUSfrom v$database;

 

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    DB_UNIQUE_NAME                 SWITCHOVER_STATUS

---------------------------------------- ---------------- --------------------------------------------------

READONLY            MAXIMUM PROTECTION   PHYSICAL STANDBY prod                           RECOVERY NEEDED

 

SQL>alter database recover managed standby database using current logfiledisconnect from session;

 

 

Step8   Restart Redo Apply if it has stopped at any of the otherphysical standby databases in your Data Guard configuration.

 

SQL>alter database recover managed standby database using current logfiledisconnect from session;

 

On new primary:

SQL>SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY THREAD#;

 

MAX(SEQUENCE#)    THREAD#

------------------------

            82          1

SQL>SELECT  DESTINATION, STATUS,ARCHIVED_THREAD#, ARCHIVED_SEQ# FROM V$ARCHIVE_DEST_STATUS WHERE  STATUS 'DEFERRED'  AND STATUS 'INACTIVE';

 

DESTINATION                    STATUS    ARCHIVED_THREAD# ARCHIVED_SEQ#

--------------------------------------- ---------------- -------------

/u01/arch1/STANDBY             VALID                    1            82

prod                           VALID                    1            82


作者:xiangsir

QQ:444367417

MSN:xiangsir@hotmail.com


声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
什么是oracle asm什么是oracle asmApr 18, 2022 pm 04:16 PM

oracle asm指的是“自动存储管理”,是一种卷管理器,可自动管理磁盘组并提供有效的数据冗余功能;它是做为单独的Oracle实例实施和部署。asm的优势:1、配置简单、可最大化推动数据库合并的存储资源利用;2、支持BIGFILE文件等。

oracle怎么查询所有索引oracle怎么查询所有索引May 13, 2022 pm 05:23 PM

方法:1、利用“select*from user_indexes where table_name=表名”语句查询表中索引;2、利用“select*from all_indexes where table_name=表名”语句查询所有索引。

Oracle怎么查询端口号Oracle怎么查询端口号May 13, 2022 am 10:10 AM

在Oracle中,可利用lsnrctl命令查询端口号,该命令是Oracle的监听命令;在启动、关闭或重启oracle监听器之前可使用该命令检查oracle监听器的状态,语法为“lsnrctl status”,结果PORT后的内容就是端口号。

oracle全角怎么转半角oracle全角怎么转半角May 13, 2022 pm 03:21 PM

在oracle中,可以利用“TO_SINGLE_BYTE(String)”将全角转换为半角;“TO_SINGLE_BYTE”函数可以将参数中所有多字节字符都替换为等价的单字节字符,只有当数据库字符集同时包含多字节和单字节字符的时候有效。

oracle怎么删除sequenceoracle怎么删除sequenceMay 13, 2022 pm 03:35 PM

在oracle中,可以利用“drop sequence sequence名”来删除sequence;sequence是自动增加数字序列的意思,也就是序列号,序列号自动增加不能重置,因此需要利用drop sequence语句来删除序列。

oracle怎么查询数据类型oracle怎么查询数据类型May 13, 2022 pm 04:19 PM

在oracle中,可以利用“select ... From all_tab_columns where table_name=upper('表名') AND owner=upper('数据库登录用户名');”语句查询数据库表的数据类型。

oracle查询怎么不区分大小写oracle查询怎么不区分大小写May 10, 2022 pm 05:45 PM

方法:1、利用“LOWER(字段值)”将字段转为小写,或者利用“UPPER(字段值)”将字段转为大写;2、利用“REGEXP_LIKE(字符串,正则表达式,'i')”,当参数设置为“i”时,说明进行匹配不区分大小写。

Oracle怎么修改sessionOracle怎么修改sessionMay 13, 2022 pm 05:06 PM

方法:1、利用“alter system set sessions=修改后的数值 scope=spfile”语句修改session参数;2、修改参数之后利用“shutdown immediate – startup”语句重启服务器即可生效。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

EditPlus 中国語クラック版

EditPlus 中国語クラック版

サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません

SublimeText3 英語版

SublimeText3 英語版

推奨: Win バージョン、コードプロンプトをサポート!

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強力な PHP 統合開発環境