Detailed description of the SRVCTL command in ORACLE RAC

Source: Internet
Author: User

Detailed description of the SRVCTL command in ORACLE RAC
Introduction:

SRVCTL is a tool for managing the configuration of ORACLE9i RAC clusters. This document describes all the commands of SRVCTL in detail.
Target Audience: ORACLE9i RAC Database Cluster Administrator.
Note:
RAC: Real Application Clusters
SRVM: Server Management
-------------------------------------------------------------------------------
L SRVCTL Add
Add database or instance configuration information. In the Add instance, the name specified with-I should match the INSTANCE_NAME and ORACLE_SID parameters.
Srvctl add database-d database_name [-m domain_name]-o oracle_home [-s spfile]
Srvctl add instance-d database_name-I instance_name-n node_name
Table 4-5 detailed options of the SRVCTL Add command
-------------------------------------------------------------------------------
Command Options
-------------------------------------------------------------------------------
-The m database domain name format is as follows: "us.mydomain.com"
-The database domain name specified by the m option must match the DB_DOMAIN and DB_NAME parameters in the database INIT. ORA or SPFILE. When adding a database, the database name specified by-d must match the DB_NAME parameter.
-N instance node name
-O $ ORACLE_HOME (used to determine the command paths such as lsnrctl and Oracle)
-S SPFILE file name
-------------------------------------------------------------------------------
Instance: Add a new database
Srvctl add database-d mydb-o/ora/ora9
Instance: add an instance to a database
Srvctl add instance-d mydb-I mydb01-n gm01
Srvctl add instance-d mydb-I mydb02-n gm02
Srvctl add instance-d mydb-I mydb03-n gm03
SRVCTL Config
Displays the configuration information stored in the SRVM configuration file.
Srvctl config database
Display Database Configuration list
Srvctl config database-d database_name
Format of the database configuration information:
Nodename1 instancename1 oraclehome
Nodename2 instancename2 oraclehome
Instance: displays database configuration information
Srvctl config database-d mydb
L SRVCTL Getenv
The getenv operation is used to obtain and display environment variables from the SRVM configuration file.
Srvctl getenv database-d database_name [-t name [, name,...]
Srvctl getenv instance-d database_name-I instance_name [-t name [, name,...]
Instance: Lists All environment variables of a database.
Srvctl getenv database-d mydb
L SRVCTL Modify
Modify the node configuration of an instance. These changes will take effect after the next restart of the program. The modified information will be permanently saved.
Srvctl modify instance-d database_name-I instance_name-n node_name
Instance: modifies an instance to another node.
Srvctl modify instance-d mydb-n my_new_node
L SRVCTL Remove
This is a command used to delete configuration information in the SRVM library. The environment settings related to objects are also deleted. If you do not use the force sign (-f), ORACLE will prompt you to confirm whether to delete it.
If you use the force option (-f), the deletion operation will not be prompted.
Srvctl remove database-d database_name [-f]
Srvctl remove instance-d database_name-I instance_name [-f]
Detailed options of the SRVCTL Remove command
-------------------------------------------------------------------------------
-F no confirmation prompt is prompted when the application is forcibly deleted
-------------------------------------------------------------------------------
Instance: delete a database
Srvctl remove database-d mydb
Instance: deletes a database instance.
Srvctl remove instance-d mydb-I mydb01
Srvctl remove instance-d mydb-I mydb02
Srvctl remove instance-d mydb-I mydb03
L SRVCTL Setenv
Set the environment variable value in the SRVM configuration file.
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,...]
Instance: Set database environment variables
Srvctl setenv database-d mydb-t LANG = en
L SRVCTL Start
Start the database, all instances or specified instances, and start all related unstarted listeners.
-------------------------------------------------------------------------------
Note:
For the start command and other operations that can use the connection string, if you do not provide the connection string, ORACLE will use "/as sysdba" to perform related operations on the instance. In addition, to perform similar operations, you must be a member of the OSDBA group. For more OSDBA group permissions, see the ORACLE9i Installation Guide.
-------------------------------------------------------------------------------
Srvctl start database-d database_name [-o start_options] [-c connect_string]
Srvctl start instance-d database_name-I instance_name [, instance_name-list] [-o start_options] [-c connect_string]
Table 4-6 detailed options of the SRVCTL Start command
-------------------------------------------------------------------------------
Command Options
-------------------------------------------------------------------------------
-O startup Command Options directly transmitted in SQL * Plus, which can include PFILE
-C use SQL * Plus to connect to the database instance's connection string
-------------------------------------------------------------------------------
Instance: Start the database and all instances.
Srvctl start database-d mydb
Instance: Start a specified instance
Srvctl start instance-d mydb-I mydb1, mydb4
L SRVCTL Status
Displays the current status of the specified database
Srvctl status database-d database_name
Srvctl status instance-d database_name-I instance_name [, instance_name-list]
Instance: displays data and all instance statuses.
Srvctl status database-d mydb
Instance: displays the status of the specified instance.
Srvctl status instance-d mydb-I mydb1, mydb2
L SRVCTL Stop
Stop all database instances specified by the user
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]
Table 4-7 SRVCTL Stop commands
-------------------------------------------------------------------------------
Command Options
-------------------------------------------------------------------------------
-C use SQL * Plus to connect to the database instance's connection string
-O shutdown command option passed directly in SQL * Plus
-------------------------------------------------------------------------------
Instance: stops all database instances.
Srvctl stop database-d mydb
Instance: Stop a specified instance
Srvctl stop instance-d mydb-I mydb1
L SRVCTL Unsetenv
Cancel the environment variable definition value in the SRVM configuration file
Srvctl unsetenv database-d database_name-t name [, name,...]
Srvctl unsetenv instance-d database_name [-I instance_name]-t name [, name,...]
Instance: cancels the environment variable and returns to the default value.
Srvctl unsetenv database-d mydb-t CLASSPATH
L use SRVCONFIG to import and export RAW device configuration information
You can use SRVCONFIG to import and export RAW device configuration information, whether on the cluster file system or RAW device. You can use this method to back up and restore the SRVM configuration information.
For example:
The following command is used to export the configuration information to a text file with the specified file name.
Srvconfig-exp file_name
The following command is used to import configuration information from a specified text file to the RAC environment configuration information library where you run the command.
Srvconfig-imp file_name
Use SRVCTL to add database information
If you use DBCA to create a database, after creating the RAC database, DBCA automatically adds the database information to the SRVCTL manager.
However, if you manually create a database or restore a database through backup, you need to manually add the database information.
Currently, two RAC databases are installed on the server, rac11g and ractest. ractest is created through dbca, and rac11g is restored through backup.
$ Srvctl status database-d rac11g
PRKR-1001: cluster database rac11gdoes not exist
PRKO-2005: Application error: Failure in getting Cluster Database Configuration for: rac11g
$ Srvctl status database-d ractest
Instance ractest1 is running on node ser1
Instance ractest2 is running on node ser2
For databases created by dbca, srvctl contains information about databases and instances. For the database that is backed up and restored, rac11g does not contain information about databases and instances.
The following uses the srvctl add command to add database and instance information:
$ Srvctl add database-d rac11g-o/data/oracle/product/11.1/database-m us.oracle.com-p + DATA/RAC11G/spfilerac11g. ora
$ Srvctl add instance-d rac11g-i rac11g1-n ser1
$ Srvctl add instance-d rac11g-i rac11g2-n ser2
Check the database status:
$ Srvctl status database-d rac11g
Instance rac11g1 is not running on node ser1
Instance rac11g2 is not running on node ser2
The database is not started yet. Use the srvctl start command to start the database:
$ Srvctl start db-d rac11g
$ Srvctl status db-d rac11g
$ P82786Instance rac11g1 is running on node ser1
Instance rac11g2 is running on node ser2
Now the RAC database RAC11G can be maintained using the SRVCTL command.
Use the srvctl config command to view the configuration information of the existing database:
Bash-3.00 $ srvctl config database-d rac11g-a
Ser1 rac11g1/data/oracle/product/11.1/database
Ser2 rac11g2/data/oracle/product/11.1/database
DB_UNIQUE_NAME: rac11g
DB_NAME: null
ORACLE_HOME:/data/oracle/product/11.1/database
SPFILE: + DATA/RAC11G/spfilerac11g. ora
DOMAIN: us.oracle.com
DB_ROLE: null
$ R r82786START_OPTIONS: null
POLICY: AUTOMATIC
Enable flag: DB ENABLED

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.