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.

Friday, October 14, 2011

Oracle 10g RAC Utilities

Oracle 10g RAC Utilities by michael A. Georgiou

This article provides a small tutorial for all the RAC utilities, that are available in oracle rac 10g r2. the srvctl utility is not covered in this document.

olsnodes

olsnodes : is used to list cluster's members

olsnodes -n --returns the cluster's nodes associated with each cluster number

olsnodes -i --returns cluster's nodes associated with each number and vip name

olsnodes -l --returns the local member name and cluster number

crsctl ( as root)

crsctl : The cluster control is responsible manage the cluster components , the main options are the following:

crsctl stop crs --stop the cluster the same as /etc/init.d/init.crs stop

crsctl start crs --start the cluster , the same as /etc/init.d/init.crs start

crsctl disable crs --disable cluster to start automatically

crsctl enable crs --enable cluster to start automatically

crsctl lsmodule [crs|evm|css] --list the available modules per cluster components, these modules can be used later for debugging purposes.

crsctl check crs --check all daemons(crsd,evmd,cssd) if are healthy

crsctl add css vodedisk -- add a new voding disk

crsctl delete css vodedisk --delete existing voding disk

crsctl debug log [crs|evm|css] "MODULE:DEGUG_LEVEl[,..]" --enable debugging

crsctl debug log res "RESOURCE:DEGUG_LEVEl[,..]" --enable debugging

All logs are available under

$CRS_HOME/log/hostname/crs

/cssd

/evmd

/crsd

$CRS_HOME/bin/diagcollection.pl -- this perl script collect information for diagnostic purposes.

racgons

racgons : It used to register a middle tier node[s] , such a ons server

racgons add_config node1:port,nodeN:port

racgons remove­_config node1:port

ocrcheck

ocrcheck : Block by block check on ocr and ocr mirror files , it is returns

  1. ocr file space details ( total space,available space,used space)
  2. ocr id
  3. ocr and ocr mirror location

ocrdump

ocrdump : consolitate ocr into a dump file

ocrdump --create an ocr dump , by default the OCRDUMPFILE is created

ocrdump mydump

ocrdump mydump -stdout -keyname system --create an ocr dump ,dumping only the system keyname

ocrdump mydump -stdout xml

evmwatch

evmwatch : waits for event to happen

evmwatch -A -t "@ timestamp @@"

evmpost

evmpost : port event to node[s]

evmpost -u "hello" node

ocrconfig

ocrconfig : ocr file administration

ocrconfig -backuploc ----change ocr backup location

ocrconfig -showbackup ---show the backups that are done

ocrconfig -overwrite ---overwrite the contents of the ocr loacted in local sga to disk

ocrconfig -repair --repair ocr file

ocrconfig -export -- export ocr file

ocrconfig -import --import and exported file

ocrconfig -replace ocr| ocr mirror --change ocr file

ocrconfig -restore --restore ocr backup as listed via showbackup option

ocrconfig -upgrade

ocrconfig -downgrade

oifcfg

oifcfg : Oracle's network interface configuration tools . This tools set which network interface will plays the role of public or private interconnect

oifcfg iflist ---> returns the if_name and the subnet ( if_name can be the eth0,eth1 etc)

oifcfg getif ---> return the if_name,subnet and if_type ( the if_type can be global public or private interconnect)

oifcfg setif -global eth3/192.168.10.0:private_interconnect ---> add a second private_interconnect network interface in cluster, the global option is applied in all nodes.

oifcfg delif -global eth3/192.168.10.0:private_interconnect

oifcfg delif -global --delete all global interfaces

clscfg

clscfg : Cluster configuration , with this tool you can register/add a new node in a cluster

clscfg -add -nn node3,3 -pn node3-priv,3 -hn node3,3

cluvfy

cluvfy: Cluster verification utility for following areas in the cluster

  1. Installation verification ( inst)
  2. Storage verification (ssa,space)
  3. Cluster integrity (clu)
  4. Cluster components (crs,ocr,cfs)
  5. user and Permissions (admprv)
  6. Connectivity (conn)
  7. System requirements verification (sys)
  8. Arguments and Options (peer)

cluvfy comp -list ---list of the valid components for verification

cluvfy stage -list ---list the valid stage of the verification ( pre stage and post stage e.g the system is able for oracle database installation)

clucfy comp -clu ----check the integrity of your entire cluster, which is mean to verify that all of the nodes in the cluster have the same view of the cluster configuration

cluvfy comp -sys -n all -p crs -verbose ---Verify the min system requirement on cluster nodes prior to installing oracle cluster ware.

cluvfy comp -ssa -n all -s /dev/sda ----Discover all of the shared storage system available on cluster on system /dev/sda

cluvfy comp -space -n all -l /oracle -z 2G ---Verify the availability of at least 2G of free space

cluvfy comp cfs -n all -F /ocfs-disk ---Verify the integrity of the cluster file system

cluvfy comp -admprv -n all

-o user_priv

-o crs_inst

-o db_inst

-o db_config -d $ORACLE_HOME

Verify user privileges , user privileges to install crs and install and configure database

cluvfy comp -conn -n all --- Discover all of the network interfaces that are available on the cluster nodes

cluvfy comp peer -n all -r 10gR2 -- compare all the node in the cluster

cluvfy comp peer -refnode rac1 -n rac2,rac3 -r 10gR2 -- compare all the node in the cluster base on rac1

cluvfy comp -stage -post crsinst -n all ---Verify the crs installation

cluvfy comp -stage -pre dbinst -n all -r 10gR2 --Verify that the system is configured properly in order to proceed with database installation

cluvfy stage -pre dbcfg -n all -d $ORACLE_HOME ---Verify whether your system meet all of the criteria for creating a database or for making a database configuration change