Oracle RAC 11gR2 Server Side TAF Using SRVCTL.

Oracle RAC

Add services on cluster through srvctl.

Basic connection.

[[email protected] ~]$ srvctl add service -d dell -s report -r dell1 -a dell2 -P basic -e session

start the service.

[[email protected] ~]$ srvctl status service -d dell -s report
Service report is not running.

[[email protected] ~]$ srvctl start service -d dell -s report

Preconnect connection.

[[email protected] ~]$ srvctl add service -d dell -s testsrv -r dell1 -a dell2 -P preconnect

start the service.

[[email protected] ~]$ srvctl status service -d dell -s testsrv
Service testsrv is not running.

[[email protected] ~]$ srvctl start service -d dell -s testsrv

Client side configuration

[[email protected] ~]# vi /etc/resolv.conf
search example.com
192.168.1.100

Sample tnsnames entry.

reporting =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-cluster-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = report.example.com)
)
)

testsrv =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-cluster-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testsrv.example.com)
(failover_mode= (backup=testsrv_preconnect)(type=select)(method=preconnect))
)
)

testsrv_preconnect =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-cluster-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testsrv_preconnect.example.com)

)

)

Connect client using reporting.

[[email protected] admin]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 24 18:16:59 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> conn scott/[email protected]
Connected.

check on cluster.

SQL> select inst_id,sid,username,failover_type,failover_method,failed_over from gv$session where username=’SCOTT’;

INST_ID SID USERNAME FAILOVER_TYPE FAILOVER_M FAI


     1         50 SCOTT                          SESSION       BASIC      NO

Connect client using testsrv.

[[email protected] admin]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 24 19:15:07 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> conn scott/[email protected]
Connected.

Check on cluster

SQL> select inst_id,sid,username,failover_type,failover_method,failed_over from gv$session where username=’SCOTT’;

INST_ID SID USERNAME FAILOVER_TYPE FAILOVER_M FAI


     1         62 SCOTT                          SELECT        PRECONNECT NO
     2         62 SCOTT                          NONE          NONE       NO

Removing created services.

Options Description

-d Database Name

-s Service Name

-i Instance Name

-f Force remove

[[email protected] ~]$ srvctl stop service -d dell -s testsrv
[[email protected] ~]$ srvctl remove service -d dell -s testsrv -i dell1,dell2