Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

ORACLE RAC Cluster configuration Management tool-SRVCTL

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Overview of SRVCTL

SRVCTL is an ORACLE RAC cluster configuration management tool that can manage Database, Instance, ASM, Service, Listener, and Node Application,Node Application, including GSD,ONS,VIP. The command format for srvctl is

Srvctl [options]

Srvctl

Usage: srvctl []

Command: enable 、 disable 、 start 、 stop 、 relocate 、 status 、 add 、 remove 、 modify 、 getenv 、 setenv 、 unsetenv 、 config

Objects: database 、 instance 、 service 、 nodeapps 、 asm 、 listener

For detailed help on each command and object and its options use:

Srvctl-h

If you need to track the information of srvctl commands, you need to set the SRVM_TRACE=true of OS

$export SRVM_TRACE=true

$srvctl config database-d czmmiao | more

/ u01/app/oracle/product/10.2.0/db_1/jdk/jre/bin/java-classpath / u01/app/oracle/product/10.2.0/db_1/jlib/netcfg.jar:/u01/app/oracle/

Product/10.2.0/db_1/jdk/jre/lib/rt.jar:/u01/app/oracle/product/10.2.0/db_1/jdk/jre/lib/i18n.jar:/u01/app/oracle/product/10.2.0/db_1/

Jlib/srvm.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/srvmhas.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/srvmasm.jar:/u01/app/ora

Cle/product/10.2.0/db_1/srvm/jlib/srvctl.jar-DTRACING.ENABLED=true-DTRACING.LEVEL=2 oracle.ops.opsctl.OPSCTLDriver config database

-d czmmiao

[main] [21:18:59:903] [OPSCTLDriver.setInternalDebugLevel:165] tracing is true at level 2 to file null

[main] [21:19:0:36] [OPSCTLDriver.:95] Security manager is set

.

1. SRVCTL Config command

Show all registered databases in OCR

$srvctl config database

Czmmiao

The-d option allows you to view a specific database configuration. The following configuration shows that there is a czmmmiao1 instance running on the rac1 node, and $ORACLE_HOME is / u01/app/oracle/product/10.2.0/crs

$srvctl config database-d czmmiao

Rac1 czmmiao1 / u01/app/oracle/product/10.2.0/crs

Rac2 czmmiao2 / u01/app/oracle/product/10.2.0/crs

-an option to view details

$srvctl config database-d czmmiao-a

Czmmiao2 czmmiao1 / u01/app/oracle/product/10.2.0/crs

Czmmiao1 czmmiao2 / u01/app/oracle/product/10.2.0/crs

DB_NAME: czmmiao

ORACLE_HOME: / u01/app/oracle/product/10.2.0/crs

SPFILE: + DATA/czmmiao/spfileczmmiao.ora

DOMAIN: null

DB_ROLE: null

START_OPTIONS: null

POLICY: AUTOMATIC

ENABLE FLAG: DB ENABLED

View the configuration of Node Application

$srvctl config nodeapps-n czmmiao1

Rac1 czmmiao2 / u01/app/oracle/product/10.2.0/crs

View VIP configuration

$srvctl config nodeapps-n czmmiao1-a

VIP exists.: / czmmiao1-vip/192.168.2.113/255.255.255.0/eth2

View GSD configuration

$srvctl config nodeapps-n czmmiao1-g

GSD exists.

View ONS configuration

$srvctl config nodeapps-n czmmiao1-s

ONS daemon exists.

View listener configuration

$srvctl config nodeapps-n czmmiao1-l

Listener exists.

View listener configuration

$srvctl config listener-n czmmiao1

Czmmiao1 LISTENER_CZMMIAO1

Check the ASM, and the output is $ORACLE_HOME of the ASM instance

$srvctl config asm-n czmmiao1

+ ASM2 / u01/app/oracle/product/10.2.0/crs

View all Service configurations in the database

$srvctl config service-d czmmiao-a

Olap PREF: czmmiao2 AVAIL: czmmiao1 TAF: basic

View the configuration of a Service

$srvctl config service-d czmmiao-s olap

Olap PREF: czmmiao2 AVAIL: czmmiao1

View the configuration of a Service, including TAF policy

$srvctl config service-d czmmiao-s olap-a

Olap PREF: czmmiao2 AVAIL: czmmiao1 TAF: basic

For information about TAF policy configuration, you can see the author's blog as follows

Http://czmmiao.iteye.com/blog/1735773

2. SRVCTL Add command

Add configuration information for the database or instance. In the added example, the name specified with-I should match the INSTANCE_NAME and ORACLE_SID parameters.

Srvctl add database-d [- m domain_name]-o-p

Srvctl add instance-d-I-n

Srvctl add instance-d-I-n

Command parameters:

-m database domain name format such as "us.oracle.com"

The specified database domain name 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 command paths such as lsnrctl and Oracle)

-p SPFILE file name

-S service name

-r preferred instance name

-an alternate instance name

-P TAF strategy

$srvctl add database-d RAC-o / u01/oracle/product/10.2.0/db_1-p + RAC_DISK/rac/spfilerac.ora

$srvctl add instance-d RAC-I rac1-n node1-o$ORACLE_HOME

$srvctl add service-d RAC-s Service2-r "RAC1,RAC2"-a "RAC3,RAC4"-P basic

3. SRVCTL enable/disable command

By default, databases, instances, services, and ASM are all started automatically with the startup of CRS. Sometimes this feature can be turned off first for maintenance needs.

$srvctl enable database-d czmmiao

$srvctl disable database-d czmmiao

$srvctl enable database-d czmmiao-I czmmiao1 $srvctl disable database-d czmmiao-I czmmiao1-s abcservice

4. SRVCTL Modify command

Modify the node configuration information of the instance, these changes will take effect after the next restart of the program, and the modified information will be saved permanently.

Srvctl modify instance-d database_name-I instance_name-n node_name

Eg:

$srvctl modify instance-d rac-n new_node

5. SRVCTL Remove command

This is the command to delete the configuration information in the SRVM library, and the environment settings related to the object are also deleted. If you do not use the mandatory flag (- f), ORACLE will prompt you to confirm whether to delete it.

With the mandatory option (- f), the delete operation will not be prompted

Srvctl remove database-d database_name [- f]

Srvctl remove instance-d database_name-I instance_name [- f]

Command parameters:

-f forcibly delete the application without a confirmation prompt

Eg:

$srvctl remove database-d rac

$srvctl remove instance-d rac-I rac1

$srvctl remove instance-d rac-I rac2

6. SRVCTL Start command

Start the database, all instances or specified instances, and start all related unstarted listeners.

Note: for start commands and other operations that can use a connection string, if you do not provide a connection string, ORACLE will use "/ as sysdba" to perform the relevant operation on the instance. In addition, to perform a similar operation, you must be a member of the OSDBA group.

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]

Command parameters:

-o options for startup commands passed directly in SQL*Plus, which can include PFILE

-c use SQL*Plus to connect to the connection string of the database instance

Eg:

$srvctl start database-d rac

$srvctl stop database-d rac-c "SYS/SYS_password as SYSDBA"

$srvctl start instance-d rac-I rac1,rac2

Start and stop monitoring

$srvctl stop listener-n node [- l listenername]

$srvctl start listener-n node1

$srvctl stop listener-n node2

Small bug of the SRVCTL command. See synonyms at small

Http://yangtingkun.itpub.net/post/468/275571

If you turn off listening with srvctl, turn it on with lsnrctl start. At this point, srvctl still thinks that listening has been turned off. So, using srvctl to turn off listening again, it looks as if srvctl didn't execute it at all. If you want srvctl to turn off listening, you need to start listening with srvctl and then turn it off. I searched metalink and found no explanation for this problem. Moreover, this problem only occurs when the monitoring is turned off, but there is no problem with starting the monitoring. Svrctl obviously only records its own operations and does not check the actual state of listener.

7. SRVCTL Status command

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]

Eg:

$srvctl status database-d rac

$srvctl status instance-d rac-I rac1,rac2

8. SRVCTL Stop command

Stop all instances of the database. Specify an instance.

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]

Command parameters:

-c use SQL*Plus to connect to the connection string of the database instance

-o shutdown command options passed directly in SQL*Plus

Eg:

$srvctl stop database-d rac

$srvctl stop instance-d rac-I rac2

$srvctl stop service-d db_name [- s service_name_list [- I inst_name]]

$srvctl stop asm-n node

9. Import and export RAW device configuration information using SRVCONFIG

You can use SRVCONFIG to import and export RAW device configuration information, regardless of whether the configuration file is on the cluster file system or on the RAW device. You can use this method to back up and restore SRVM configuration information.

Eg:

The following command is used to export the contents of the configuration information to a text file with the file name you specified.

$srvconfig-exp file_name

The following command is used to import configuration information from the specified text file to the RAC environment configuration repository where you run the command.

$srvconfig-imp file_name

10. SRVCTL Getenv command

The getenv operation is used to get 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, …]]

Eg:

$srvctl getenv database-d rac

11. SRVCTL Setenv command

Sets the environment variable value in the SRVM configuration file.

Srvctl setenv database-d database_name-t [, name=value,.]

Srvctl setenv instance-d database_name [- I instance_name]-t [, name=value,.]

Eg:

$srvctl setenv database-d rac-t LANG=en

12. SRVCTL Unsetenv command

Undefine the value of the environment variable 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,.]

Eg:

$srvctl unsetenv database-d rac-t CLASSPATH

Updated @ 11-12-09 11:43

Start and stop database

STARTUP:

Node1 $srvctl start nodeapps-n rac1

Node1 $srvctl start nodeapps-n rac2

Node1 $srvctl start asm-n rac1

Node1 $srvctl start asm-n rac2

Node1 $srvctl start database-d rac

Node1 $srvctl start service-d rac

Node1 $crs_stat-t

SHUTDOWN:

Node1 $srvctl stop service-d rac

Node1 $srvctl stop database-d rac

Node1 $srvctl stop asm-n rac2

Node1 $srvctl stop asm-n rac1

Node1 $srvctl stop nodeapps-n rac2

Node1 $srvctl stop nodeapps-n rac1

Node1 $crs_stat-t

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report