Search This Blog

Sunday, October 16, 2011

Summarizing RAC's service control utility ( SRVCTL) 10gR2

Summarizing RAC's service control utility ( SRVCTL) 10gR2

by Michael Georgiou

Srvctl is the main Oracle Real Application Cluster (RAC) utility which administer RAC objects. RAC objects are databases, instances, asm, nodeapps and services. The purposes of the srvctl is divided in three categories:

  1. Oracle cluster database configuration tasks
  2. General Oracle cluster database administration tasks
  3. Node level tasks

Oracle cluster database configuration tasks

Add, remove modify databases, instances, services

Set and unset environment from databases, instances, services

General Oracle cluster database administration tasks

Start, stop, enable, disable and get statuses for databases, instances, services

Relocate a service back to the preferred instance.

Node level tasks

Add, remove modify node level applications

Set and unset environment from node level applications

Start , stop applications ( Applications can be Virtual IP Adress, Listeners, Oracle notification services and Oracle enterprise manager) .

Srvctl commands

  1. add
  2. config
  3. enable
  4. disable
  5. start
  6. stop
  7. modify
  8. relocate
  9. status
  10. getenv
  11. setenv
  12. unsetenv
  13. remove

Commands description

add

database

instance

service

asm

nodeapps

examples:

srvctl add database -d ORCL -o $ORACLE_HOME

srvctl add instance -d ORCL -i ORCL1 -n racnode1

srvctl add service -d ORCL -s ORCLSRV -r racnode1 -a racnode2

srvctl add asm -n racnode1 -i asm1 -o $ORACLE_HOME

srvctl add nodeapps -n racnode1 -o $ORACLE_HOME \

-A 192.168.0.1/255.255.255.0

config

database

database

service

asm

nodeapps

listener

examples:

srvctl config database -ORCL

srvctl config -d ORCL -s ORCLSRV

srvctl config asm -n noderac1

srvctl config nodeapps -n noderac1

srvctl config listener -n noderac1

enable|disable

database

instance

service

asm

examples:

srvctl enable database -d ORCL

srvctl enable instance -d ORCL -i ORCL1,ORCL2

srvctl enable service -d ORCL -s ORCLSRV

srvctl enable asm -n noderac1 -i asm1

srvctl disable database -d ORCL

srvctl disable instance -d ORCL -i ORCL2,ORCL3

srvctl disable service -d ORCL -s ORCLSRV

srvctl disable asm -n noderac1 -i asm1

start|stop

database

database

service

asm

nodeapps

listener

examples:

srvctl start database -d ORCL -o open

srvctl start instance -d ORCL -i ORCL1,ORCL2

srvctl start service -d ORCL -s ORCLSRV

srvctl start asm -n noderac1 -i asm1

srvctl start nodeapps -n noderac1

srvcrl start listener -n noderac1

srvctl stop database -d ORCL -o immediate -c sys/****@ORCL1

srvctl stop instance -d ORCL -i ORCL1,ORCL2

srvctl stop service -d ORCL -s ORCLSRV

srvctl stop asm -n noderac1 -i asm1

srvctl stop nodeapps -n noderac1

srvcrl stop listener -n noderac1

modify

database

instance

service

nodeapps

Use modify database when:

-change ORACLE_HOME location

-change spfile location

-change the database role (primary,physical_standby,logical_standby)

-change startup option

-change management policy(automatic,manual

Use modify instance when:

-relocate a database instance

-establish a dependency between an asm instance and database instance

Use modify service when:

-Move service from one instance to another

-Changes which instances to be preferred and available

examples:

srvctl modify database -d ORCL -r logical_standby

srvctl modify instance -d ORCL -i ORCL1 -s ASM1

srvctl modify service -d ORCL -s ORCLSRV -r ORCL2 -a ORCL1

srvctl modify nodeapps -n noderac1 -A 192.168.100.2/255.255.255.0/etch0

More service examples:

-Move a service from instance ORCL1 to ORCL2

srvctl modify service -d ORCL -s ORCLSRV -i ORCL1 -t ORCL2

-Change an available instance to be a preferred instance

srvctl modify service -d ORCL -s ORCLSRV -i ORCL1 -r

relocate

service

example:

srvctl relocate service -d ORCL -s ORCLSRV -i ORCL1 -t ORCL3

status

database

instance

service

nodeapps

asm

examples:

srvctl status database -d ORCL -f

srvctl status instance -d ORCL -i ORCL1

srvctl status service -d ORCL -s ORCLSRV

srvctl status asm -n noderac1

srvctl status nodeapps -n noderac1

getenv

database

instance

service

nodeapps

examples:

srvctl getenv database -d ORCL

srvctl getenv instance -d ORCL -i ORCL1

srvctl getenv service -d ORCL -s ORCLSRV

srvctl getenv nodeapps -n noderac1

setenv

database

instance

service

nodeapps

examples:

srvctl setenv database -d ORCL -t LANG=EN

srvctl setenv instance -d ORCL -i ORCL1 -t LANG=EN

srvctl setenv service -d ORCL -s ORCLSRV -t CLASSPATH=/usr/local/jdk/jre/rt.jar

srvctl setenv nodeapps -n noderac1 -t CLASSPATH=/usr/local/jdk/jre/rt.jar

unsetenv

database

instance

service

nodeapps

examples:

srvctl unsetenv database -d ORCL -t LANG

srvctl unsetenv instance -d ORCL -i ORCL1 -t LANG=EN

srvctl unsetenv service -d ORCL -s ORCLSRV -t CLASSPATH

srvctl unsetenv nodeapps -n noderac1 -t CLASSPATH

remove

database

instance

service

nodeapps

asm

examples:

srvctl remove database -d ORCL

srvctl remove instance -d ORCL -i ORCL1

srvctl remove service -d ORCL -s ORCLSRV

srvctl remove service -d ORCL -s ORCLSRV -i ORCL3,ORCL4

srvctl remove nodeapps -n noderac1

srvctl remove asm -n noderac1

Note : use crs_stat -t or crs_stat -u for validating commands

Table: Available commands per RAC's object

Command

Database

Instance

Service

ASM

Nodeapps

add

config

enable|disable

start|stop

modify

relocate

Status

getenv

setenv

unsetenv

remove

For more details please read oracle's reference Oracle database clusterware and oracle real application clusters administration and deployment appendix E.