2015. 6. 9. 13:20 오라클
rac load balance 확인 테스트
1. TNSNAMES.ORA 반영
EXA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.20.3)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.20.4)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = EXA)
)
)
2. test.sh 작성
vi test.sh
#!/bin/sh
count=0
while [ $count -lt 5 ] # 5번 수행하겠다.
do # loop 시작
count=`expr $count + 1` # 카운터 증가
sqlplus -S system/welcome1@EXA @test.sql
done
3. test.sql 작성
col "Instance" format a20
col "Host" format a20
col "Service Name" format a20
select sys_context('userenv', 'instance_name') "Instance",
sys_context('userenv', 'server_host') "Host",
sys_context('userenv', 'service_name') "Service Name"
from dual
/
exit;
4. sh test.sh 실행
[EXA1]oracle@exa1:/home/oracle# sh loop.sh
Instance Host Service Name
-------------------- -------------------- --------------------
EXA2 exa2 EXA
Instance Host Service Name
-------------------- -------------------- --------------------
EXA1 exa1 EXA
Instance Host Service Name
-------------------- -------------------- --------------------
EXA1 exa1 EXA
Instance Host Service Name
-------------------- -------------------- --------------------
EXA2 exa2 EXA
Instance Host Service Name
-------------------- -------------------- --------------------
EXA1 exa1 EXA
RAC cluster 에서 로드밸런스가 잘 되고 있음을 확인할수 있다.