1. 架构
在Oracle 10g 中,传输日志到备用节点数据库的进程为ARCH 和LGWR 。(在11g 中,LGWR 被LNS 替代,但10g 中是不是LGWR 我不确定!)
在备用节点上通过参数log_archive_config 、fal_client 和fal_server 接收日志,并和主节点通讯,标识该日志是否被应用。
Data Guard 采用最大可用模式,保证数据实时同步到最少一个节点上。因为我们选择第一个备用节点作为数据实时同步点,同步进程采用LGWR 进程。
2. 配置
在一个主节点两个备用节点的Data Guard 10g 的环境中,各个节点的初始化参数的主要配置项。
在主节点的初始化参数文件配置:
*.log_archive_config='dg_config=(codb,codg,codg2)'
*.log_archive_dest_1='location=/oradata/htcodb/archive_logs_codb'
*.log_archive_dest_2='service=codb_standby lgwr sync affirm valid_for=(online_logfiles,primary_role) db_unique_name=codg'
*.log_archive_dest_3='service=codb_standby2 arch async affirm valid_for=(online_logfiles,primary_role) db_unique_name=codg2'
*.log_archive_dest_state_2='enable'
*.log_archive_dest_state_3='enable'
在备用节点一的初始化参数文件配置:
*.db_name='codb'
*.db_unique_name='codg'
*.fal_client='code_standby'
*.fal_server='codb_primary'
*.log_archive_config='dg_config=(codb,codg,codg2)'
*.log_archive_dest_1='location=/oradata/archivelog/ valid_for=(all_logfiles,all_roles) db_unique_name=codg'
*.log_archive_format='%t_%s_%r.dbf'
在备用节点二的初始化参数文件配置:
*.db_name='codb'
*.db_unique_name='codg2'
*.fal_client='codb_standby'
*.fal_server='codb_primary'
*.log_archive_config='dg_config=(codb,codg2)'
*.log_archive_dest_1='location=/u01/archivelog_standby/ valid_for=(all_logfiles,all_roles) db_unique_name=codg2'
*.log_archive_format='%t_%s_%r.dbf'
主节点和备用节点之间的通讯是通过Oracle Net 实现的。在参数fal_client 和fal_server 上就用到Oracle Net 中的配置信息。
在主节点的tnsnames.ora 文件中,关于DG 的配置项如下所示:
CODB_PRIMARY =
(DESCRIPTION =
( ADDRESS = (PROTOCOL = TCP)(HOST = codb1-vip.htsc.com.cn)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = codb2-vip.htsc.com.cn)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = codb)
)
)-
CODB_STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.219)(PORT = 1521))
)
(CONNECT_DATA =
(SID = codb)
)
)
CODB_STANDBY2 =
(DESCRIPTION =
(ADDRESS_LIST =
(address = (protocol = tcp)(host = 192.168.15.90)(port = 1521))
)
(CONNECT_DATA =
(SID = codb)
)
)
在备用节点一的tnsnames.ora 文件中,关于DG 的配置项如下所示:
CODB_PRIMARY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = codb1-vip.htsc.com.cn)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = codb2-vip.htsc.com.cn)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = codb)
)
)
CODB_STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.219)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = codb)
)
)
在备用节点二的tnsnames.ora 文件中,关于DG 的配置项如下所示:
CODB_PRIMARY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = codb1-vip.htsc.com.cn)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = codb2-vip.htsc.com.cn)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = codb)
)
)
CODB_STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.90)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = codb)
)
)