NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u01/app/oracle/oradata/orcl15
1/control01.ctl, /u01/app/orac
le/fast_recovery_area/orcl150/
control02.ctl
control_management_pack_access string DIAGNOSTIC+TUNING
现在采用switchover的方式将备库其切换为主库:
主库ORCL150切换为备库
SQL> show parameter unique_name
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
db_unique_name string ORCL150
SQL> col name for a10
SQL> col log_mode for a15
SQL> col open_mode for a15
SQL> col database_role for a20
SQL> col switchover_status for a20
SQL> col db_unique_name for a15
SQL> select name,log_mode,open_mode,database_role,switchover_status,db_unique_name from v$database
备库ORCL151切换为主库
SQL> col name for a10
SQL> col log_mode for a15
SQL> col open_mode for a20
SQL> col database_role for a20
SQL> col switchover_status for a20
SQL> col db_unique_name for a15
SQL> select name,log_mode,open_mode,database_role,switchover_status,db_unique_name from v$database
NAME LOG_MODE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS DB_UNIQUE_NAME
---------- --------------- -------------------- -------------------- -------------------- ---------------
ORCL150 ARCHIVELOG READ ONLY WITH APPLY PHYSICAL STANDBY TO PRIMARY ORCL151
SQL> alter database commit to switchover to primary with session shutdown;
Database altered.
SQL> alter database open;
Database altered.
SQL> select name,log_mode,open_mode,database_role,switchover_status,db_unique_name from v$database;
NAME LOG_MODE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS DB_UNIQUE_NAME
---------- --------------- -------------------- -------------------- -------------------- ---------------
ORCL150 ARCHIVELOG READ WRITE PRIMARY RESOLVABLE GAP ORCL151
现备库ORCL150打开只读实时应用模式
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
SQL> select name,log_mode,open_mode,database_role,switchover_status,db_unique_name from v$database;
NAME LOG_MODE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS DB_UNIQUE_NAME
---------- --------------- -------------------- -------------------- -------------------- ---------------
ORCL150 ARCHIVELOG READ ONLY WITH APPLY PHYSICAL STANDBY NOT ALLOWED ORCL150
现在给原备库ORCL151增加一个控制文件:
SQL> alter system set control_files='/u01/app/oracle/oradata/orcl151/control01.ctl','/u01/app/oracle/fast_recovery_area/orcl150/control02.ctl','/u01/app/oracle/fast_recovery_area/orcl150/control03.ctl' scope=spfile;
Total System Global Area 3206836224 bytes
Fixed Size 2257520 bytes
Variable Size 1811942800 bytes
Database Buffers 1375731712 bytes
Redo Buffers 16904192 bytes
Database mounted.
Database opened.
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u01/app/oracle/oradata/orcl15
1/control01.ctl, /u01/app/orac
le/fast_recovery_area/orcl150/
control02.ctl, /u01/app/oracle
/fast_recovery_area/orcl150/co
ntrol03.ctl
control_management_pack_access string DIAGNOSTIC+TUNING