oracle 11g RAC : Transparent Application Failover (TAF)

23 Sep

oracle 11g RAC : Transparent Application Failover (TAF)

TAF, secara singkat jika client connect instance di RAC, dan mendapatkan instance node1 kemudian node1 down, maka client akan dilayani oleh node yang masih hidup instancenya dalam contoh ini node2

lengkapnya saya cuplik dari : http://wiki.oracle.com/page/Transparent+Application+Failover+(TAF)?t=anon

A runtime failover for high-availability environments, such as Oracle9i Real Application Clusters and Oracle Fail Safe, that refers to the failover and re-establishment of application-to-service connections. It enables client applications to automatically reconnect to the database if the connection fails, and, optionally, resume a SELECT statement that was in progress. This reconnect happens automatically from within the Oracle Call Interface (OCI) library.

1. setup tnsnames.ora di semua node
[oracle@node1 ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
NODE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = node)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)

[oracle@node2 ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
NODE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = node)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)

2. test koneksi
a. scott login di oracle 11g RAC (sqlplus no 1)
[oracle@node1 ~]$ sqlplus scott/tiger@node
SQL> select * from dept;
DEPTNO DNAME LOC
———- ————– ————-
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON

b. scott dapat instance berapa di oracle 11g RAC ? (sqlplus no 2)
[oracle@node1 ~]$ sqlplus system/oracle0@node
SQL> column instance_name format a10
SQL> column host_name format a10
SQL> select instance_name, host_name,
2 NULL AS failover_type,
3 NULL AS failover_method,
4 NULL AS failed_over
5 FROM v$instance
6 UNION
7 SELECT NULL, NULL, failover_type, failover_method, failed_over
8 FROM v$session
9 WHERE username = ‘SCOTT’;
INSTANCE_N HOST_NAME FAILOVER_TYPE FAILOVER_M FAI
———- ———- ————- ———- —
node2 node2
SELECT BASIC NO
c. instance node 2 shutdown
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
[oracle@node1 ~]$ srvctl stop instance -d node -i node2
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is not running on node node2

d. apakah session scott di node2 juga down ?, ternyata tidak (sqlplus no 1)
SQL> /
DEPTNO DNAME LOC
———- ————– ————-
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON

e. lha ?, kalau begitu sekarang scott di layani oleh instance berapa ? (sqlplus no 2)
SQL> /
INSTANCE_N HOST_NAME FAILOVER_TYPE FAILOVER_M FAI
———- ———- ————- ———- —
node1 node1
SELECT BASIC YES

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: