You are on page 1of 8

Help from server srvctl help ==================== Usage: srvctl <command> <object> [<options>] commands: enable|disable|start|stop|relocate|status|add|remove|modify|getenv |setenv|unsetenv|config objects:

database|instance|service|nodeapps|vip|asm|diskgroup|listener|srvpo ol|server|scan|scan_listener|oc4j|home|filesystem|gns For detailed help on each command and object and its options use: srvctl <command> -h or srvctl <command> <object> -h ieo2blsoadbp02> srvctl status -h The SRVCTL status command displays the current state of the object. Usage: srvctl status database -d <db_unique_name> [-f] [-v] Usage: srvctl status instance -d <db_unique_name> {-n <node_name> | -i <inst_nam e_list>} [-f] [-v] Usage: srvctl status service -d <db_unique_name> [-s "<service_name_list>"] [-f] [-v] Usage: srvctl status nodeapps Usage: srvctl status vip { -n <node_name> | -i <vip_name> } Usage: srvctl status listener [-l <lsnr_name>] [-n <node_name>] Usage: srvctl status asm [-n <node_name>] [-a] Usage: srvctl status scan [-i <ordinal_number>] Usage: srvctl status scan_listener [-i <ordinal_number>] Usage: srvctl status srvpool [-g <pool_name>] [-a] Usage: srvctl status server -n "<server_list>" [-a] Usage: srvctl status oc4j [-n <node_name>] Usage: srvctl status home -o <oracle_home> -s <state_file> -n <node_name> Usage: srvctl status filesystem -d <volume_device> Usage: srvctl status diskgroup -g <dg_name> [-n "<node_list>"] [-a] Usage: srvctl status gns -n <node_name> For detailed help on each command and object and its options use: srvctl <command> <object> -h ==================== srvctl status instance -h Displays the current state of the database instance. Usage: srvctl status instance -d <db_unique_name> {-n <node_name> | -i <inst_nam e_list>} [-f] [-v] -d <db_unique_name> Unique name for the database -n <node_name> Node name -i "<inst,...>" Comma separated instance names -f Include disabled applications -v Verbose output -h Print usage

====================

From Linux prompt: srvctl add database -d -o $ORACLE_HOME srvctl add instance -d test10g -i test10g1 -n rac1 srvctl add instance -d test10g -i test10g2 -n rac2 srvctl start instance -d test10g -i test10g1

From Linux prompt: srvctl add database -d -o $ORACLE_HOME srvctl add instance -d test10g -i test10g1 -n rac1 srvctl add instance -d test10g -i test10g2 -n rac2 srvctl start instance -d test10g -i test10g1 What is srvctl? it is the Server Control Utility, we use SRVCTL to start and sto p the database and instances, manage configuration information, and to add, move or remove instances and services. These are some of the srvctl commands I frequently use, this is not a complete r eference guide. I organized the commands as follow: To To To To To start a rac database stop a rac database check status and configurations start and stop instances start, stop and manage services

Start a rac database (order: nodeapps asm database) ==================================================================== srvctl start srvctl start srvctl start options are: nodeapps -n nodename asm -n nodename database -d dbname srvctl start database -d dbname -o open | -o mount | -o nomount

Stop a rac database (order: database asm nodeapps) ==================================================================== srvctl stop database -d dbname -o immediate options are: srvctl stop database -d dbname -o normal | -o transactional | -o im

mediate | -o abort srvctl stop asm -n nodename options are: srvctl stop asm -n nodename -o immediate srvctl stop nodeapps -n nodename To check status and configurations Nodeapps: srvctl status nodeapps -n nodename srvctl config nodeapps -n nodename ASM: ====================================================================

srvctl status srvctl config Database: srvctl status srvctl config

asm -n nodename asm -n nodename database -d dbname database -d dbname (shows instances name, node and oracle home)

Instance: srvctl status instance -d dbname -i instancename Services: srvctl status service -d dbname To start and stop instances ==================================================================== srvctl start instance -d dbname -i instancename srvctl stop instance -d dbname -i instancename To start, stop and manage services srvctl status service -d dbname srvctl config service -d dbname srvctl start service -d dbname -s servicename srvctl stop service -d dbname -s servicename srvctl relocate service -d dbname -s servicename -i instancename -t newinstancen ame [-f]

To manage the RAC environment, first build a configuration profile and optionall y save it. The configuration can be built by commands such as add and setenv. It is a good practice to build configuration profiles and export them to ASCII fil es. SRVCTL syntax has the following components: > srvctl verb noun options Where:

srvctl is the SRVCTL command. verb is an action word such as start, stop, or remove. noun is an object upon which SRVCTL performs the action verb, such as a database or instance. Alternatively, abbreviations can be used, which in this case are d b and inst respectively. options extends the use of preceding verb-noun combinations. To see the online command syntax and options for each SRVCTL command, enter: > srvctl verb noun -h Table 8.9 shows the common SRVCTL verbs. VERB DESCRIPTION add Add a database or instance. config Lists the configuration for the database or instance. Getenv Lists the environment variables in the SRVM configuration. Modify Modifies the instance configuration. remove Removes the database or instance. Setenv Sets the environment variable in the SRVM configuration. Start Starts the database or instance. Status Status of the database or instance. Stop Stops the database or instance. Unsetenv Sets the environment variable in the SRVM configuration to unspecified Table 8.9: Common SRVCTL verbs Table 8.10 shows the common srvctl nouns. NOUN ABBREVIATION DESCRIPTION database

db Operation refers to objects for the database. asm asm To add, configure, enable, start, obtain the status of, stop, disable, and remo ve ASM instances. instance Inst Operation refers to objects for the instances. nodeapps no abbreviation To add, configure, modify, manage environment variables for, start, obtain the status of, stop, and remove node applications. Service serv To add, configure, modify, manage environment variables for, enable, start, obt ain the status of, relocate, disable, stop, and remove services from your cluste r database. Table 8.10: Common SRVCTL nouns Table 8.11 shows the common srvctl command options. OPTION MEANING -d Database name -h Print Usage -i Comma-separated list of instance names -n Node names or comma-separated node list Table 8.11: Common SRVCTL command options Some commonly used commands will be examined next. srvctl add This command adds configuration information for the database or for named instan ces. Command specific actions for add command: OPTION MEANING -n Node name that will support an instance. -o

$ORACLE_HOME to locate lsnrctl (node option) and oracle binaries (other options ) -s SPFILE name -m Database domain name, in the form For example, to add a new database: > srvctl add database -d racdb -o /app/oracle/product/920 To add named instances to a database: > srvctl add instance -d racdb -i rac1 -n mynode1 > srvctl add instance -d racdb -i rac2 -n mynode2 > srvctl add instance -d racdb -i rac3 -n mynode3 srvctl config This command displays a list of configured databases. The syntax is: srvctl config database -d database_name For example, to display configured databases: > srvctl config database -d RACDB Gives the output: mynode1 RACDB1 /app/oracle/product/dbms/920 mynode2 RACDB2 /app/oracle/product/dbms/920 srvctl getenv This command displays values for the environment from the SRVM configuration fil e. The syntax is: > srvctl getenv database -d database_name [-t name] > srvctl getenv instance -d database_name -i instance_name [-t name] For example, to list all environment variables for a database: > srvctl getenv database srvctl setenv d racdb us.domain.com

This command sets values for the environment in the SRVM configuration file. The syntax is: > srvctl setenv database -d database_name -t name=value [,name=value, ] srvctl setenv instance -d database_name [-i instance_name] -t name=value [,name=value, ] For example, to set list all environment variables for a database: > srvctl setenv database -d mydb -t LANG=en

srvctl start This command starts the database, all or named instances, and all listeners asso ciated with the database. The syntax is: > srvctl start database -d database_name [-o start_options] [-c connect_string] > srvctl start instance -d database_name -i instance_name [,insta_name-list] [-o start_options] [-c connect_string] Command-Specific Options for srvctl start OPTION MEANING -o Options passed directly to startup command in SQL*Plus including PFILE. -c Connect string for connecting to the Oracle instance using SQL*Plus. For example, to start the database and all enabled instances: > srvctl start database -d mydb To start specified instances: > srvctl start instance -d racdb -i racdb1, racdb3 srvctl status This command displays the status of the database and instance. The syntax is: > srvctl status database -d database_name > srvctl status instance -d database_name -i instance_name [,instance_name-list] For example, to get the current status of two instances: > srvctl status instance -d RAC -i racdb1, racdb2 Gives the output: Instance RACDB1 is running on node mynode1 Instance RACDB2 is not running on node mynode1 srvctl stop This command stops the database and all or named instances. The syntax is: > srvctl stop database -d database_name [-o stop_options] [-c connect_string] > srvctl stop instance -d database_name -i instance_name [,instance_name_list] [-o stop_options][-c connect_string] For example, to stop the database all instances:

> srvctl stop database -d RACDB To stop named instances: > srvctl stop instance -d RACDB -i racdb1 Use the srvconfig command to export/import the SRVM configuration information. T he following is an example of how to export the contents of the configuration in formation to the text file: > srvconfig -exp file_name To import the configuration information from the text file named to the configur ation repository for the RAC, use the command: > srvconfig -imp file_name

You might also like