Oracle的data guard创建完成后,检查v$database的protection_mode和protection_level的值。如protection_mode值是MAXIMUM AVAILABILITY,那么protection_level值也应该是这个值。如果不是这个值,而是RESYNCHRONIZATION。这表示data guard的日志同步是不正常的。
在备库的alert.log中也可以看到这样信息:"Primary database is in MAXIMUM PERFORMANCE mode"。表示主库其实是最大性能模式,而不是预先设置的最大可用模式。
Oracle的data guard在主库设置为最大可用模式不能实现时,自动降级为最大性能模式。这样的结果使得日志同步不再实时。
检查数据字典视图v$database
SQL> r
1* select protection_mode,protection_level from v$database
PROTECTION_MODE PROTECTION_LEVEL
-------------------- --------------------
MAXIMUM AVAILABILITY RESYNCHRONIZATION
检查数据库初始化参数log_archive_dest*
SQL> show parameter log_archive_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1 string LOCATION=+VG2/
log_archive_dest_2 string service=oxdb_standby lgwr asyn
c affirm valid_for=(online_lo
gfiles,primary_role) db_unique
_name=oxdg
分析
Oracle的data guard有三种保护模式,分别为最大保护模式、最大可用模式、最大性能模式。
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
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
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