Oracle 10g DataGuard 级别切换
环境:
OS: rhel 6.3_64bit
DB: Oracle 10gR2
级别切换过程:
主库
SQL> select protection_mode,protection_level from v$database;
PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
SQL> show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2 string SERVICE=stdy LGWR ASYNC VALI
D_FOR=(ONLINE_LOGFILES,PRIMARY
_ROLE) DB_UNIQUE_NAME=stdy
SQL> alter system set log_archive_dest_2='SERVICE=stdy OPTIONAL LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stdy';
System altered.
:maximize 后可跟{PROTECTION | AVAILABILITY | PERFORMANCE},分别对应最大保护,最高可用性及最高性能。
Minimum Requirements for Maximum Protection Mode
Redo Archival Process LGWR
Network Transmission Mode SYNC
Disk Write Option AFFIRM
Standby Redo Logs? Yes
Standby Database Type Physical Only
alter system set log_archive_dest_2='SERVICE=stdy OPTIONAL LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stdy';
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 213909504 bytes
Fixed Size 2095152 bytes
Variable Size 88082384 bytes
Database Buffers 117440512 bytes
Redo Buffers 6291456 bytes
Database mounted.
SQL> alter database set standby database to maximize Protection;
Database altered.
sys@ORA> select protection_mode,protection_level from v$database;
PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM PROTECTION UNPROTECTED
SQL> alter database open;
Database altered.
SQL> select protection_mode,protection_level from v$database;
PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM PROTECTION MAXIMUM PROTECTION
Minimum Requirements for Maximum Availability Mode
Redo Archival Process LGWR
Network Transmission Mode SYNC
Disk Write Option AFFIRM
Standby Redo Logs? Required for physical standby databases only. Standby redo logs are not supported for logical standby databases.
Standby Database Type Physical or Logical
alter system set log_archive_dest_2='SERVICE=stdy OPTIONAL LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stdy';
alter database set standby database to maximize Availability;
Minimum Requirements for Maximum Performance Mode
Redo Archival Process LGWR or ARCH
Network Transmission Mode ASYNC when using LGWR process. Not applicable when using the ARCH process.
Disk Write Option NOAFFIRM
Standby Redo Logs? Required for physical standby databases using the LGWR process.
Standby Database Type Physical or Logical
alter system set log_archive_dest_2='SERVICE=stdy OPTIONAL LGWR ASYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stdy';
alter database set standby database to maximize Performance;
SQL> alter database set standby database to maximize availability;
Database altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 213909504 bytes
Fixed Size 2095152 bytes
Variable Size 88082384 bytes
Database Buffers 117440512 bytes
Redo Buffers 6291456 bytes
Database mounted.
Database opened.
SQL> select protection_mode,protection_level from v$database;
PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY
备库
停掉备库后,主库的状态会变成待同步的状态
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> select protection_mode,protection_level from v$database;
PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM AVAILABILITY RESYNCHRONIZATION
推荐阅读: