主库操作:
1.检查是否支持SWITCHOVER操作:
SQL> select SWITCHOVER_STATUS from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE --状态是ACTIVE或to standby 都是可以的。
2.将主库转换为从库的角色:
SQL> alter database commit to switchover to physical standby;
Database altered.
3.关闭主库然后启动到MOUNT状态,这时候原来的主库变成了从库。
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1279120 bytes
Variable Size 100666224 bytes
Database Buffers 62914560 bytes
Redo Buffers 2912256 bytes
Database mounted.
SQL>
从库操作:
4.检查从库是否支持switchover操作:
SQL> select SWITCHOVER_STATUS from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY --OK,支持
5.原来的从库转换到主库:
SQL> alter database commit to switchover to primary;
Database altered.
6.打开主库:
SQL> alter database open;
Database altered.
7.验证:
SQL> alter system switch logfile;
System altered.
--观察从库的告警日志发现并没有应用主库的归档日志。原因是从库的日志应用还没有打开,在从库打开日志应用:
SQL> alter database recover managed standby database disconnect from session;
Database altered.
--数据保护模式是MAXIMUM AVAILABILITY,切回来的操作也是一样的。其它数据保护模式的切换操作也大体相同。
阅读(793) | 评论(0) | 转发(0) |