Quick guide about SRVCTL

Hi everyone!

Often we caught ourselves trying to remember some simple commands to achieve what we need. And SRVCTL and its variations may be one of them 🙂

Sometimes we need to create a specific service_name to connect to an existing database, and we can, for example, have an application that use a SPECIFIC NODE, so we can configure the service name to use it that way. And we find ourselves looking for the right syntax for that. Ok, we are going to give you guys some basic examples that may be helpful

In order to check ALL the available services already created via SRVCTL we should use:

srvctl status service -d 

it should retrieve an output like that:

dbsrv {/home/oracle}: srvctl status service -d dbgrepora

Service grepora-app1 is running on instance(s) dbgrepora1

Please bear in mind that the does not necessarily match the instance name, so to make sure about the database name, run:

srvctl config database

Example:

dbsrv {/home/oracle}: srvctl config database

dbgrepora

If you have more than one database on that server, it will be returned too.

Ok, now let’s try to create a new service name for your database. In the node that you want to create the service_name, please run the following.

srvctl add service -d  -s 

where follow the rule already described above, and you can create as you wish.

Ok GREPORA, but what if i want to create a service_name to multiple instances ? You got it!

The syntax follows the same idea, but we should include different parameter in there, which is:

-r

Example:

srvctl add service -d dbgrepora -s service_dbg -r dbgrepora1,dbgrepora2

Creating the service_dbg service, and checking the status, you’ll have an output like:

dbsrv {/home/oracle}: srvctl status service -d dbgrepora -s service_dbg

Service service_dbg is running on instance(s) dbgrepora1,dbgrepora2

To stop and remove a created service just use:

srvctl stop service -d  -s 
srvctl remove service -d  -s 

 

Hope it comes to help!

Best Regards,

Rafael.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.