①查看数据库模式:
主库:
SQL> select name,protection_mode,database_role,switchover_status from v$database;
NAME PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS
--------- -------------------- ---------------- --------------------
ORA11GR2 MAXIMUM PERFORMANCE PRIMARY TO STANDBY
备库:
SQL> select name,protection_mode,database_role,switchover_status from v$database;
NAME PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS
--------- -------------------- ---------------- --------------------
ORA11GR2 MAXIMUM PERFORMANCE PHYSICAL STANDBY NOT ALLOWED
②将主库起到mount状态:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 608177272 bytes
Database Buffers 213909504 bytes
Redo Buffers 6586368 bytes
Database mounted.
③修改参数:
SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=SBDB20 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SBDB';
System altered.
SQL> alter database set standby database to maximize availability;
Database altered.
④将主库起到open状态验证:
SQL> alter database open;
Database altered.
SQL> select name,protection_mode,database_role,switchover_status from v$database;
NAME PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS
--------- -------------------- ---------------- --------------------
ORA11GR2 MAXIMUM AVAILABILITY PRIMARY FAILED DESTINATION