How to see what services you have and where they are running:
[[email protected] ~]$ srvctl status service -d RAC
Service CONTACT is running on instance(s) RAC1
How to Add Service to your RAC database:
[[email protected] ~]$ srvctl add service -s NEWSRV -r RAC1 -a RAC2 -d RAC
[[email protected] ~]$ 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)
[email protected] ~]$ 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
[[email protected] ~]$ 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:
[[email protected] ~]$ srvctl start service -s NEWSRV -d RAC
[[email protected] ~]$ srvctl start service -s NEWSRV1 -d RAC
How to check if your service is registered:
[email protected] ~]$ 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
[[email protected] admin]$ sqlplus [email protected]
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:
[[email protected] 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
[[email protected] admin]$ kill -9 6245
[[email protected] 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
[[email protected] 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
[[email protected] admin]$ sqlplus [email protected]
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:
[[email protected] admin]$ srvctl relocate service -s NEWSRV -d RAC -i RAC2 -t RAC1
[[email protected] admin]$ srvctl status service -s NEWSRV -d RAC
Service NEWSRV is running on instance(s) RAC1