|
oracle 12C中引入了FAR SYNC的概念,FAR SYNC的作用其实就是一个日志中转站,架构如下:
主库---(传输日志)--->FAR SYNC---(传输日志)--->备库
那如果关闭FAR SYNC实例,主库如何将日志传输到备库呢?测试如下:
1、关闭far sync,查看主库alter日志,可以看到log_archive_dest_3变为valid
LGWR: Destination LOG_ARCHIVE_DEST_2 not using standby redo logfiles; cannot reconnect
2017-09-01T11:22:22.934465+08:00
Errors in file /u01/app/oracle/diag/rdbms/sztech/sztech1/trace/sztech1_lgwr_4282.trc:
ORA-01089: immediate shutdown or close in progress - no operations are permitted
Error 1089 for archive log file 2 to 'sztechfs'
2017-09-01T11:22:24.828896+08:00
LGWR: Failed to archive log 2 thread 1 sequence 224 (1089)
LGWR: Error 1041 disconnecting from destination LOG_ARCHIVE_DEST_2 standby host 'sztechfs'
2017-09-01T11:22:24.872523+08:00
Thread 1 advanced to log sequence 225 (LGWR switch)
Current log# 1 seq# 225 mem# 0: +DGDATA/SZTECH/ONLINELOG/group_1.306.949664067
2017-09-01T11:22:25.331974+08:00
Archived Log entry 486 added for T-1.S-224 ID 0xc177e9bb LAD:1
2017-09-01T11:22:25.850371+08:00
ARC2: Standby redo logfile selected for thread 1 sequence 224 for destination LOG_ARCHIVE_DEST_3
2017-09-01T11:22:26.688190+08:00
ALTER SYSTEM SET log_archive_dest_state_3='ENABLE' SCOPE=MEMORY SID='*';
2017-09-01T11:22:27.880311+08:00
Thread 1 cannot allocate new log, sequence 226
Checkpoint not complete
2、查看log_archive_dest参数
SQL>select dest_name,status,error from v$archive_dest
DEST_NAME STATUS ERROR
---------------------------------------- ------------------ -----------------------------------------------------------------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 ALTERNATE ORA-01089: immediate shutdown or close in progress - no
operations are permitted
LOG_ARCHIVE_DEST_3 VALID
LOG_ARCHIVE_DEST_4 INACTIVE
LOG_ARCHIVE_DEST_5 INACTIVE
LOG_ARCHIVE_DEST_6 INACTIVE
LOG_ARCHIVE_DEST_7 INACTIVE
LOG_ARCHIVE_DEST_8 INACTIVE
LOG_ARCHIVE_DEST_9 INACTIVE
DEST_NAME STATUS ERROR
---------------------------------------- ------------------ -----------------------------------------------------------------
LOG_ARCHIVE_DEST_10 INACTIVE
LOG_ARCHIVE_DEST_11 INACTIVE
LOG_ARCHIVE_DEST_12 INACTIVE
LOG_ARCHIVE_DEST_13 INACTIVE
LOG_ARCHIVE_DEST_14 INACTIVE
LOG_ARCHIVE_DEST_15 INACTIVE
LOG_ARCHIVE_DEST_16 INACTIVE
LOG_ARCHIVE_DEST_17 INACTIVE
LOG_ARCHIVE_DEST_18 INACTIVE
LOG_ARCHIVE_DEST_19 INACTIVE
LOG_ARCHIVE_DEST_20 INACTIVE
DEST_NAME STATUS ERROR
---------------------------------------- ------------------ -----------------------------------------------------------------
LOG_ARCHIVE_DEST_21 INACTIVE
LOG_ARCHIVE_DEST_22 INACTIVE
LOG_ARCHIVE_DEST_23 INACTIVE
LOG_ARCHIVE_DEST_24 INACTIVE
LOG_ARCHIVE_DEST_25 INACTIVE
LOG_ARCHIVE_DEST_26 INACTIVE
LOG_ARCHIVE_DEST_27 INACTIVE
LOG_ARCHIVE_DEST_28 INACTIVE
LOG_ARCHIVE_DEST_29 INACTIVE
LOG_ARCHIVE_DEST_30 INACTIVE
LOG_ARCHIVE_DEST_31 INACTIVE
3、FAR SYNC启动之后,查看主库alter日志,可以看到LOG_ARCHIVE_DEST_2变为enable
2017-09-01T11:27:34.972858+08:00
ARC1: Standby redo logfile selected for thread 1 sequence 227 for destination LOG_ARCHIVE_DEST_2
2017-09-01T11:28:35.087153+08:00
ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=MEMORY SID='*';
2017-09-01T11:28:37.464178+08:00
Thread 1 cannot allocate new log, sequence 229
Checkpoint not complete
查看log_archive_dest参数
SQL> select dest_name,status,error from v$archive_dest
DEST_NAME STATUS ERROR
---------------------------------------- ------------------ -----------------------------------------------------------------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 VALID
LOG_ARCHIVE_DEST_3 ALTERNATE
LOG_ARCHIVE_DEST_4 INACTIVE
LOG_ARCHIVE_DEST_5 INACTIVE
LOG_ARCHIVE_DEST_6 INACTIVE
LOG_ARCHIVE_DEST_7 INACTIVE
LOG_ARCHIVE_DEST_8 INACTIVE
LOG_ARCHIVE_DEST_9 INACTIVE
LOG_ARCHIVE_DEST_10 INACTIVE
LOG_ARCHIVE_DEST_11 INACTIVE
DEST_NAME STATUS ERROR
---------------------------------------- ------------------ -----------------------------------------------------------------
LOG_ARCHIVE_DEST_12 INACTIVE
LOG_ARCHIVE_DEST_13 INACTIVE
LOG_ARCHIVE_DEST_14 INACTIVE
LOG_ARCHIVE_DEST_15 INACTIVE
LOG_ARCHIVE_DEST_16 INACTIVE
LOG_ARCHIVE_DEST_17 INACTIVE
LOG_ARCHIVE_DEST_18 INACTIVE
LOG_ARCHIVE_DEST_19 INACTIVE
LOG_ARCHIVE_DEST_20 INACTIVE
LOG_ARCHIVE_DEST_21 INACTIVE
LOG_ARCHIVE_DEST_22 INACTIVE
DEST_NAME STATUS ERROR
---------------------------------------- ------------------ -----------------------------------------------------------------
LOG_ARCHIVE_DEST_23 INACTIVE
LOG_ARCHIVE_DEST_24 INACTIVE
LOG_ARCHIVE_DEST_25 INACTIVE
LOG_ARCHIVE_DEST_26 INACTIVE
LOG_ARCHIVE_DEST_27 INACTIVE
LOG_ARCHIVE_DEST_28 INACTIVE
LOG_ARCHIVE_DEST_29 INACTIVE
LOG_ARCHIVE_DEST_30 INACTIVE
LOG_ARCHIVE_DEST_31 INACTIVE
31 rows selected.
总结:当关闭far sync实例,主库就会启用log_archive_dest_3参数并直接传输日志到备库;
当far sync实例再次启动成功后,主库就使用log_archive_dest2参数并传输日志到far sync端,之后far sync传输日志到备库,实现零数据丢失。
|
|