在ORACLE 9i RAC 环境下,为了做到高可用性,需要对客户端的tnsnames.ora这个文件进行配置,在oracle中这样的配置叫做TAF,这个配置不能使用NETCA配置程序生成。其中ORA是RAC数据库的数据库名,另外,各个不同的节点的实例名分别为ORA1和ORA2,以下配置中的两个连接配置分别互为备份,切换时间为5秒。
以下所示为配置示例。
ORA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.13)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.14)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORA)
(INSTANCE_NAME = ORA1)
(INSTANCE_ROLE = PRIMARY)
(FAILOVER_MODE =
(BACKUP = ORA_BACKUP)
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 30)
(DELAY = 5)
)
)
)
ORA_BACKUP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.14)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.13)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORA)
(INSTANCE_NAME = ORA2)
(INSTANCE_ROLE = PRIMARY)
(FAILOVER_MODE =
(BACKUP = ORA)
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 30)
(DELAY = 5)
)
)
)
在以上示例中所标红部分为TNS的别名及备份TNS别名,可按用户应用的需要自行修改。
在以上示例中所标蓝部分,分别为RAC数据库的服务名和各节点的实例名,可按节点数量的不同及服务名的不同自行修改。
此配置适用于oracle 9i和oracle 10g。
©著作权归作者所有:来自51CTO博客作者zhangfei__的原创作品,如需转载,请注明出处,否则将追究法律责任
oracle职场休闲oracle