由于RAC中redo分为thread1以及thread2.
本文出发点主要在于主库发送给备库的日志,备库哪个节点接收以及应用。
主库的tnsname配置以及log_archive_dest_n参数设置:
方法一:
主库tnsname配置:
###################备库一节点连接串#########################
sty1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vip1)(PORT = 1521))
(CONNECT_DATA =
(SERVER=DEDICATED)
(SERVICE_NAME=sty)
)
)
###################备库二节点连接串#########################
sty2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vip2)(PORT = 1521))
(CONNECT_DATA =
(SERVER=DEDICATED)
(SERVICE_NAME =sty)
)
)
alter system set log_archive_dest_2='SERVICE=sty1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sty' scope=both sid='racdb1';
alter system set log_archive_dest_2='SERVICE=sty2 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sty' scope=both sid='racdb2';
这样的话:
主库节点1的归档thread1会发送至备库节点1,
并且备库节点1只会应用从主库节点1接收到的归档thread1
主库节点2的归档thread2会发送至备库节点2,
并且备库节点2只会应用从主库节点2接收到的归档thread2
方法二:
sty =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sty)
)
)
alter system set log_archive_dest_2='SERVICE=sty LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sty' scope=both sid='*';
这样的话:
主库发送给备库的日志,备库会随机选择一个节点来接收以及应用,
就不会出现主库RAC给备库RAC发送的日志,全部被备库节点1接收应用。
方法三:
sty =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vip1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = vip2)(PORT = 1521))
(LOAD_BALANCE = yes)
(FAILOVER=ON)
)
(CONNECT_DATA =
(SERVICE_NAME = sty)
)
)
alter system set log_archive_dest_2='SERVICE=sty LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sty' scope=both sid='*';
这样的话:
主库发送给备库的日志,备库会随机选择一个节点来接收以及应用,
就不会出现主库RAC给备库RAC发送的日志,全部被备库节点1接收应用。
但是经过我自己测试,无法实现备库一个实例宕机,备库 另外一个实例节点正常接收宕机实例所应接收的日志。