Saturday, November 28, 2015

Separating RAC TNS Services for connecting Application to Database with a specific Service Name

I want to explain about separating of service name in Oracle RAC .Today I had a request for separating Financial client service because of when I down a service we shouldn’t interrupt on Financial system.

In this solution we have Orale Rac 11g with 2 nodes. I decide make a new service with srvctl utility. The service on the two nodes can provide services of course you can configure for example This service provide just on node 1 or node 2.

Following the example earlier in this section, one services will be created, Fin_svc . To partition the applications using these services, FIN_svc will run on the first instance, orcl1. The service accntg_svc will run on the second instance, orcl2.

[oracle@css-db-test-1 ~]$  srvctl add service -d orcl -s FIN_Srv -r orcl1,orcl2

[oracle@css-db-test-1 ~]$ srvctl status service -d orcl
Service FIN_Srv is not running.

[oracle@css-db-test-1 ~]$ srvctl start service -d orcl -s FIN_Srv

[oracle@css-db-test-1 ~]$ srvctl status service -d orcl
Service FIN_Srv is running on instance(s) orcl1,orcl2

[grid@css-db-test-2 ~]$ crsctl stat res -t
ora.orcl.fin_srv.svc
      1        ONLINE  ONLINE       css-db-test-1
      2        ONLINE  ONLINE       css-db-test-2


You can see this service in the configuration of listener:

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                28-NOV-2015 16:56:24
Uptime                    0 days 0 hr. 25 min. 11 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /grid/product/11.2.0/grid_1/network/admin/listener.ora
Listener Log File         /gridbase/diag/tnslsnr/css-db-test-1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.8.72.24)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.8.72.27)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "FIN_Srv" has 1 instance(s).
  Instance "orcl1", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl1", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl1", status READY, has 1 handler(s) for this service...
The command completed successfully


Add following scripts to Tnsnames.ora on 2 nodes:

Test_Backup_CSS_FINNNN =
  (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = css-db-test-scan.ssd.net)(PORT = 1521))   
    (CONNECT_DATA =
  (SERVER = DEDICATED)
      (SERVICE_NAME = FIN_Srv)
    )
  )

SQL> select NAME from dba_services;


The Finance application would make a connection to the FIN_Srv alias in the tnsnames.ora configuration file.

No comments:

Post a Comment