Wednesday, 29 December 2010

Change Applications Tier hostname using AutoConfig

1. Deregister the current Applications server (Required)
De-register the current Applications server node, run the following command as the owner of the Oracle Applications file system and current database instance as follow:
perl $AD_TOP/bin/adgentns.pl appspass= contextfile= -removeserver

2. Shutdown the Applications Tier Services (Required):
$COMMON_TOP/admin/scripts//adstpall.sh apps


3. Change the hostname as required:
Change the hostname in /etc/hosts file

4. Change the hostname as required:
Change the hostname in /etc/hosts file

5. Reboot the Node:






Saturday, 18 December 2010

R12 Clone using rman

This article details the steps used to clone R12 RAC database to Single instance database using RMAN duplicate command, Notice that we used the control file as a catalog database and the Production will keep up and running.

The databases used here are:

Production: PROD

Cloned: CPCLONE

1- On the source system; Run the preclone script on both database and apps tiers.

Database:

$ cd ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/

$ perl adpreclone.pl

Application:

$ cd $ADMIN_SCRIPTS_HOME/appsutil/scripts/$CONTEXT_NAME/

$ perl adpreclone.pl

2- Archive and move the Apps tier and Database home form the source to the target server:

For the application tier:

$ cd $APPL_TOP/../../..

$ tar cvf - apps| gzip > apps_PROD.tar.gz

For the database tier

$ cd $ORACLE_HOME/..

$ tar cvf – db | gzip > db_PROD.tar.gz

3- Create full RMAN backup for the source database:

$ export ORACLE_SID=PROD

$ rman target /

run

{

allocate channel d1 type disk;

allocate channel d2 type disk;

backup format '/backup/MASTER/ERP/df_prodt%t_s%s_p%p.bak' database;

sql 'alter system archive log current';

backup format '/backup/MASTER/ERP/df_archive%t_s%s_p%p.arc' archivelog all;

release channel d1; release channel d2;

}

4- Move the backup pieces generated from Rman to the target server to the same path or make a soft link as the same backup original path to let Rman see it.

Example $ ln –f -s /u02/CPCLONE/backup /backup/MASTER/ERP.

5- Extract the archive files on the Target servers

For the application tier:

$ tar cvf - apps| gzip > apps_PROD.tar.gz

For the database tier

$ tar cvf – db | gzip > db_PROD.tar.gz

Note: The current path depends on your configuration.

6- On the target system; Run the preclone script on the database tier.

$ cd $ORACLE_HOME/appsutil/clone/bin

$ perl adcfgclone.pl dbTechStack

7- Edit the new created init file under $ORACLE_HOME/dbs to include the following parameters; Note we are using ASM as data storage:

_no_recovery_through_resetlogs=TRUE

db_file_name_convert =('+DATA1/prod', '/u01/CPCLONE/oradata')

log_file_name_convert =('+DATA1/prod', '/u01/CPCLONE/oradata')

and edit the following parameters if not have those values

undo_management =AUTO

undo_tablespace =UNDOTBS1

db_name =cpclone

instance_name =cpclone

8- On the target system; Startup the database on nomount state:

$ export $ORACLE_SID=CPCLONE

$ sqlplus / as sysdba

SQL> startup nomount pfile=initCPCLONE.ora;

9- Make the production database accessible from the clone database:

$ cd $TNS_ADMIN

$ vi tnsnames.ora

And insert the follow entries:

PROD= (

DESCRIPTION=

(

ADDRESS=(PROTOCOL=tcp)(HOST=gfmisdb1)

(PORT=1521))

(CONNECT_DATA=

(SERVICE_NAME=PROD)

(INSTANCE_NAME=PROD1)

)

)


10- Test the connection to the production database:

$ tnsping PROD

$ sqlplus apps/apps@PROD

11- Lunch rman to start the duplicate process:

$ export $ORACLE_SID=CPCLONE

$ rman target sys/sys@prod auxiliary /

run

{

allocate auxiliary channel C1 device type disk;

allocate auxiliary channel C2 device type disk;

duplicate target database to cpclone;

release channel C1;

release channel C2;

}

12- Shutdown the cpclone database and edit the parameter file as:

$ sqlplus / as sysdba

$ shutdown abort;

Edit the following parameters:

undo_management to =MANUAL

undo_tablespace=UNDOTBS1

13- Open the database in with resetlogs option:

$ sqlplus / as sysdba

Sql> startup mount;

Sql> alter database open resetlogs;

Sql> drop tablespace APPS_UNDOTS1 including contents;

Sql> CREATE UNDO TABLESPACE APPS_UNDOTS1 DATAFILE

'/u02/CPCLONE/oradata/datafile/undo01.dbf' SIZE 4000M AUTOEXTEND

ON NEXT 100M MAXSIZE 7000M

ONLINE

RETENTION NOGUARANTEE

BLOCKSIZE 8K

FLASHBACK ON;

Then shutdown the database

Sql> shutdown immediate;

14- Edit the parameter file:

Remove _no_recovery_through_resetlogs=TRUE and edit

undo_management=AUTO

undo_tablespace=APPS_UNDOTS1

15- Change the database mode to be in no archive log mode:

$ sqlplus / as sysdba

Sql> startup mount;

Sql> alter database noarchivelog;

Sql> alter database open;

Execute the following script

Sql> @ $ORACLE_HOME/appsutil/install/[CONTEXT NAME]/ adupdlib.sql so

Sql> create spfile from pfile.

Sql> shutdown immediate;

Sql> startup;

16- After the database opened; execute the following script:

cd $ORACLE_HOME/appsutil/clone/bin

perl adcfgclone.pl dbconfig $ORACLE_HOME/appsutil/$CONTEXT_NAME.xml

17- On the application tier run the following script:

cd $COMMON_TOP/clone/bin

perl adcfgclone.pl appsTier



Tuesday, 14 December 2010

EBS R12 RAC TO RAC Clone

1- OC must be installed and running on all DB nodes.
2- Execute the following on all appTier and dbTier Source nodes.
$ cd $ORACLE_HOME/appsutil/scripts/[context_name]
$ perl adpreclone.pl dbTier

3- On the primary oracle RAC node execute:
$ cd [ORACLE_HOME]/appsutil/clone/bin
$ perl adclone.pl
java=[JDK 1.5 Location]
mode=stage
stage=[Stage Directory]
component=database
method=RMAN
dbctx=[RAC DB Context File]      -- Full Path to the existing Oracle RAC database context file
showProgress
This will generate directoris. Go to [stage]/data/stage u will find rman iamge-copies like
"1jj9c44g_1_1" those files and the file "backup_controlfile.ctl" must be moved to the target system
.

5- Archive the database home as follow:

$ cd $ORACLE_HOME/..
$ tar -cvzf rac_db_oh.tgz [DATABASE TOP LEVEL DIRECTORY]

This archive must be transfered to the whole RAC nodes to be used on the target system.

6- On the target system extract the archived home as:
$ tar -xvzf rac_db_oh.tgz

7- Create pairs file on the first node as follow:
[NEW_ORACLE_HOME]/appsutils/clone/pairsfile.txt
it will contains the folow
s_undo_tablespace=[UNDOTBS1 for Initial Node]
s_dbClusterInst=[Total number of Instances in a cluster e.g. 2]
s_db_oh=[Location of new ORACLE_HOME]

8- Create the context file for the primary node as follow:
$ cd $[NEW_ORACLE_HOME]/appsutil/clone/bin
$ perl adclonectx.pl
contextfile=[PATH to OLD Source RAC contextfile.xml]
template=[NEW ORACLE_HOME]/appsutil/template/adxdbctx.tmp
pairsfile=[NEW ORACLE_HOME]/appsutil/clone/pairsfile.txt
initialnode

9- Restore database on the target system primary node as follow:
$ cd $[NEW_ORACLE_HOME]/appsutil/clone/bin
$ perl adclone.pl
java=[JDK 1.5 Location]
component=dbTier
mode=apply
stage=[NEW_ORACLE_HOME]/appsutil/clone
method=CUSTOM
dbctxtg=[Full Path to the Target Context File]
rmanstage=[Location of the RMAN dump files... i.e. RMAN_STAGE/data/stage]
rmantgtloc=[Shared storage loc for datafiles...ASM diskgroup / NetApps NFS mount / OCFS mount point]
srcdbname=[Source RAC system GLOBAL name s_global_database_name]
pwd=[APPS Password]
showProgressode
$ tail -f [ORACLE_HOME]/appsutil/log/$CONTEXT_NAME/ ApplyDatabase_[time].log

10- Check the listener status on target system
$ ps -ef | grep tns
-- listener must be up and running before the autococnfig

11- Run the Autoconfig
$ cd [ORACLE_HOME]/appsutil/scripts/[CONTEXT_NAME]
$ adautocfg.sh appspass=[APPS Password]
12- For the other nodes do the folowing:
A- Uncompress the archived home.
B- Compress the appsutil and move it from the primary node to the other nodes
$ cd [ORACLE_HOME]
$ zip -r appsutil_node1.zip appsutil
C- Update the pairsfile.txt to checnge the parameter s_undo_tablespace:
s_undo_tablespace=[Or UNDOTBS(+1) for additional Nodes]
s_dbClusterInst=[Total number of Instances in a cluster e.g. 2]
s_db_oh=[Location of new ORACLE_HOME]
D- Create a context file:
$ cd [NEW_ORACLE_HOME]/appsutil/clone/bin
$ perl adclonectx.pl
perl adclonectx.pl \
contextfile=[Path to Existing Context File from the First Node]
template=[NEW ORACLE_HOME]/appsutil/template/adxdbctx.tmp
pairsfile=[NEW ORACLE_HOME]/appsutil/clone/pairsfile.txt
addnode
E- Continue cloning as follow:
$ cd [NEW ORACLE_HOME]/appsutil/clone/bin
$ perl adcfgclone.pl dbTechStack [path to the database context file created in previous step]
F- [NEW_ORACLE_HOME]/appsutil/scripts/[CONTEXT_NAME]/addlnctl.sh start LISTENER_[hostname]
this command to run the correct RAC listener.
G- Source the environment file:
$ cd [NEW ORACLE_HOME]
$ ./[CONTEXT_NAME].env

H- Edit the [SID]_APPS_BASE.ora file and change the control file parameter to reflect the
correct control file location on the shared storage.

I- Start the RAC db
$ sqlplus /nolog
SQLPLUS> connect / as sysdba
SQLPLUS> startup
J- Run the autoconfig to generate the tnsnames and listeners files.
$ cd $ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME
$ ./adautocfg.sh appspass=[APPS Password]

To create the database with RAC on the target manually:
$ srvctl add database -d [database_name] -o [oracle_home]
$ srvctl add instance -d [database_name] -i [instance_name] -n [host_name]
$ srvctl add service -d [name] -s [service_name]


Sunday, 12 December 2010

Data Dictionary Cache Hit ratio

SELECT SUM(PINS) / (SUM(PINS) + SUM(RELOADS)) * 100
FROM V$LIBRARYCACHE;

If this value is greater than 1% then increase SHARED_POOL_SIZE

Oracle buffer cache hit ratio

SELECT (1 - (v3.VALUE / (v1.VALUE + v2.VALUE))) * 100
v$sysstat v1,
v$sysstat v2,
v$sysstat v3
WHERE v1.NAME = 'db block gets'
AND v2.NAME = 'consistent gets'
AND v3.NAME = 'physical reads';

After get the buffer cache hit ratio, It must be over 95%.
To increase this value you have to increase the
DB_CACHE_SIZE

Clone Oracle Apps R12 Short Steps

Pre-Clone Steps:

On the DB server:

· cd $ORACLE_HOME/appsutil/scripts/

· perl adpreclone.pl dbTier

· Check the log file under

· $ORACLE_HOME/appsutil/log//StageDBTier_06201503.log

On the apps tier server:

· cd $ADMIN_SCRIPTS_HOME

· perl adpreclone.pl appsTier

· Check the log file $APPL_TOP/admin/log/

Clone Steps:

Copy the source apps tier file system to the target system.

· APPL_TOP.

· COMMON_TOP

· ORACLEAS_10.1.2_ORACLE_HOME

· ORACLEAS_10.1.3_ORACLE_HOME

Copy source system database tier file system to the target system. As user oracle:

· Shutdown normal the source system database.

· Copy the database (.dbf) files plus ORACLE_HOME to the target system.

On the target Database system

· cd $ORACLE_HOME/appsutil/clone/bin

· perl adcfgclone.pl dbTier

· Verify errors the log $ORACLE_HOME/appsutil/log/

On the target apps system

· $cd $COMMON_TOP/clone/bin

· $perl adcfgclone.pl appsTier

· Verify the errors the log. $APPL_TOP/admin//log

· Once clone is finished. If you have customized environment then change post clone profile options, utl_file_dir etc.

Tuesday, 7 December 2010

Oracle SRVCTL commands

SRVCTL:
srvctl command target [options]
commands: enable|disable|start|stop|relocate|status|add|remove|
modify|getenv|setenv|unsetenv|config
targets: database/db|instance/inst|service/serv|nodeapps|asm|listener
targets: database/db|instance/inst|service/serv|nodeapps|asm|listener |diskgroup|home|ons|eons|filesystem|gns|oc4j|scan|scan_listener |srvpool|server|VIP -- From 11gR2

srvctl -help or srvctl -v
srvctl -V -- prints version
srvctl version: 10.2.0.0.0 (or) srvctl version: 11.2.0.1.0
srvctl -h -- print usage
srvctl status service –h

Database:
srvctl add database -d db_name -o ORACLE_HOME [-m domain_name][-p spfile] [-A name|ip/netmask]
[-r {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}]
[-s start_options] [-n db_name] [-y {AUTOMATIC|MANUAL}]
srvctl add database -d prod -o /u01/oracle/product/102/prod

srvctl remove database -d db_name [-f]
srvctl remove database -d prod

srvctl start database -d db_name [-o start_options] [-c connect_str|-q]
srvctl start database -d db_name [-o open]
srvctl start database -d db_name -o nomount
srvctl start database -d db_name -o mount
srvctl start db -d prod
srvctl start database -d apps -o open

srvctl stop database -d db_name [-o stop_options] [-c connect_str|-q]
srvctl stop database -d db_name [-o normal]
srvctl stop database -d db_name -o transactional
srvctl stop database -d db_name -o immediate
srvctl stop database -d db_name -o abort
srvctl stop db -d crm -o immediate

srvctl status database -d db_name [-f] [-v] [-S level]
srvctl status database -d db_name -v service_name
srvctl status database -d hrms

srvctl enable database -d db_name
srvctl enable database -d vis

srvctl disable database -d db_name
srvctl disable db -d vis

srvctl config database
srvctl config database -d db_name [-a] [-t]
srvctl config database
srvctl config database -d HYD -a

srvctl modify database -d db_name [-n db_name] [-o ORACLE_HOME] [-m domain_name] [-p spfile]
[-r {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}] [-s start_options] [-y {AUTOMATIC|MANUAL}]
srvctl modify database -d hrms -r physical_standby
srvctl modify db -d RAC -p /u03/oradata/RAC/spfileRAC.ora -- moves p file
srvctl modify database –d HYD –o /u01/app/oracle/product/11.1/db –s open

srvctl getenv database -d db_name [-t name_list]
srvctl getenv database -d prod

srvctl setenv database -d db_name {-t name=val[,name=val,...]|-T name=val}
srvctl setenv database –d HYD –t “TNS_ADMIN=/u01/app/oracle/product/11.1/asm/network/admin”
srvctl setenv db -d prod -t LANG=en

srvctl unsetenv database -d db_name [-t name_list]
srvctl unsetenv database -d prod -t CLASSPATH

In
11g Release 2, some command's syntax has been changed:
srvctl add database -d db_unique_name -o ORACLE_HOME [-x node_name] [-m domain_name] [-p spfile] [-r {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}] [-s start_options] [-t stop_options] [-n db_name] [-y {AUTOMATIC|MANUAL}] [-g server_pool_list] [-a "diskgroup_list"]
srvctl add database -d prod -o /u01/oracle/product/112/prod -m foo.com -p +dg1/prod/spfileprod.ora -r PRIMARY -s open -t normal -n db2 -y AUTOMATIC -g svrpool1,svrpool2 -a "dg1,dg2"

srvctl remove database -d db_unique_name [-f] [-y] [-v]
srvctl remove database -d prod -y

srvctl stop database -d db_unique_name [-o stop_options] [-f]
srvctl stop database -d dev -f

srvctl status database -d db_unique_name [-f] [-v]
srvctl status db -d sat -v

srvctl enable database -d db_unique_name [-n node_name]
srvctl enable database -d vis -n lnx01

srvctl disable database -d db_unique_name [-n node_name]
srvctl disable db -d vis -n lnx03

srvctl config database [-d db_unique_name [-a]]
srvctl config db -d db_erp -a

srvctl modify database -d db_unique_name [-n db_name] [-o ORACLE_HOME] [-u oracle_user] [-m domain] [-p spfile] [-r {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}] [-s start_options] [-t stop_options] [-y {AUTOMATIC|MANUAL}] [-g "server_pool_list"] [-a "diskgroup_list"|-z]
srvctl modify db -d prod -r logical_standby
srvctl modify database -d racTest -a "SYSFILES,LOGS,OLTP"

Instance:
srvctl add instance –d db_name –i inst_name -n node_name
srvctl add instance -d prod -i prod01 -n linux01

srvctl remove instance –d db_name –i inst_name [-f]
srvctl remove instance -d prod -i prod01

srvctl start instance -d db_name -i inst_names [-o start_options] [-c connect_str|-q]
srvctl start instance –d db_name –i inst_names [-o open]
srvctl start instance –d db_name –i inst_names -o nomount
srvctl start instance –d db_name –i inst_names -o mount
srvctl start instance –d dev -i dev2

srvctl stop instance -d db_name -i inst_names [-o stop_options] [-c connect_str|-q]
srvctl stop instance –d db_name –i inst_names [-o normal]
srvctl stop instance –d db_name –i inst_names -o transactional
srvctl stop instance –d db_name –i inst_names -o immediate
srvctl stop instance –d db_name –i inst_names -o abort
srvctl stop inst –d vis -i vis

srvctl status instance –d db_name –i inst_names [-f] [-v] [-S level]
srvctl status inst –d racdb -i racdb2

srvctl enable instance –d db_name –i inst_names
srvctl enable instance -d prod -i "prod1,prod2"

srvctl disable instance –d db_name –i inst_names
srvctl disable inst -d prod -i "prod1,prod3"

srvctl modify instance -d db_name -i inst_name {-s asm_inst_name|-r} -- set dependency of instance to ASM
srvctl modify instance -d db_name -i inst_name -n node_name -- move the instance
srvctl modify instance -d db_name -i inst_name -r -- remove the instance

srvctl getenv instance –d db_name –i inst_name [-t name_list]
srvctl setenv instance –d db_name [–i inst_name] {-t "name=val[,name=val,...]" | -T "name=val"}
srvctl unsetenv instance –d db_name [–i inst_name] [-t name_list]

In 11g Release 2, some command's syntax has been changed:
srvctl start instance -d db_unique_name {-n node_name -i "instance_name_list"} [-o start_options]
srvctl start instance -d prod -n node2
srvctl start inst -d prod -i "prod2,prod3"

srvctl stop instance -d db_unique_name {[-n node_name]|[-i "instance_name_list"]} [-o stop_options] [-f]
srvctl stop inst -d prod -n node1
srvctl stop instance -d prod -i prod1

srvctl status instance -d db_unique_name {-n node_name | -i "instance_name_list"} [-f] [-v]
srvctl status instance -d prod -i "prod1,prod2" -v

srvctl modify instance -d db_unique_name -i instance_name {-n node_name|-z}
srvctl modify instance -d prod -i prod1 -n mynode
srvctl modify inst -d prod -i prod1 -z

Service:
srvctl add service -d db_name -s service_name -r pref_insts [-a avail_insts] [-P TAF_policy]
srvctl add service -d db_name -s service_name -u {-r "new_pref_inst" | -a "new_avail_inst"}
srvctl add service -d RAC -s PRD -r RAC01,RAC02 -a RAC03,RAC04
srvctl add serv -d CRM -s CRM -r CRM1 -a CRM3 -P basic

srvctl remove service -d db_name -s service_name [-i inst_name] [-f]
srvctl remove serv -d dev -s sales
srvctl remove service -d dev -s sales -i dev01,dev02

srvctl start service -d db_name [-s service_names [-i inst_name]] [-o start_options]
srvctl start service -d db_name -s service_names [-o open]
srvctl start service -d db_name -s service_names -o nomount
srvctl start service -d db_name -s service_names -o mount
srvctl start serv -d dwh -s dwh

srvctl stop service -d db_name [-s service_names [-i inst_name]] [-f]
srvctl stop serv -d dwh -s dwh

srvctl status service -d db_name [-s service_names] [-f] [-v] [-S level]
srvctl status service -d dev -s dev

srvctl enable service -d db_name -s service_names [–i inst_name]
srvctl enable service -d apps -s apps1

srvctl disable service -d db_name -s service_names [–i inst_name]
srvctl disable serv -d dev -s dev -i dev1

srvctl config service -d db_name [-s service_name] [-a] [-S level]
srvctl config service -d db_name -a -- -a shows TAF configuration
srvctl config service -d TEST -s test PREF:TST1 AVAIL:TST2

srvctl modify service -d db_name -s service_name -i old_inst_name -t new_inst_name [-f]
srvctl modify service -d db_name -s service_name -i avail_inst_name -r [-f]
srvctl modify service -d db_name -s service_name -n -i preferred_list [-a available_list] [-f]
srvctl modify service -d db_name -s service_name -i old_inst_name -a avail_inst -P TAF_policy
srvctl modify serv -d PROD -s DWH -n -i I1,I2,I3,I4 -a I5,I6

srvctl relocate service -d db_name -s service_name –i old_inst_name -t target_inst [-f]

srvctl getenv service -d db_name -s service_name -t name_list
srvctl setenv service -d db_name [-s service_name] {-t "name=val[,name=val,...]" | -T "name=val"}
srvctl unsetenv service -d db_name -s service_name -t name_list

In 11g Release 2, some command's syntax has been changed:
srvctl add service -d db_unique_name -s service_name [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC|MANUAL}] [-q {true|false}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}][-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}][-z failover_retries] [-w failover_delay]
srvctl add service -d rac -s rac1 -q TRUE -m BASIC -e SELECT -z 180 -w 5 -j LONG

srvctl add service -d db_unique_name -s service_name -u {-r preferred_list | -a available_list}

srvctl add service -d db_unique_name -s service_name
-g server_pool [-c {UNIFORM|SINGLETON}] [-k network_number]
[-l [PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY]
[-y {AUTOMATIC|MANUAL}] [-q {TRUE|FALSE}] [-j {SHORT|LONG}]
[-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}]
[-m {NONE|BASIC}] [-P {BASIC|NONE|PRECONNECT}] [-x {TRUE|FALSE}]
[-z failover_retries] [-w failover_delay]


srvctl add service -d db_unique_name -s service_name -r preferred_list [-a available_list] [-P {BASIC|NONE|PRECONNECT}]
[-l [PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY]
[-y {AUTOMATIC|MANUAL}] [-q {TRUE|FALSE}] [-j {SHORT|LONG}]
[-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}]
[-m {NONE|BASIC}] [-x {TRUE|FALSE}] [-z failover_retries] [-w failover_delay]
srvctl add serv -d dev -s sales -r dev01,dev02 -a dev03 -P PRECONNECT

srvctl start service -d db_unique_name [-s "service_name_list" [-n node_name | -i instance_name]] [-o start_options]
srvctl start serv -d dev -s dev
srvctl start service -d dev -s dev -i dev2

srvctl stop service -d db_unique_name [-s "service_name_list"] [-n node_name | -i instance_name] [-f]
srvctl stop service -d dev -s dev
srvctl stop serv -d dev -s dev -i dev2

srvctl status service -d db_unique_name [-s "service_name_list"] [-f] [-v]
srvctl status service -d dev -s dev -v

srvctl enable service -d db_unique_name -s "service_name_list" [-i instance_name | -n node_name]
srvctl enable service -d dev -s dev
srvctl enable serv -d dev -s dev -i dev1

srvctl disable service -d db_unique_name -s "service_name_list" [-i instance_name | -n node_name]
srvctl disable service -d dev -s "dev,marketing"
srvctl disable serv -d dev -s dev -i dev1

srvctl config service -d db_unique_name [-s service_name] [-a]
srvctl config service -d dev -s dev

srvctl modify service -d db_unique_name -s service_name
[-c {UNIFORM|SINGLETON}] [-P {BASIC|PRECONNECT|NONE}]
[-l {[PRIMARY]|[PHYSICAL_STANDBY]|[LOGICAL_STANDBY]|[SNAPSHOT_STANDBY]} [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z failover_retries] [-w failover_delay] [-y {AUTOMATIC|MANUAL}]
srvctl modify service -d db_unique_name -s service_name -i old_instance_name -t new_instance_name [-f]
srvctl modify service -d db_unique_name -s service_name -i avail_inst_name -r [-f]
srvctl modify service -d db_unique_name -s service_name -n -i preferred_list [-a available_list] [-f]
srvctl modify service -d dev -s dev -i dev1 -t dev2
srvctl modify serv -d dev -s dev -i dev1 -r
srvctl modify service -d dev -s dev -n -i dev1 -a dev2

srvctl relocate service -d db_unique_name -s service_name {-c source_node -n target_node|-i old_instance_name -t new_instance_name} [-f]
srvctl relocate service -d dev -s dev -i dev1 -t dev3

Nodeapps:
#srvctl add nodeapps -n node_name -o ORACLE_HOME -A name|ip/netmask[/if1[|if2|...]]
#srvctl add nodeapps -n lnx02 -o $ORACLE_HOME -A 192.168.0.151/255.255.0.0/eth0

#srvctl remove nodeapps -n node_names [-f]

#srvctl start nodeapps -n node_name -- Starts GSD, VIP, listener & ONS

#srvctl stop nodeapps -n node_name [-r] -- Stops GSD, VIP, listener & ONS

#srvctl status nodeapps -n node_name

#srvctl config nodeapps -n node_name [-a] [-g] [-o] [-s] [-l]
-a Display VIP configuration
-g Display GSD configuration
-s Display ONS daemon configuration
-l Display listener configuration

#srvctl modify nodeapps -n node_name [-A new_vip_address]
#srvctl modify nodeapps -n lnx06 -A 10.50.99.43/255.255.252.0/eth0

#srvctl getenv nodeapps -n node_name [-t name_list]

#srvctl setenv nodeapps -n node_name {-t "name=val[,name=val,...]"|-T "name=val"}
#srvctl setenv nodeapps –n adcracdbq3 –t “TNS_ADMIN=/u01/app/oracle/product/11.1/asm/network/admin”

#srvctl unsetenv nodeapps -n node_name [-t name_list]

In 11g Release 2, some command's syntax has been changed:
srvctl add nodeapps -n node_name -A {name|ip}/netmask[/if1[|if2|...]] [-m multicast_ip_address] [-p multicast_port_number] [-l ons_local_port] [-r ons_remote-port] [-t host[:port][,host[:port],...]] [-v]
srvctl add nodeapps -S subnet/netmask[/if1[|if2|...]] [-d dhcp_server_type] [-m multicast_ip_address] [-p multicast_port_number] [-l ons_local_port] [-r ons_remote-port] [-t host[:port][,host[:port],...]] [-v]
#srvctl add nodeapps -n devnode1 -A 1.2.3.4/255.255.255.0

srvctl remove nodeapps [-f] [-y] [-v]
srvctl remove nodeapps

srvctl start nodeapps [-n node_name] [-v]
srvctl start nodeapps

srvctl stop nodeapps [-n node_name] [-r] [-v]
srvctl stop nodeapps

srvctl status nodeapps

srvctl enable nodeapps [-g] [-v]
srvctl enable nodeapps -g -v

srvctl disable nodeapps [-g] [-v]
srvctl disable nodeapps -g -v

srvctl config nodeapps [-a] [-g] [-s] [-e]
srvctl config nodeapps -a -g -s -e

srvctl modify nodeapps [-n node_name -A new_vip_address] [-S subnet/netmask[/if1[|if2|...]] [-m multicast_ip_address] [-p multicast_port_number] [-e eons_listen_port] [-l ons_local_port] [-r ons_remote_port] [-t host[:port][,host:port,...]] [-v]
srvctl modify nodeapps -n mynode1 -A 100.200.300.40/255.255.255.0/eth0

srvctl getenv nodeapps [-a] [-g] [-s] [-e] [-t "name_list"] [-v]
srvctl getenv nodeapps -a

srvctl setenv nodeapps {-t "name=val[,name=val][...]" | -T "name=val"} [-v]
srvctl setenv nodeapps -T "CLASSPATH=/usr/local/jdk/jre/rt.jar" -v

srvctl unsetenv nodeapps -t "name_list" [-v]
srvctl unsetenv nodeapps -t "test_var1,test_var2"

srvctl add asm -n node_name -i asminstance -o ORACLE_HOME [-p spfile]

srvctl remove asm -n node_name [-i asminstance] [-f]
srvctl remove asm -n db6

srvctl start asm -n node_name [-i asminstance] [-o start_options] [-c connect_str|-q]
srvctl start asm -n node_name [-i asminstance] [-o open]
srvctl start asm -n node_name [-i asminstance] -o nomount
srvctl start asm -n node_name [-i asminstance] -o mount
srvctl start asm -n linux01

srvctl stop asm -n node_name [-i asminstance] [-o stop_options] [-c connect_str|-q]
srvctl stop asm -n node_name [-i asminstance] [-o normal]
srvctl stop asm -n node_name [-i asminstance] -o transactional
srvctl stop asm -n node_name [-i asminstance] -o immediate
srvctl stop asm -n node_name [-i asminstance]-o abort
srvctl stop asm -n racnode1
srvctl stop asm -n devnode1 -i +asm1

srvctl status asm -n node_name
srvctl status asm -n racnode1

srvctl enable asm -n node_name [-i asminstance]
srvctl enable asm -n lnx03 -i +asm3

srvctl disable asm -n node_name [-i asminstance]
srvctl disable asm -n lnx02 -i +asm2

srvctl config asm -n node_name
srvctl config asm -n lnx08

srvctl modify asm -n node_name -i asminstance [-o ORACLE_HOME] [-p spfile]
srvctl modify asm –n rac6 -i +asm6 –o /u01/app/oracle/product/11.1/asm

In 11g Release 2, some command's syntax has been changed:
srvctl add asm [-l lsnr_name] [-p spfile] [-d asm_diskstring]
srvctl add asm
srvctl add asm -l LISTENERASM -p +dg_data/spfile.ora

srvctl remove asm [-f]
srvctl remove asm -f

srvctl start asm [-n node_name] [-o start_options]
srvctl start asm -n devnode1

srvctl stop asm [-n node_name] [-o stop_options] [-f]
srvctl stop asm -n devnode1 -f

srvctl status asm [-n node_name] [-a]
srvctl status asm -n devnode1 -a

srvctl enable asm [-n node_name]
srvctl enable asm -n devnode1

srvctl disable asm [-n node_name]
srvctl disable asm -n devnode1

srvctl config asm [-a]
srvctl config asm -a

srvctl modify asm [-l lsnr_name] [-p spfile] [-d asm_diskstring]
srvctl modify asm [-n node_name] [-l listener_name] [-d asm_diskstring] [-p spfile_path_name]
srvctl modify asm -l lsnr1

srvctl getenv asm [-t name[, ...]]
srvctl getenv asm

srvctl setenv asm {-t "name=val [,...]" | -T "name=value"}
srvctl setenv asm -t LANG=en

srvctl unsetenv asm -t "name[, ...]"
srvctl unsetenv asm -t CLASSPATH

Listener:
srvctl add listener -n node_name -o ORACLE_HOME [-l listener_name]
-- 11gR1 command

srvctl remove listener -n node_name [-l listener_name] -- 11gR1 command

srvctl start listener -n node_name [-l listener_names]
srvctl start listener -n node1

srvctl stop listener -n node_name [-l listener_names]
srvctl stop listener -n node1

srvctl status listener [-n node_name] [-l listener_names] --
11gR1 command
srvctl status listener -n node2

srvctl config listener -n node_name

srvctl modify listener -n node_name [-l listener_names] -o ORACLE_HOME
-- 11gR1 command
srvctl modify listener -n racdb4 -o /u01/app/oracle/product/11.1/asm -l "LISTENER_RACDB4"

In 11g Release 2, some command's syntax has been changed:
srvctl add listener [-l lsnr_name] [-s] [-p "[TCP:]port[, ...][/IPC:key][/NMP:pipe_name][/TCPS:s_port] [/SDP:port]"] [-k network_number] [-o ORACLE_HOME]
srvctl add listener -l LISTENERASM -p "TCP:1522" -o $ORACLE_HOME
srvctl add listener -l listener112 -p 1341 -o /ora/ora112

srvctl remove listener [-l lsnr_name|-a] [-f]
srvctl remove listener -l lsnr01

srvctl stop listener [-n node_name] [-l lsnr_name] [-f]

srvctl enable listener [-l lsnr_name] [-n node_name]
srvctl enable listener -l listener_dev -n node5

srvctl disable listener [-l lsnr_name] [-n node_name]
srvctl disable listener -l listener_dev -n node5

srvctl config listener [-l lsnr_name] [-a]
srvctl config listener

srvctl modify listener [-l listener_name] [-o oracle_home] [-u user_name] [-p "[TCP:]port_list[/IPC:key][/NMP:pipe_name][/TCPS:s_port][/SDP:port]"] [-k network_number]
srvctl modify listener -n node1 -p "TCP:1521,1522"

srvctl getenv listener [-l lsnr_name] [-t name[, ...]]
srvctl getenv listener

srvctl setenv listener [-l lsnr_name] {-t "name=val [,...]" | -T "name=value"}
srvctl setenv listener -t LANG=en

srvctl unsetenv listener [-l lsnr_name] -t "name[, ...]"
srvctl unsetenv listener -t "TNS_ADMIN"

New srvctl commands in 11g Release 2

Diskgroup:
srvctl remove diskgroup -g diskgroup_name [-n node_list] [-f]
srvctl remove diskgroup -g DG1 -f

srvctl start diskgroup -g diskgroup_name [-n node_list]
srvctl start diskgroup -g diskgroup1 -n node1,node2

srvctl stop diskgroup -g diskgroup_name [-n node_list] [-f]
srvctl stop diskgroup -g ASM_FRA_DG
srvctl stop diskgroup -g dg1 -n node1,node2 -f

srvctl status diskgroup -g diskgroup_name [-n node_list] [-a]
srvctl status diskgroup -g dg_data -n node1,node2 -a

srvctl enable diskgroup -g diskgroup_name [-n node_list]
srvctl enable diskgroup -g diskgroup1 -n node1,node2

srvctl disable diskgroup -g diskgroup_name [-n node_list]
srvctl disable diskgroup -g dg_fra -n node1, node2

Home:
srvctl start home -o ORACLE_HOME -s state_file [-n node_name]
srvctl start home -o /u01/app/oracle/product/11.2.0/db_1 -s ~/state.txt

srvctl stop home -o ORACLE_HOME -s state_file [-t stop_options] [-n node_name] [-f]
srvctl stop home -o /u01/app/oracle/product/11.2.0/db_1 -s ~/state.txt

srvctl status home -o ORACLE_HOME -s state_file [-n node_name]
srvctl status home -o /u01/app/oracle/product/11.2.0/db_1 -s ~/state.txt

ONS (Oracle Notification Service) :

srvctl add ons [-l ons-local-port] [-r ons-remote-port] [-t host[:port][,host[:port]...]] [-v]
srvctl add ons -l 6200

srvctl remove ons [-f] [-v]
srvctl remove ons -f

srvctl start ons [-v]
srvctl start ons -v

srvctl stop ons [-v]
srvctl stop ons -v

srvctl status ons

srvctl enable ons [-v]
srvctl enable ons

srvctl disable ons [-v]
srvctl disable ons

srvctl config ons

srvctl modify ons [-l ons-local-port] [-r ons-remote-port] [-t host[:port][,host[:port]...]] [-v]
srvctl modify ons

EONS:
srvctl add eons [-p portnum] [-m multicast-ip-address] [-e eons-listen-port] [-v]
#srvctl add eons -p 2018

srvctl remove eons [-f] [-v]
srvctl remove eons -f

srvctl start eons [-v]
srvctl start eons

srvctl stop eons [-f] [-v]
srvctl stop eons -f

srvctl status eons

srvctl enable eons [-v]
srvctl enable eons

srvctl disable eons [-v]
srvctl disable eons

srvctl config eons

srvctl modify eons [-m multicast_ip_address] [-p multicast_port_number] [-e eons_listen_port] [-v]
srvctl modify eons -p 2018

FileSystem:
srvctl add filesystem -d volume_device -v volume_name -g diskgroup_name [-m mountpoint_path] [-u user_name]
srvctl add filesystem -d /dev/asm/d1volume1 -v VOLUME1 -d RAC_DATA -m /oracle/cluster1/acfs1

srvctl remove filesystem -d volume_device_name [-f]
srvctl remove filesystem -d /dev/asm/racvol1

srvctl start filesystem -d volume_device_name [-n node_name]
srvctl start filesystem -d /dev/asm/racvol3

srvctl stop filesystem -d volume_device_name [-n node_name] [-f]
srvctl stop filesystem -d /dev/asm/racvol1 -f

srvctl status filesystem -d volume_device_name
srvctl status filesystem -d /dev/asm/racvol2

srvctl enable filesystem -d volume_device_name
srvctl enable filesystem -d /dev/asm/racvol9

srvctl disable filesystem -d volume_device_name
srvctl disable filesystem -d /dev/asm/racvol1

srvctl config filesystem -d volume_device_path

srvctl modify filesystem -d volume_device_name -u user_name
srvctl modify filesystem -d /dev/asm/racvol1 -u sysadmin

SrvPool:
srvctl add srvpool -g server_pool [-i importance] [-l min_size] [-u max_size] [-n node_list] [-f]
srvctl add srvpool -g SP1 -i 1 -l 3 -u 7 -n node1,node2

srvctl remove srvpool -g server_pool
srvctl remove srvpool -g srvpool1

srvctl status srvpool [-g server_pool] [-a]
srvctl status srvpool -g srvpool2 -a

srvctl config srvpool [-g server_pool]
srvctl config srvpool -g dbpool

srvctl modify srvpool -g server_pool [-i importance] [-l min_size] [-u max_size] [-n node_name_list] [-f]
srvctl modify srvpool -g srvpool4 -i 0 -l 2 -u 4 -n node3, node4

Server:
srvctl status server -n "server_name_list" [-a]
srvctl status server -n server11 -a

srvctl relocate server -n "server_name_list" -g server_pool_name [-f]
srvctl relocate server -n "linux1, linux2" -g sp2

Scan (Single Client Access Name):

srvctl add scan -n scan_name [-k network_number] [-S subnet/netmask[/if1[|if2|...]]]
#srvctl add scan -n scan.mycluster.example.com

srvctl remove scan [-f]
srvctl remove scan -f

srvctl start scan [-i ordinal_number] [-n node_name]
srvctl start scan -i 1 -n node1

srvctl stop scan [-i ordinal_number] [-f]
srvctl stop scan -i 1

srvctl status scan [-i ordinal_number]
srvctl status scan -i 1

srvctl enable scan [-i ordinal_number]
srvctl enable scan -i 1

srvctl disable scan [-i ordinal_number]
srvctl disable scan -i 3

srvctl config scan [-i ordinal_number]
srvctl config scan -i 2

srvctl modify scan -n scan_name
srvctl modify scan -n scan1

srvctl relocate scan -i ordinal_number [-n node_name]
srvctl relocate scan -i 2 -n node2

ordinal_number=1,2,3

Scan_listener:
srvctl add scan_listener [-l lsnr_name_prefix] [-s] [-p "[TCP:]port_list[/IPC:key][/NMP:pipe_name][/TCPS:s_port] [/SDP:port]"]
#srvctl add scan_listener -l myscanlistener

srvctl remove scan_listener [-f]
srvctl remove scan_listener -f

srvctl start scan_listener [-n node_name] [-i ordinal_number]
srvctl start scan_listener -i 1

srvctl stop scan_listener [-i ordinal_number] [-f]
srvctl stop scan_listener -i 3

srvctl status scan_listener [-i ordinal_number]
srvctl status scan_listener -i 1

srvctl enable scan_listener [-i ordinal_number]
srvctl enable scan_listener -i 2

srvctl disable scan_listener [-i ordinal_number]
srvctl disable scan_listener -i 1

srvctl config scan_listener [-i ordinal_number]
srvctl config scan_listener -i 3

srvctl modify scan_listener {-p [TCP:]port[/IPC:key][/NMP:pipe_name] [/TCPS:s_port][/SDP:port] | -u }
srvctl modify scan_listener -u

srvctl relocate scan_listener -i ordinal_number [-n node_name]
srvctl relocate scan_listener -i 1

ordinal_number=1,2,3

GNS (Grid Naming Service):
srvctl add gns -i ip_address -d domain
srvctl add gns -i 192.124.16.96 -d cluster.mycompany.com

srvctl remove gns [-f]
srvctl remove gns

srvctl start gns [-l log_level] [-n node_name]
srvctl start gns

srvctl stop gns [-n node_name [-v] [-f]
srvctl stop gns

srvctl status gns [-n node_name]
srvctl status gns

srvctl enable gns [-n node_name]
srvctl enable gns

srvctl disable gns [-n node_name]
srvctl disable gns -n devnode2

srvctl config gns [-a] [-d] [-k] [-m] [-n node_name] [-p] [-s] [-V] [-q name] [-l] [-v]
srvctl config gns -n lnx03

srvctl modify gns [-i ip_address] [-d domain]
srvctl modify gns -i 192.000.000.007

srvctl relocate gns [-n node_name]
srvctl relocate gns -n node2

VIP (Virtual Internet Protocol):
srvctl add vip -n node_name -A {name|ip}/netmask[/if1[if2|...]] [-k network_number] [-v]
#srvctl add vip -n node96 -A 192.124.16.96/255.255.255.0 -k 2

srvctl remove vip -i "vip_name_list" [-f] [-y] [-v]
srvctl remove vip -i "vip1,vip2,vip3" -f -y -v

srvctl start vip {-n node_name|-i vip_name} [-v]
srvctl start vip -i dev1-vip -v

srvctl stop vip {-n node_name|-i vip_name} [-r] [-v]
srvctl stop vip -n node1 -v

srvctl status vip {-n node_name|-i vip_name}
srvctl status vip -i node1-vip

srvctl enable vip -i vip_name [-v]
srvctl enable vip -i prod-vip -v

srvctl disable vip -i vip_name [-v]
srvctl disable vip -i vip3 -v

srvctl config vip {-n node_name|-i vip_name}
srvctl config vip -n devnode2

srvctl getenv vip -i vip_name [-t "name_list"] [-v]
srvctl getenv vip -i node1-vip

srvctl setenv vip -i vip_name {-t "name=val[,name=val,...]" | -T "name=val"}
srvctl setenv vip -i dev1-vip -t LANG=en

srvctl unsetenv vip -i vip_name -t "name_list" [-v]
srvctl unsetenv vip -i myvip -t CLASSPATH

OC4J (Oracle Container for Java):
srvctl add oc4j [-v]
srvctl add oc4j

srvctl remove oc4j [-f] [-v]
srvctl remove oc4j

srvctl start ocj4 [-v]
srvctl start ocj4 -v

srvctl stop oc4j [-f] [-v]
srvctl stop oc4j -f -v

srvctl status oc4j [-n node_name]
srvctl status oc4j -n lnx01

srvctl enable oc4j [-n node_name] [-v]
srvctl enable oc4j -n dev3

srvctl disable oc4j [-n node_name] [-v]
srvctl disable oc4j -n dev1

srvctl config oc4j

srvctl modify oc4j -p oc4j_rmi_port [-v]
srvctl modify oc4j -p 5385

srvctl relocate oc4j [-n node_name] [-v]
srvctl relocate oc4j -n lxn06 -v

Number of Visitors