RACing ahead with Oracle on VMware - Part 5: The powerful SRVCTL Utility

December 15, 2005

A Brief Pep talk

The previous article was a marathon and a real daunting project that involved getting your ASM and the database running under the VMware virtual nodes. It is important to realize that whenever you decide to get the RAC into production, you will not just do it with a couple of PC's. There are vendors like DELL, HP and others who offer a custom RAC ready hardware at your disposal for deployment. However, why would you be interested in getting into the details of all the utilities like SRVCTL?

Well let's get it straight, a vendor has to score, meaning they will set it up and move on to the next customer. You can have 24 hr support and have your pockets torn to shreds. But when you are in trouble or if your RAC databases says sorry "Cannot start the resource, human intervention needed" (Yes there are errors like that!), then you as a DBA should not be left high and dry. And that is why in this article, we will talk about using the powerful utility called SRVCTL to see if our database is functioning as it should.

So what can I do with SRVCTL Utility?

As the manual states, a lot!

  • Database Configuration tasks such as:

    1.  Adding, modifying and deleting Cluster Database configuration.
    2.  Adding/or Deleting an instance or a service to/from the configuration of a Cluster Database.
    3.  Moving instances and services in a cluster database configuration and modifying service configurations.
    4.  Setting and unsetting the environment for an instance or service in a clustered database configuration.
    5.  Setting and unsetting the environment for an entire cluster database in a clustered database configuration.

  • Cluster Database Administration Tasks such as:

    1.  Starting and stopping cluster databases.
    2.  Starting and stopping cluster database instances.
    3.  Starting, stopping, and transfering cluster database services.
    4.  Getting statuses of cluster databases, cluster database instances, or cluster database services; this last one is interesting as having taken all the pains of setting the RAC, we will indeed be curious of their status.

  • Node Level Tasks such as:

    1.  Adding and deleting node level applications
    2.  Setting and unsetting the environment for node-level applications.
    3.  Managing node applications.
    4.  Managing ASM instances.
    5.  Starting and stopping a group of programs that includes virtual IP addresses, Listeners, Oracle Notification Services, and Oracle Enterprise Manager agents (for maintenance purposes).

SRVCTL Command Syntax and Options

You have commands, objects, and options. They are case sensitive so doing –v would be asking for verbose and –V will be totally different (V is for version). However, database, instance, and service names are case insensitive. The basic structure of SRVCTL and how it interprets the command syntax:

srvctl command object [options]
 

In SRVCTL :

  • srvctl is the command to start the SRVCTL utility. Other commands include start, stop status, modify or remove. (There are more as you will see).
  • object is an object or target on which SRVCTL performs the command, such as database or instance.
  • options extend the use of a preceding command combination to include additional parameters for the command. For example, the -i option indicates that a comma-delimited list of instance names follows; sometimes the -i option only permits one value and not a list of names. The -n option indicates that a node name or a comma-delimited list of node names follows. SRVCTL prompts for user credentials when you use the -q option with any SRVCTL command.

Getting on to SRVCTL'ing

Doing a srvctl –h will give you a massive list of commands and trust me there are a LOT!

[oracle@vmora01rh4 ~]$ srvctl -h

Usage: srvctl [-V]

Usage: srvctl add database -d <name> -o <oracle_home> [-m <domain_name>] [-p <spfile>] [-A <name|ip>/netmask] [-r {PRIMARY | PH

YSICAL_STANDBY | LOGICAL_STANDBY}] [-s <start_options>] [-n <db_name>] [-y {AUTOMATIC | MANUAL}]

Usage: srvctl add instance -d <name> -i <inst_name> -n <node_name>

Usage: srvctl add service -d <name> -s <service_name> -r "<preferred_list>" [-a "<available_list>"] [-P <TAF_policy>]

Usage: srvctl add service -d <name> -s <service_name> -u {-r "<new_pref_inst>" | -a "<new_avail_inst>"}

Usage: srvctl add nodeapps -n <node_name> -o <oracle_home> -A <name|ip>/netmask[/if1[|if2|...]]

Usage: srvctl add asm -n <node_name> -i <asm_inst_name> -o <oracle_home> [-p <spfile>]

This is a long list and you will see that it covers all the srvctl commands.

Querying Config Cluster Database and Services

[oracle@vmora01rh4 ~]$ srvctl config database

fokerac

[oracle@vmora01rh4 ~]$ srvctl config database -d fokerac -a -t

Example client-side TNS entry for service fokeserv:

fokeserv = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db_vip)(PORT=dedicated_port))(CONNECT_DATA=(SERVICE_NAME=fokeserv.mydomain.nl)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))

[oracle@vmora01rh4 ~]$ srvctl config service -d fokerac -s fokeserv -a

fokeserv PREF: fokerac2 fokerac1 AVAIL: TAF: basic

Querying the nodes for all running services

(Note that you also have the crsctl command line to do a lot of work for you. When we will do our installation on RedHat 4.2 Nahant on two nodes with Oracle 10g Release 2, I will discuss more on the crsctl and other related tools such as OCRcheck, crs_stat, crs_register, crs_unregister etc.)

[oracle@vmora01rh4 ~]$ srvctl config nodeapps -n vmora01rh4 -a -g -s -l

VIP exists.: /vmora01rh4-vip/172.22.202.75/255.255.255.0/eth0

GSD exists.

ONS daemon exists.

Listener exists.

[oracle@vmora01rh4 ~]$ srvctl config nodeapps -n vmora02rh4 -a -g -s -l

VIP exists.: /vmora02rh4-vip/172.22.202.76/255.255.255.0/eth0

GSD exists.

ONS daemon exists.

Listener exists.

Querying the nodes for ASM Configurations

[oracle@vmora01rh4 ~]$ srvctl config asm -n vmora01rh4

+ASM1 /u01/app/oracle/product/10.2.0/db_1

[oracle@vmora01rh4 ~]$ srvctl config asm -n vmora02rh4

+ASM2 /u01/app/oracle/product/10.2.0/db_1

Querying all nodes for Listeners Configuration

[oracle@vmora01rh4 ~]$ srvctl config listener -n vmora01rh4

vmora01rh4 LISTENER_VMORA01RH4

[oracle@vmora01rh4 ~]$ srvctl config listener -n vmora02rh4

vmora02rh4 LISTENER_VMORA02RH4

Getting the Status of Various Services

As you can see above, the –S (yes, capital S gives you more output although the manual does not talk about that flag (-s is for services). It does however state something as –S <level>.

As you see above –v: verbose, is verbose, -f : : Include disabled applications.

Checking version?

Reading Manual: There is no alternative to reading a good manual and it is provided by Oracle itself, free of cost! I would urge you to read the manual.

Conclusion: You have seen here that SRVCTL is a great asset to a DBA and others in doing all kinds of administrative tasks on the RAC databases. In the next article, we will go through preparing our machines for an Oracle 10g Release2 setup on a two node RHEL 4 Update 2 (you can also use the Centos 4.2, it is identical with the RHEL release) and free of cost. So here's wishing you Merry Christmas and a happy and prosperous New Year 2006!

» See All Articles by Columnist Tarry Singh








The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers