oracle物理dg角色转换

Data Guard Concepts and Administration

8.2 Role Transitions Involving Physical Standby Databases

The following sections describe how to perform a switchover or failover to a physical standby database:
接下来的章节介绍怎样switchover或是failover到物理备库

8.2.1 Performing a Switchover to a Physical Standby Database

This section describes how to perform a switchover to a physical standby database.A switchover is initiated on the primary database and is completed on the target standby database.
本节介绍怎样switchover到物理备库。switchover在主库上发起,在目标物理备库上结束(先将主库转成备库,才能将备库转成主库,一个dg中不能同时有两个主库)。


Step 1   Verify that the primary database can be switched to the standby role.
  验证主库可以被转成物理备库

Query the SWITCHOVER_STATUS column of the V$DATABASE view on the primary database.For example:
在主库上查询视图V$DATABASESWITCHOVER_STATUS列。如下:

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

SWITCHOVER_STATUS 
 ----------------- 
 TO STANDBY 
 1 row selected 

A value of TO STANDBY or SESSIONS ACTIVE indicates that the primary database can be switched to the standby role. If neither of these values is returned, a switchover is not possible because redo transport is either misconfigured or is not functioning properly. See Chapter 6 for information about configuring and monitoring redo transport.
如果查询的结果是TO STANDBY或是SESSIONS ACTIVE,则表明主库可以被转成物理备库。如果返回的不是这两个会下,则switchover不能进行,原因可能是 日志传输redo transport没有正确配置或是运行不正常。查看第6章中获取关于配置及监控日志传输的信息。

Step 2   Initiate the switchover on the primary database.  主库上发起switchover

Issue the following SQL statement on the primary database to switch it to the standby role:
在主库上执行以下sql语句,将主库转成备库角色:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH -
> SESSION SHUTDOWN;

This statement converts the primary database into a physical 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.
此语句将主库转成物理备库。在switchover之前,当前控制文件会被备份到trace file中。如果需要的话,可以通过trace file中的备份重建控当前控制文件。

Note:

In Oracle Database 11 g release 2 (11.2.0.4) and later, it is not necessary to issue the SHUTDOWN ABORT statement in this step because the database instance is shut down by default when the ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN statement is issued.
11.2.0.4及以后版本,在这一步中没有必要再执行SHUTDOWN   ABORT,因为在执行ALTER   DATABASE   COMMIT   TO   SWITCHOVER   TO   PHYSICAL   STANDBY   WITH   SESSION   SHUTDOWN时,数据库会被自动关闭。
Step 4   Verify that the switchover target is ready to be switched to the primary role.  验证目标备库可以被转成主库

Query the SWITCHOVER_STATUS column of the V$DATABASE view on the standby database.

For example:
在备库上查询视图V$DATABASESWITCHOVER_STATUS列。如下:

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

SWITCHOVER_STATUS 
----------------- 
TO_PRIMARY 
1 row selected

A value of TO PRIMARY or SESSIONS ACTIVE indicates that the standby database is ready to be switched to the primary role. If neither of these values is returned, verify that Redo Apply is active and that redo transport is configured and working properly. Continue to query this column until the value returned is either TO PRIMARY orSESSIONS ACTIVE.
如果查询的结果是TO PRIMARYSESSIONS ACTIVE,则表明此物理备库可以被转成主库。如果返回值不是这两个值,检查Redo Apply是不是active,并且redo transport是不是正确配置及工作正常。继续查询此列,直到返回值是TO PRIMARY或是SESSIONS ACTIVE


Step 5   Switch the target physical standby database role to the primary role.  将目标物理备库转成主库

Issue the following SQL statement on the target physical standby database:
在目标备库上执行以下sql语句:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;

Note:

The WITH SESSION SHUTDOWN clause can be omitted from the switchover statement if the query of the SWITCHOVER_STATUS column performed in the previous step returned a value of TO PRIMARY.
如果上一步查询中SWITCHOVER_STATUS的返回值是TO PRIMARY,则WITH SESSION SHUTDOWN 子句可以被省略。
Step 9   Open the new primary database.  打开新主库
SQL> ALTER DATABASE OPEN;
Step 10   Back up the new primary database.  备份新主库

Oracle recommends that a full backup be taken of the new primary database.
oracle建议新主库做一个全库备份。


Step 11   Restart Redo Apply if it has stopped at any of the other physical standby databases in your Data Guard configuration.  dg中关闭Redo Apply的物理备库需要重新启动Redo Apply

For example:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE -
> DISCONNECT FROM SESSION;
Step 12   Optionally, restore the failed primary database.  可选操作,恢复坏掉的主库

After a failover, the original primary database can be converted into a physical standby database of the new primary database using the method described in Section 13.2or Section 13.7, or it can be re-created as a physical standby database from a backup of the new primary database using the method described in Section 3.2.
failover之后,原来的主库可以被转成新主库的物理备库,或是可以通过新主库的备份重新创建一个物理备库。

Once the original primary database is running in the standby role, a switchover can be performed to restore it to the primary role.
一旦原主库成为了新主库的物理备库,可以通过switchover再将它转成主库。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值