Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

How to Use Server Control Utility (SRVCTL)

To manage the RAC environment, first build a configuration profile and optionally 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 files.

SRVCTL syntax has the following components:
> srvctl verb noun options
Where:
srvctl - the SRVCTL command.
verb - an action word such as start, stop, or remove.
noun - 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 db 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

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

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 remove 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, obtain the status of, relocate, disable, stop, and remove services from your cluster database.

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

Some commonly used commands will be examined next.

srvctl add
This command adds configuration information for the database or for named instances.  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 ?us.domain.com?

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 file. The syntax is:
If "start" is passed,  it should call  $ORACLE_HOME/bin/dbstart.
The dbstart script will read the contents of oratab and starts the database that is as Y.
          If "stop" is passed,  it
> 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 ?d racdb

srvctl setenv
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 associated 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]

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
  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
srvconfig export/import 
Use the srvconfig command to export/import the SRVM configuration information. The following is an example of how to export the contents of the configuration information to the text file:
> srvconfig -exp file_name

Comments

Popular posts from this blog

7 Steps to configure BDR replication in postgresql

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

ERROR: operator does not exist: text ->> unknown LINE 1: ...stomer' as customer_name,sales_info ->>'PRODUCTS' ->>'produc... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

PostgreSQL 11 Source code Installation