oracle11g ADG主备切换

oracle11g ADG主备切换

1、主库

SQL> select name,open_mode,switchover_status from v$database;

NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
PROD1 READ WRITE TO STANDBY

SQL> alter system switch logfile;

System altered.

SQL> alter system archive log current;

System altered.

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

Database altered.

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 849530880 bytes
Fixed Size 1348244 bytes
Variable Size 511708524 bytes
Database Buffers 331350016 bytes
Redo Buffers 5124096 bytes
Database mounted.
SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
RECOVERY NEEDED

SQL> alter database open;

Database altered.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO PRIMARY

 

2、备库

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

Database altered.

SQL> alter database open;

Database altered.

SQL> select name,open_mode,switchover_status from v$database;

NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
PROD1 READ WRITE TO STANDBY

 

3、新备库(原主库)启用实时日志应用

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

 

Database altered.

 

SQL> select name,open_mode,switchover_status from v$database;

NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
RMANPRI READ ONLY RECOVERY NEEDED

 

4、新主库切换日志

SQL> alter system switch logfile;

System altered.

 

5、分别查看当前主备库切换后当前日志序列号

主库:

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/archive
Oldest online log sequence 52
Next log sequence to archive 54
Current log sequence 54

备库:

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/archive
Oldest online log sequence 53
Next log sequence to archive 0
Current log sequence 54

 

6、查看当前主备库状态

主库:

SQL> select name,open_mode,switchover_status from v$database;

NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
RMANPRI READ WRITE TO STANDBY

 

备库:

SQL> select name,open_mode,switchover_status from v$database;

NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
RMANPRI READ ONLY WITH APPLY NOT ALLOWED

 

参考链接:

https://blog.csdn.net/kadwf123/article/details/83092607

http://blog.chinaunix.net/uid-26313110-id-5748048.html

 

posted @ 2019-09-21 23:27  orcl  阅读(2672)  评论(0编辑  收藏  举报