Thursday, March 19, 2009

Basic CRS and SRVCTL commands

Purpose

This document provides some basic CRS and Srvctl commnds in Oracle 10g RAC environment.

What is CRS? (Cluster Ready services)

CRS is Oracle clusterware, which provides many system management services and interact with the vendor clusterware to coordinate cluster membership information.

Oracle has provided some utilities to help administer and troubleshoot the RAC environment. Lets looks at some of the basic commands,

COMMANDS

1) The Most basic thing to check for is the existence of the “crs” processes in Unix/Linux server.
$> ps –ef grep crs

Here is a list of required CRS processes.

Ocssd.bin, crsd.bin, evmd.bin, evmlogger.bin

2) crs_stat

This command will list all the resources that are registered with CRS with the name of the resource , the type of resource and its current state (online/offline).

· crs_stat command does list all the resources in a linear fashion, if you would like to see the resources in a tabular fashion yiou could use crs_stat –t , which makes it easy to read.
E.g.:-
$> crs_stat –t

oracle@amro503:fimsq11> crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....03.lsnr application ONLINE ONLINE amro503
ora....503.gsd application ONLINE ONLINE amro503
ora....503.ons application ONLINE ONLINE amro503
ora....503.vip application ONLINE ONLINE amro503
ora....05.lsnr application ONLINE ONLINE amro505
ora....505.gsd application ONLINE ONLINE amro505
ora....505.ons application ONLINE ONLINE amro505
ora....505.vip application ONLINE ONLINE amro505
ora.fimsq1.db application ONLINE ONLINE amro503
ora....11.inst application ONLINE ONLINE amro503
ora....12.inst application ONLINE ONLINE amro505

· crs_stat –v list you all the status of the resources in verbose mode. This really becomes handy during trouble shooting.

3) Crs_getperm


This command helps to identify the permissions associated with a resource.

Syntax: crs_getperm (where resource name is the name you get from crs_stat command)

4) Crs_setperm

Sets and modifies permissions associated with a resource name. This is similar to the change mode command in unix.

5) Crsctl check

Helps you verify the health of your clusterware.

oracle@amro503:fimsq11> crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy


6) Find out the version of CRS you are running

$> crsctl query crs softwareversion

E.g.:- oracle@amro503:fimsq11> crsctl query crs softwareversion
CRS software version on node [amro503] is [10.2.0.3.0]

Or
$> crsctl query crs activeversion

E.g.:- oracle@amro503:fimsq11> crsctl query crs activeversion
CRS active version on the cluster is [10.2.0.3.0]

7) Command to start and stop CRS


Usually the “root” user has permissions to start and stop CRS on the cluster.
The oracle user can be given sudo permissions to stop and start a CRS.
Use this command to stop crs. Its better to shutdown the database and the nodeapps before performing this action.

$> /u01/oracle/cluster/crs/bin/crsctl stop crs

Use this command to start the crs

$> /u01/oracle/cluster/crs/bin/crsctl start crs.


8) Crs_start

This command starts all the registered crs resources in the right order.

9) Crs_stop

This command stops all the registered crs resources in the right order.

SRVCTL COMMANDS

10) Commands to start and stop a database

Set your oracle rdbms environment.
To start/stop the database and all the instances in RAC with one command.
At the command prompt type

$> srvtcl start/stop instance –d -i , , ………

Or

$> srvtcl start/stop instance –d

E.g.:- srvctl start/stop instance –d fimsp1 –i fimsp11, fimsp12

To start/stop one instance

$> srvtcl start/stop instance –d -i


11) To start and stop nodeapps

This can be done from any node in the cluster.

Syntax:- $> srvctl stop/start nodeapps –n

E.g.:- to stop/start all nodeapps on amro503/505 cluster

Amro505:oracle:fimsq11> srvctl stop/start nodeapps –n amro503 à to stop all nodeapps on amro503.

Amro505:oracle:fimsq11> srvctl stop/start nodeapps –n amro505 à to stop all nodeapps on amro505

To see if all the nodeapps are down. Use command “crs_stat –t “

12) To add a new instance to CRS

srvctl add instance -d database -i -n

13) To remove a resource from CRS

srvctl remove database -d


14) To Trace SRVCTL issues. Set the debug flag on. This information is very helpful in debugging issues.


In ksh
$> export srvm_trace=true

The trace o/p will be big and descriptive.

oracle@:fimsp21> srvctl strat nodeapps -n amro501

/fisc/oracle/cluster/crs/jdk/jre/bin/java -classpath /fisc/oracle/cluster/crs/jlib/netcfg.jar:/fisc/oracle/cluster/crs/jdk/jre/lib/rt.jar:/fisc/oracle/cluster/crs/jdk/jre/lib/i18n.jar:/fisc/oracle/cluster/crs/jlib/srvm.jar:/fisc/oracle/cluster/crs/jlib/srvmhas.jar:/fisc/oracle/cluster/crs/jlib/srvmasm.jar:/fisc/oracle/cluster/crs/srvm/jlib/srvctl.jar -DTRACING.ENABLED=true -DTRACING.LEVEL=2 oracle.ops.opsctl.OPSCTLDriver start nodeapps -n amro501
[main] [23:32:20:471] [OPSCTLDriver.setInternalDebugLevel:165] tracing is true at level 2 to file null
[main] [23:32:20:662] [OPSCTLDriver.:95] Security manager is set
[main] [23:32:20:677] [CommandLineParser.parse:174] parsing cmdline args
[main] [23:32:20:678] [CommandLineParser.parse2WordCommandOptions:948] parsing 2-word cmdline
[main] [23:32:20:791] [HASContext.getInstance:197] Module init : 16
[main] [23:32:20:792] [HASContext.getInstance:221] Local Module init : 19
[main] [23:32:20:792] [HASContext.:90] moduleInit = 19
[main] [23:32:20:810] [Library.getInstance:95] Created instance of Library.
[main] [23:32:20:811] [Library.load:195] Loading libsrvmhas10.a...
[main] [23:32:20:811] [Library.load:201] oracleHome null
[main] [23:32:20:812] [Library.load:236] Loading library srvmhas10 from path=
/fisc/oracle/cluster/crs/jdk/jre/bin:/fisc/oracle/cluster/crs/jdk/jre/bin/classic:/fisc/oracle/cluster/crs/jdk/jre/bin:/fisc/oracle/cluster/crs/lib32:/fisc/oracle/cluster/crs/srvm/lib32:/usr/lib
[main] [23:32:20:864] [Library.load:244] Loaded library srvmhas10 from path=
/fisc/oracle/cluster/crs/jdk/jre/bin:/fisc/oracle/cluster/crs/jdk/jre/bin/classic:/fisc/oracle/cluster/crs/jdk/jre/bin:/fisc/oracle/cluster/crs/lib32:/fisc/oracle/cluster/crs/srvm/lib32:/usr/lib
[main] [23:32:20:886] [has.HASContextNative.Native] prsr_trace: no lsf ctx, line=Native: allocHASContext

No comments: