首页 数据库 mysql教程 Oracle 11g Data Guard Role Transitions: Switchover

Oracle 11g Data Guard Role Transitions: Switchover

Jun 07, 2016 pm 03:02 PM
data guard oracle role

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

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
2 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
4 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
4 周前 By 尊渡假赌尊渡假赌尊渡假赌

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

oracle数据库日志会保存多久 oracle数据库日志会保存多久 May 10, 2024 am 03:27 AM

Oracle 数据库日志的保留期限取决于日志类型和配置,包括:重做日志:由 "LOG_ARCHIVE_DEST" 参数配置的最大大小决定。归档重做日志:由 "DB_RECOVERY_FILE_DEST_SIZE" 参数配置的最大大小决定。在线重做日志:不归档,在数据库重启时丢失,保留期限与实例运行时间一致。审计日志:由 "AUDIT_TRAIL" 参数配置,默认保留 30 天。

oracle中计算两个日期之间天数的函数 oracle中计算两个日期之间天数的函数 May 08, 2024 pm 07:45 PM

Oracle 中计算两个日期之间天数的函数是 DATEDIFF()。具体用法如下:指定时间间隔单位:interval(如 day、month、year)指定两个日期值:date1 和 date2DATEDIFF(interval, date1, date2) 返回天数差

oracle数据库启动步骤顺序为 oracle数据库启动步骤顺序为 May 10, 2024 am 01:48 AM

Oracle 数据库启动顺序为:1. 检查前置条件;2. 启动监听器;3. 启动数据库实例;4. 等待数据库打开;5. 连接到数据库;6. 验证数据库状态;7. 启用服务(如果需要);8. 测试连接。

oracle中interval的用法 oracle中interval的用法 May 08, 2024 pm 07:54 PM

Oracle 中的 INTERVAL 数据类型用于表示时间间隔,语法为 INTERVAL <精度> <单位>,可使用加减乘除运算操作 INTERVAL,适用于存储时间数据、计算日期差值等场景。

oracle中某个字符出现的次数怎么看出来 oracle中某个字符出现的次数怎么看出来 May 09, 2024 pm 09:33 PM

要在 Oracle 中查找字符出现的次数,执行以下步骤:获取字符串的总长度;获取字符所在子字符串的长度;计算字符出现的次数:用总长度减去子字符串长度。

oracle数据库服务器硬件配置要求 oracle数据库服务器硬件配置要求 May 10, 2024 am 04:00 AM

Oracle 数据库服务器硬件配置要求:处理器:多核,主频至少 2.5 GHz,大型数据库建议 32 核以上。内存:小型数据库至少 8GB,中等规模 16-64GB,大型数据库或高负载工作负载高达 512GB 或更多。存储:SSD 或 NVMe 磁盘,RAID 阵列提高冗余和性能。网络:高速网络(10GbE 或更高),专用网卡,低延迟网络。其他:稳定电源、冗余组件、兼容操作系统和软件、散热和冷却系统。

oracle需要多少内存 oracle需要多少内存 May 10, 2024 am 04:12 AM

Oracle 所需内存量取决于数据库大小、活动水平和所需性能水平:用于存储数据缓冲区、索引缓冲区、执行 SQL 语句和管理数据字典缓存。具体数量受数据库大小、活动水平和所需性能水平影响。最佳实践包括设置适当的 SGA 大小、调整 SGA 组件大小、使用 AMM 和监控内存使用情况。

oracle中替换字符串的方法 oracle中替换字符串的方法 May 08, 2024 pm 07:24 PM

Oracle 中替换字符串的方法是使用 REPLACE 函数,该函数的语法为:REPLACE(string, search_string, replace_string)。使用步骤:1. 识别要替换的子字符串;2. 确定替换子字符串的新字符串;3. 使用 REPLACE 函数进行替换。高级用法包括:多个替换、大小写敏感、特殊字符替换等。

See all articles