When a database is getting started, generally the listener control service (lsnrctl) is started and the database is started by logging into the database and executing the startup command. If you’re in a RAC configuration, you should be using srvctl; this command knows your configuration and works on the entire RAC environment instead of just a single listener on a single server or starting a single database.

SRVCTL

According to the Oracle documentation, you should “use SRVCTL to manage configuration information. You can use SRVCTL commands to add, remove, start, stop, modify, enable, and disable a number of entities, such as databases, instances, listeners, SCAN listeners, services, grid naming service (GNS), and Oracle ASM.” Once you are in a RAC configuration, you should be using only SRVCTL to start and stop the database and SCAN listener.

SRVCTL Command Reference

SRVCTL commands, object names, and options are case sensitive. Database, instance, listener, and service names are case insensitive and case preserving. You cannot create listener names that differ only in case, such as LISTENER and listener.

SRVCTL is a linux command line utility.

SRVCTL uses the following command syntax:

srvctl command object [options]

DB_UNIQUE_NAME and INSTANCE_NAME

When administering an Oracle 11g RAC configuration, note the following:RAC_configuration

  • A RAC configuration is a cluster of one or more servers
  • The RAC configuration acts as a single database
  • The database has a name for the whole: parameter DB_UNIQUE_NAME
SQL> show parameter db_unique_name

NAME              TYPE          VALUE
----------------  ------------  -------------
db_unique_name    string        MyDB
  • Each database server in the RAC is an instance
  • Each instance has its own name: parameter INSTANCE_NAME
SQL> show parameter instance_name

NAME              TYPE          VALUE
----------------  ------------  -------------
db_unique_name    string        MyDB1

If you go to each database server in the cluster and look up those two parameters, DB_UNIQUE_NAME will be the same on all servers and INSTANCE_NAME will be different on all servers.

SCAN Listener

The Single Client Access Name (SCAN) provides a single name for clients to access any client database running the Cluster. The SCAN listener is a separate process that runs on the database server computer. It receives incoming client connection requests and manages the traffic of these requests to the database server. In other words, for a remote connection to be made to the database, the listener must be running.

Checking the Status of a Listener

To check the status, use the following command and you will get the following result. With no options specified, the status of the default listener is returned.

srvname:oracle:db1> srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): oraclerac1,oraclerac2

Starting a Listener

Start the default listener by executing the command below. With no options specified, the status of the default listener is returned. The command does not return any feedback. Check the listener status to verify.

srvname:oracle:db1> srvctl start listener

Stopping a Listener

Start the default listener by executing the command below. With no options specified, the status of the default listener is returned. The command does not return any feedback. Check the listener status to verify.

srvname:oracle:db1> srvctl stop listener

Starting and Stopping the Database

Checking the Status of a Database

To check the status, use the following command and you will get the following result. The -d parameter is required and is the unique name for the database.

srvname:oracle:db1> srvctl status database -d mydb
Instance mydb1 is running on node oraclerac1
Instance mydb2 is running on node oraclerac2

Starting the Database

Start the database by executing the command below. The -d parameter is required and is the DB_UNIQUE_NAME for the database. The command does not return any feedback. Check the database status to verify. The -o option is the same as the regular options for startup: nomount, mount, or open.

srvname:oracle:db1> srvctl start database -d mydb -o open

Stopping the Database

Start the database by executing the command below. The -d parameter is required and is the DB_UNIQUE_NAME for the database. The command does not return any feedback. Check the database status to verify. The -o option is the same as the usual options for shutdown: immediate, abort, transactional or normal.

srvname:oracle:db1> srvctl stop database -d mydb -o immediate