oracle rac load banlance负载均衡配置与测试方法
oracle rac load banlance 配置与测试方法
oracle load banlance 配置与测试方法
client 端设置方法:
rac_test =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.201)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.202)(PORT = 1521))
(LOAD_BALANCE= yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME =racdb)
)
)
server端设置方法:
参数设置
节点1 local_listener='LISTENERS_RAC1' listeners_rac1 在tnsnames.ora中配置见节点1 tnsnames.ora
或者直接写ip地址有以下格式
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.201)(PORT=1521))
命令如下:
alter system set local_listener='LISTENERS_RAC1' scope=both sid='racdb1';
或者
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.201)(PORT=1521))' scope=both sid='racdb1';
节点2 local_listener='LISTENERS_RAC2' listeners_rac2在tnsnames.ora中配置见节点2 tnsnames.ora
或者直接写ip地址有以下格式
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.202)(PORT=1521))
命令如下:
alter system set local_listener='LISTENERS_RAC2' scope=both sid='racdb2';
或者
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.202)(PORT=1521))' scope=both sid='racdb2';
remote_listeners='LISTENERS_RACDB' 会自动默认设置好
tnsnames.ora设置
tnsnames.ora in RAC ORACLE_HOME
节点1
LISTENERS_RACDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
)
LISTENERS_RAC1 =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
)
节点2
LISTENERS_RACDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
)
LISTENERS_RAC2 =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
)
测试方法:
sqlplus "system/abcdefg@racdb"
select instance_name from v$instance;
exit;