oracle11g dataguard切换

1.查看主库是否满足切换条件


SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
----------------------------------------
TO STANDBY

有时候会显示 SESSION ACTIVE,这表示当前还有活动的会话连接。

2.执行下面的命令切换



SQL> alter database commit to switchover to physical standby;
Database altered.


如果第一步切换条件查看显示 SESSION ACTIVE,那么在这里使用下面命令


SQL> alter database commit to switchover to physical standby WITH SESSION SHUTDOWN;

 3.关闭数据库重启到 mount


SQL> shutdown immediate;
ORA-01012: not logged on
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@oraclerac2 ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 1 17:45:33 2018
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 2.1379E+10 bytes
Fixed Size    2262656 bytes
Variable Size 2885683584 bytes
Database Buffers 1.8455E+10 bytes
Redo Buffers   36073472 bytes
Database mounted.


 4.用 Read Only 模式打开


SQL> alter database open read only;
Database altered.


 5.启动 Redo 应用模式



SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
Database altered.

6.切换后查看角色


SQL> select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- ----------------------------------------
PHYSICAL STANDBY TO PRIMARY

7.以上操作都是原来的主库完成的,下面的操作在原来的备库完成


8.查看 Standby Database 是否满足切换条件


SQL> select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- ----------------------------------------
PHYSICAL STANDBY TO PRIMARY

9.执行下面命令进行切换


SQL> alter database commit to switchover to primary;
Database altered.

10.打开数据库


SQL> alter database open;
Database altered.

11.切换后查看角色


SQL> select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
-------------------------------- ----------------------------------------
PRIMARY  TO STANDBY


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20893244/viewspace-2168909/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/20893244/viewspace-2168909/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值