Sunday, November 17, 2013

Oracle 11gR2 RAC Services create/status/configure/relocate

How to see what services you have and where they are running:
[oracle@Rac1 ~]$ srvctl status service -d RAC
Service CONTACT is running on instance(s) RAC1

How to Add Service to your RAC database:

[oracle@Rac1 ~]$ srvctl add service -s NEWSRV -r RAC1 -a RAC2 -d RAC

[oracle@Rac1 ~]$ srvctl add service -s NEWSRV1 -d RAC -r rac1, rac2

How to see more detailed information about your service: (to view how services are actually configure on which nodes and which database respectively)
oracle@Rac1 ~]$ srvctl config service -s NEWSRV -d RAC
Service name: NEWSRV
Service is enabled
Server pool: RAC_NEWSRV
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Preferred instances: RAC1
Available instances: RAC2

[oracle@Rac1 ~]$ srvctl config service -s NEWSRV1 -d RAC
Service name: NEWSRV1
Service is enabled
Server pool: RAC_NEWSRV1
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Preferred instances: RAC1,RAC2
Available instances:

How to Start your Service after creating it:

[oracle@Rac1 ~]$ srvctl start service -s NEWSRV -d RAC

[oracle@Rac1 ~]$ srvctl start service -s NEWSRV1 -d RAC

How to check if your service is registered:

oracle@Rac1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 16-JUN-2012 10:03:26

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 – Production
Start Date 16-JUN-2012 08:40:17
Uptime 0 days 1 hr. 23 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/Rac1/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.103)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.113)(PORT=1521)))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM1″, status READY, has 1 handler(s) for this service…
Service “CONTACT.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “NEWSRV.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “NEWSRV1.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “RAC.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
Service “RACXDB.localdomain” has 1 instance(s).
Instance “RAC1″, status READY, has 1 handler(s) for this service…
The command completed successfully

How to connect to your Service:
1) Add following tns entry in your tnsnames.ora

NEWSRV =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan-ip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NEWSRV.localdomain)
)
)

2) connect thru sqlplus prompt

[oracle@Rac1 admin]$ sqlplus system@NEWSRV

SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 16 10:12:49 2012

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

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select host_name from v$instance;
HOST_NAME
—————————————————————-
Rac1.localdomain

How to Relocating Services:

1) Service will relocate to available instance if preferred instance becomes unavailable:

[oracle@Rac1 admin]$ ps -ef |grep smon
oracle 5346 1 0 08:39 ? 00:00:00 asm_smon_+ASM1
oracle 6245 1 0 08:40 ? 00:00:02 ora_smon_RAC1
oracle 16371 8720 0 10:13 pts/2 00:00:00 grep smon

[oracle@Rac1 admin]$ kill -9 6245

[oracle@Rac1 admin]$ ps -ef |grep smon
oracle 5346 1 0 08:39 ? 00:00:00 asm_smon_+ASM1
oracle 16488 8720 0 10:14 pts/2 00:00:00 grep smon

[oracle@Rac1 admin]$ srvctl status service -s NEWSRV -d RAC

Service NEWSRV is running on instance(s) RAC2( we can set this information using< srvctl configure.. > command

[oracle@Rac1 admin]$ sqlplus system@NEWSRV

SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 16 10:14:42 2012

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

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select host_name from v$instance;

HOST_NAME
—————————————————————-
Rac2.localdomain

2) You can manually relocate service back to original instance once it is back up:

[oracle@Rac1 admin]$ srvctl relocate service -s NEWSRV -d RAC -i RAC2 -t RAC1

[oracle@Rac1 admin]$ srvctl status service -s NEWSRV -d RAC
Service NEWSRV is running on instance(s) RAC1

1 comment:

  1. Oracle Real Application Cluster [10g/11 g R2 RAC]
    www.21cssindia.com/courses_view.html?id=1‎
    Oracle-Application Online Training, Oracle-Application training, Oracle-Application course contents, Oracle-Application , call us: +919000444287 ...

    ReplyDelete