Step by step How to add Services in oracle 12c RAC ?
Updated: Feb 11, 2021
#Oracle12c #RAC #OracleServices
Oracle RAC database is created with four default services.
1-SYS$BACKGROUND ---- used internally for the instance's background processes
2-SYS$USERS -------- used for all local database connections that did not go through the Oracle Listener.
3-<dbname> ---------- One service has the same name as the database name
4-<dbname>XDB ---- It has the name of the form db_nameXDB
The 1st two services are internal to the database and the rest two are registered with Listener .
But apart from the default services ,application sometimes need more services to be created for their own functioning .So that it won't interfere with other running services of the database.For example to manage the db service we can create one service dedicated for DB .One service for application .So to add the services SRVCTL utility is used .
So steps to add services manually in RAC:
1-Discover the running services :
select inst_id,name from gv$services order by inst_id,name;
2-Now we will add a service to the RAC database
srvctl add service -database <db_unique name> -service <service_name> -preferred <preferred instances > -available <available instances to which the service fails over when preferred node is down>
[oracle@Node1~]$ srvctl add service -d PRD -s SRVCPRD -r PRD1 -a PRD2
[oracle@Node1 ~]$ srvctl status service -d PRD -s SRVCPRD
Service SRVCPRD is not running.
[oracle@Node1~]$ srvctl start service -d PRD -s SRVCPRD
[oracle@Node1 ~]$ srvctl status service -d PRD -s SRVCPRD
Service SRVCPRD is running on instance(s) PRD1
[oracle@Node1 ~]$ srvctl config service -d PRD -s SRVCPRD
3-Now check the status of the service from the database .
select inst_id,name from gv$services order by inst_id,name;
4- Once the service appears in the database.Put an entry of the service in the tnsnames.ora file in both the nodes of RAC .
PRD_APP=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =<Scan>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SRVCPRD)
)
)