文档课题:oracle物理备库与快照备库相互切换测试.
数据库:oracle 11.2.0.4
系统:centos 7.9
1、物理备库切换快照备库
SYS@orcldg> alter database recover managed standby database cancel;

Database altered.

SYS@orcldg> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcldg> STARTUP MOUNT;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2253784 bytes
Variable Size            1241517096 bytes
Database Buffers          402653184 bytes
Redo Buffers                7094272 bytes
Database mounted.
SYS@orcldg> SHOW PARAMETER db_recovery_file_dest;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_
                                                 area
db_recovery_file_dest_size           big integer 4182M
SYS@orcldg> ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;

Database altered.

SYS@orcldg> ALTER DATABASE OPEN;

Database altered.

SYS@orcldg> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SYS@orcldg> select database_role from v$database;

DATABASE_ROLE
----------------
SNAPSHOT STANDBY

2、快照备库切换物理备库
SYS@orcldg> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcldg> startup mount;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2253784 bytes
Variable Size            1241517096 bytes
Database Buffers          402653184 bytes
Redo Buffers                7094272 bytes
Database mounted.
SYS@orcldg> alter database convert to physical standby;

Database altered.

SYS@orcldg> select open_mode from v$database;
select open_mode from v$database
                      *
ERROR at line 1:
ORA-01507: database not mounted


SYS@orcldg> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SYS@orcldg> startup;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2253784 bytes
Variable Size            1241517096 bytes
Database Buffers          402653184 bytes
Redo Buffers                7094272 bytes
Database mounted.
Database opened.
SYS@orcldg> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SYS@orcldg> select open_mode,database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY

SYS@orcldg> select process,status from v$managed_standby;

PROCESS   STATUS
--------- ------------
ARCH      CONNECTED
ARCH      CONNECTED
ARCH      CLOSING
ARCH      CONNECTED
RFS       IDLE
RFS       IDLE
RFS       IDLE
MRP0      APPLYING_LOG

8 rows selected.


参考文档:https://www.cnblogs.com/NextAction/p/7366667.htm