Registering a Database in Server Control (srvctl)

Even if you are managing a non-RAC database, in 11g, it is recommended to use “srvctl” commands to start and stop the database. But, if the database is not created using DBCA or not upgraded using DBUA, the database will not be registered in the “Oracle Restart” configuration automatically.

Oracle Restart monitors the services registered and restarts if there is an abnormal end or can stop and start the databases during server reboot. Please read Oracle Documentation to learn more about Oracle Restart.

When the database is not configured in Oracle Restart, and if you attempt to start or query the configuration using srvctl, you will see this error.

You may add the database to Oracle Restart configuration using the minimal set of parameters. For complete set of options and various srvctl options, please refer to Oracle Documentation. Here adding the database information with database name (-d option), the Oracle home location (-o option) and database parameter file (-p option). In the examples below, variables like $ORACLE_HOME, $TNS_ADMIN are used, they are setup prior. If the variables are not defined, use full path of the directory or name.

To query the configuration use the following command. You may use the “srvctl modify” option to change any of the configuration item you see below. 

When registering database, it would be appropriate to register the listener also. My recommendation is to register all the services in “Oracle Restart”. See here for all the components that can be registered with using “srvctl”.

Below, listener is registered with Oracle Restart using the listener name (-l option), the port number (-p option) and the Oracle home location (-o option).

Similar to the database configuration query, the listener configuration can be queried using “srvctl config” command.

If you are not using the default location for listener.ora file, set the TNS_ADMIN value using the “setenv” option.

Similarly, if the database requires any special environment variable to be set before starting, using the “setenv” for database as well.

The “getenv” option shows the environment variables defined for the component.


7 Responses to Registering a Database in Server Control (srvctl)

  1. how to modify db_unique_name in OCR by ‘srvctl modify’ command

  2. You will have to change the initialization parameter and restart the database to change the unique name. For OCR/srvctl, you will have to drop the database configuration and add it back. When you change db_unique_name in the database, there are other challenges such as ASM file name directory, etc.

  3. Someone said that if we use srvctl to stop clusterware resources or use crsctl to start/stop clusterware resources, it will work but the next time u start/restart the db/clusterware it will cause problem..can u plz throw some light on that.

    Thanks & Regards
    Rajat SHarma

  4. Hi Bijju,

    I have a doubt

    srvctl getenv database -d $ORACLE_SID

    $ORACLE_SID refrers only the instance name right not the database name.

    Correct me if i am wrong.

Leave a Reply

%d bloggers like this: