Oracle 11gR2 rac配置FAT

You know some birds are not meant to be caged, their feathers are just too bright.------《肖申克的救赎》

Oracle从11g R2开始推出SCAN(Single Client Access Name),客户端可以通过SCAN特性负载均衡地连接到RAC数据库。SCAN是一个域名,可以解析至少1个IP,最多解析3个SCAN IP,客户端可以通过这个SCAN 名字来访问数据库,另外SCAN ip必须与public ip和VIP在一个子网。SCAN可以通过DNS和GNS解析,也可以使用hosts文件来解析。但由于DNS及GNS和网络管理系统密切地结合在一起。对于多层的应用系统而言,这种配置将故障点又扩展到网络层了。哪天DNS 服务器解析不了,就会导致RAC 不能访问。而使用hosts文件来解析在安装RAC的时候产生问题,后期使用也是存在问题的,比如SCAN域名只能定义一个SCAN IP。故在此列出oracle 11g R2的FAT配置流程,来实现rac的负载均衡:

一、基础环境

1,11gR2 双节点rac

2,oracle linux 6.5操作系统

3,hosts文件地址配置

192.168.1.10 mydb01

192.168.1.11 mydb02

192.168.1.12 mydb01-vip

192.168.1.13 mydb02-vip

10.1.1.10 mydb01-priv

10.1.1.11 mydb02-priv

192.168.1.14 mydb-scan

二、服务器端配置

1,节点1和节点2加入以下配置信息

MYDB =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = mydb-scan)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = mydb)

)

)

LISTENERS_MYDB =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.13)(PORT = 1521))

)

mydb1 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = mydb)

(INSTANCE_NAME = mydb1)

)

)

mydb2 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.13)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = mydb)

(INSTANCE_NAME = mydb2)

)

)

2,修改系统参数

alter system set remote_listener='LISTENERS_MYDB' scope=both sid='*';----所有实例都生效

alter system set local_listener='mydb2' sid='mydb2';

alter system set local_listener='mydb1' sid='mydb1';

3,节点1和节点2进行动态注册

alter system register;

4,节点1和节点2重启listener

srvctl stop listener -n mydb02

srvctl stop listener -n mydb01

srvctl start listener -n mydb02

srvctl start listener -n mydb01

5,客户端tnsnames.ora进行配置

mydb =

(DESCRIPTION =

(LOAD_BALANCE = yes)

(failover=on)

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.12)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.13)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = mydb)

(failover_mode=(type=select)(method=basic)(retries=5)(delay=5))

)

)

最后只要测试连接即可!

  • 发表于:
  • 原文链接:http://kuaibao.qq.com/s/20180131G0SWDK00?refer=cp_1026

扫码关注云+社区