Oracle RAC series: Use srvctl to manage RAC Databases

Source: Internet
Author: User

Srvctl is a command line tool provided by Oracle to manage the RAC environment of Oracle. Srvctl is introduced in Oracle 9i. Oracle10g and 11g greatly improve its functions. The following describes the simple usage of this command.

1. view the instance status (srvctl status)
Query the status of all instances and services:
[Oracle @ node-rac1 ~] $ Srvctl status database-d racdb
Instance racdb2 is running on node node-rac2
Instance racdb1 is running on node node-rac1
Query the status of instance racdb1:
[Oracle @ node-rac1 ~] $ Srvctl status instance-d racdb-I racdb1
Instance racdb1 is running on node node-rac1
Query the status of the Instance racdb2:
[Oracle @ node-rac1 ~] $ Srvctl status instance-d racdb-I racdb2
Instance racdb2 is running on node node-rac2
Query the application status on a specific node:
[Oracle @ node-rac1 ~] $ Srvctl status nodeapps-n node-rac2
VIP is running on node: node-rac2
GSD is running on node: node-rac2
Listener is running on node: node-rac2
ONS daemon is running on node: node-rac2
Query the status of the ASM instance on a specific node
[Oracle @ node-rac1 ~] $ Srvctl status asm-n node-rac2
ASM instance + ASM2 is running on node node-rac2.
In the preceding command line operation, the parameters used are:
-D, that is, database name, indicates the database name.
-N, that is, node name, indicates the node name.
-I, that is, instance name, indicates the instance name

Ii. View RAC database settings (srvctl config)
Displays the configuration of the RAC database:
[Oracle @ node-rac1 ~] $ Srvctl config database-d racdb
Node-rac2 racdb2/u01/oracle/product/11.0.6/rac_db
Node-rac1 racdb1/u01/oracle/product/11.0.6/rac_db
List all the configured databases:
[Oracle @ node-rac1 ~] $ Srvctl config database
Racdb
Show the application configurations of the specified node:
[Oracle @ node-rac1 ~] $ Srvctl config nodeapps-n node-rac2
VIP exists.:/node-vip2/192.168.12.240/255.255.255.0/eth0
GSD exists.
ONS daemon exists.
Listener exists.
Display the ASM instance configuration of the specified node:
[Oracle @ node-rac1 ~] $ Srvctl config asm-n node-rac2
+ ASM2/u01/oracle/product/11.0.6/rac_db

Iii. start/stop an instance (srvctl start/stop)
Stop all Oracle RAC services:
[Oracle @ node-rac1 ~] $ Emctl stop dbconsole
[Oracle @ node-rac1 ~] $ Srvctl stop instance-d racdb-I racdb1
[Oracle @ node-rac1 ~] $ Srvctl stop asm-n node-rac1
[Oracle @ node-rac1 ~] $ Srvctl stop nodeapps-n node-rac1
You can also run a command to stop all instances and Their enabled services:
[Oracle @ node-rac1 ~] $ Srvctl stop database-d racdb
Start all Oracle RAC services:
[Oracle @ node-rac1 ~] $ Srvctl start nodeapps-n node-rac1
[Oracle @ node-rac1 ~] $ Srvctl start asm-n node-rac1
[Oracle @ node-rac1 ~] $ Srvctl start instance-d racdb-I racdb1
[Oracle @ node-rac1 ~] $ Emctl start dbconsole
You can also run the following command to start all instances and Their enabled services:
[Oracle @ node-rac1 ~] $ Srvctl start database-d racdb

4. add/delete/modify an instance (srvctl add/remove/modify)
Add a service and switch between nodes:
[Oracle @ node-rac1 ~] $ Srvctl add service-d racdb-s test-r racdb1-a racdb2-P BASIC
The parameter meanings are as follows:
-R, indicating the preferred instance
-A indicates an available instance.
-P indicates the Failover policy. There are three options: none, BASIC, and preconnect.
Switch cluster services between cluster nodes:
[Oracle @ node-rac1 ~] $ Srvctl start service-d racdb-s test-I racdb1
[Oracle @ node-rac1 ~] $ Srvctl status service-d racdb-s test
Service test is running on instance (s) racdb1
[Oracle @ node-rac1 ~] $ Srvctl stop service-d racdb-s test-I racdb1
[Oracle @ node-rac1 ~] $ Srvctl start service-d racdb-s test-I racdb2
[Oracle @ node-rac1 ~] $ Srvctl status service-d racdb-s test
Service test is running on instance (s) racdb2
Remove a service from an instance node:
[Oracle @ node-rac1 ~] $ Srvctl remove service-d racdb-s test-I racdb2
Test PREF: racdb1 racdb2 AVAIL:
Remove service test from the instance racdb2? (Y/[n]) y
Make the database service available to an instance:
[Oracle @ node-rac1 ~] $ Srvctl add service-d racdb-s test-u-a racdb2
[Oracle @ node-rac1 ~] $ Srvctl start service-d racdb-s test
[Oracle @ node-rac1 ~] $ Srvctl modify service-d racdb-s test-I racdb2-r

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.