Dev’s Weblog

We are moving to sysdbaonline.com ,so update your bookmarks

SRVCTL Command ( RAC )

Posted by sdevang on August 31, 2008

srvctl is the tool Oracle recommends that DBAs use to interact with CRS and the cluster registry. Oracle does provide several tools to interface with the cluster registry and CRS more directly, at a lower level .srvctl, in contrast, is well documented and easy to use.

Using srvctl

Even if you are experienced with 9i srvctl, it’s worth taking a look at this section; 9i and 10g srvctl commands are slightly different.

srvctl must be run from the $ORACLE_HOME of the RAC you are administering. The basic format of a srvctl command is

srvctl <command> <target> [options]

where command is one of

enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config

and the target, or object, can be a database, instance, service, ASM instance, or the nodeapps.

Examples
=======

Example 1. Bring up the ORCL1 instance of the ORCL database.

[oracle@newserver oracle]$ srvctl start instance -d ORCL -i O1RCL

Example 2. Stop the ORCL database: all its instances and all its services, on all nodes.

[oracle@newserver oracle]$ srvctl stop database -d ORCL

Example 3. Stop the nodeapps on the newserver node. NB: Instances and services also stop.

[oracle@newserver oracle]$ srvctl stop nodeapps -n newserver

Example 4. Add the ORCL3 instance, which runs on the newserver node, to the ORCL
clustered database.

[oracle@newserver oracle]$ srvctl add instance -d ORCL -i ORCL3 -n newserver

Example 4. Add a new node, the newserver node, to a cluster.

[oracle@newserver oracle]$ srvctl add nodeapps -n newserver -o $ORACLE_HOME -A 10.177.56.56/255.255.252.0/eth1

(The -A flag precedes an address specification.)

Example 5. To change the VIP (virtual IP) on a RAC node, use the command

[oracle@newserver oracle]$ srvctl modify nodeapps -A new_address

Example 6. Find out whether the nodeapps on newserver are up.

[oracle@newserver oracle]$ srvctl status nodeapps -n newserver
VIP is running on node: newserver
GSD is running on node: newserver
Listener is not running on node: newserver
ONS daemon is running on node: newserver

Example 7. Disable the ASM instance on newserver for maintenance.

[oracle@newserver oracle]$ srvctl disable asm -n newserver

Debugging srvctl

Debugging srvctl in 10g couldn’t be easier. Simply set the SRVM_TRACE environment variable.

[oracle@newserver bin]$ export SRVM_TRACE=true

Let’s repeat Example 6 with SRVM_TRACE set to true:

[oracle@newserver oracle]$ srvctl status nodeapps -n newserver
/u01/app/oracle/product/10.1.0/jdk/jre//bin/java -classpath /u01/app/oracle/product/10.1.0/jlib/netcfg.jar:/u01/app/oracle/product/10.1.0/jdk/jre//lib/rt.jar:
/u01/app/oracle/product/10.1.0/jdk/jre//lib/i18n.jar:/u01/app/oracle/product/10.1.0/jlib/srvm.jar:
/u01/app/oracle/product/10.1.0/jlib/srvmhas.jar:/u01/app/oracle/product/10.1.0/jlib/srvmasm.jar:
/u01/app/oracle/product/10.1.0/srvm/jlib/srvctl.jar
-DTRACING.ENABLED=true -DTRACING.LEVEL=2 oracle.ops.opsctl.OPSCTLDriver status nodeapps -n newserver
[main] [19:53:31:778] [OPSCTLDriver.setInternalDebugLevel:165] tracing is true at level 2 to file null
[main] [19:53:31:825] [OPSCTLDriver.<init>:94] Security manager is set
[main] [19:53:31:843] [CommandLineParser.parse:157] parsing cmdline args
[main] [19:53:31:844] [CommandLineParser.parse2WordCommandOptions:900] parsing 2-word cmdline
[main] [19:53:31:866] [GetActiveNodes.create:212] Going into GetActiveNodes constructor…
[main] [19:53:31:875] [HASContext.getInstance:191] Module init : 16
[main] [19:53:31:875] [HASContext.getInstance:216] Local Module init : 19 …
[main] [19:53:32:285] [ONS.isRunning:186] Status of ora.ganges.ons on newserver is true
ONS daemon is running on node: newserver
[oracle@newserver oracle]$

Pitfalls

A little impatience when dealing with srvctl can corrupt your OCR, ie, put it into a state where the information for a given object is inconsistent or partially missing. Specifically, the srvctl remove command provides the -f option, to allow you to force removal of an object from the OCR. Use this option judiciously, as it can easily put the OCR into an inconsistent state.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>