When considering the availability of the Oracle database, Oracle RAC 11g provides a superior solution with its advanced failover mechanisms. Oracle RAC 11g includes the required components that all work within a clustered configuration responsible for providing continuous availability; when one of the participating systems fail within the cluster, the users are automatically migrated to the other available systems.
A major component of Oracle RAC 11g that is responsible for failover processing is the Transparent Application Failover (TAF) option. All database connections (and processes) that lose connections are reconnected to another node within the cluster. The failover is completely transparent to the user.
One important note is that TAF happens automatically within the OCI libraries. Thus your application (client) code does not need to change in order to take advantage of TAF. Certain configuration steps, however, will need to be done on the Oracle TNS file tnsnames.ora.
One important note is that TAF happens automatically within the OCI libraries. Thus your application (client) code does not need to change in order to take advantage of TAF. Certain configuration steps, however, will need to be done on the Oracle TNS file tnsnames.ora.
i created following entry in my client tnsnames.ora file in my laptop
rac =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.212)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RAC.localdomain)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.212)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RAC.localdomain)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
Note:- Both ip used here are the vips of the cluster nodes.Also all these things TYPE,METHOD,RETRIES,DELAY are importanct parameter while configuring TAF.
Before going ahead check the tnsping connectivity .
C:\Users\DELL>tnsping rac
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 18-SEP-2012 14:34:49Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
e:\oracle11g\oracle\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.212)(PORT = 1
521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RAC.localdomain) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 1
80) (DELAY = 5))))
OK (280 msec)
SQL Query to Check the Session's Failover Information
The following SQL query can be used to check a session's failover type, failover method, and if a failover has occurred. We will be using this query throughout this example. Here i connect to my rac instance through MAHI user.
col instance_name for a15
col host_name for a17
col failover_method for a17
col failed_over for a18
set lines 300
select distinct v.instance_name as instance_name, v.host_name as host_name,
s.failover_type as failover_type, s.failover_method as failover_method,
s.failed_over as failed_over from v$instance v , v$session s
where s.username ='MAHI';
Before going ahead check the tnsping connectivity .
C:\Users\DELL>tnsping rac
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 18-SEP-2012 14:34:49Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
e:\oracle11g\oracle\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.212)(PORT = 1
521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RAC.localdomain) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 1
80) (DELAY = 5))))
OK (280 msec)
SQL Query to Check the Session's Failover Information
The following SQL query can be used to check a session's failover type, failover method, and if a failover has occurred. We will be using this query throughout this example. Here i connect to my rac instance through MAHI user.
col instance_name for a15
col host_name for a17
col failover_method for a17
col failed_over for a18
set lines 300
select distinct v.instance_name as instance_name, v.host_name as host_name,
s.failover_type as failover_type, s.failover_method as failover_method,
s.failed_over as failed_over from v$instance v , v$session s
where s.username ='MAHI';
We can see, that we are connected to the Instance RAC1 which is running on racha1.localdomain . Now we stop this Instance without disconnecting from the client. Either you can use srvctl or through sqlplus to shutdown the RAC1 instance. Here i used srvctl command. I used separate env files for rdbms and grid environment.Here i sourced the grid.env file , in order to invoke srvctl utility.
Now let's go back to our SQL session on the client and rerun the SQL statement:
We can see that the above session has now been failed over to instance RAC2 on racha2.localdomain. After completing the test start the RAC1 instance .
hope it will help you...:)
No comments:
Post a Comment