SRVCTL,服务控制实用工具(Service Control Utility),可用于对Oracle Restart和Oracle RAC的配置和管理,本篇主要介绍SRVCTL命令在Oracle Restart中的应用,其中,详细介绍config、status命令,并列出其它命令的用法。
Usage: srvctl <command> <object> [<options>]
commands: enable|disable|start|stop|status|add|remove|modify|update|getenv|setenv|unsetenv|config|upgrade|downgrade
objects: database|service|asm|diskgroup|listener|home|ons
srvctl config命令可以展示特定组件或一组组件的Oracle Restart配置信息。
展示asm实例的Oracle Restart配置信息。
1)语法结构
Usage: srvctl config asm [-all]
2)示例
[grid@sz ~]$ srvctl config asm
ASM home: <CRS home>
Password file: +DATA/orapwasm
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.253.
ASM diskgroup discovery string: /dev/oracleasm/disks/*
展示数据库相关信息。
1)语法结构
Usage: srvctl config database [-db <db_unique_name> [-all]] [-verbose]
2)示例
[grid@sz ~]$ srvctl config database -db orcl -all
Database unique name: orcl
Database name: orcl
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/ORCL/PARAMETERFILE/spfile.267.
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: FRA,DATA
Services:
Database is enabled
OSDBA group:
OSOPER group:
Database instance: orcl
展示监听器相关信息。
1)语法结构
Usage: srvctl config listener [-listener <lsnr_name>]
2)示例
[grid@sz ~]$ srvctl config listener
Name: LISTENER
Type: Database Listener
Home: /u01/app/grid/product/12.1.0/grid
End points: TCP:1521
Listener is enabled.
展示Oracle通知服务信息。
1)语法结构
Usage: srvctl config ons
2)示例
[grid@sz ~]$ srvctl config ons
ONS exists: Local port 6100, remote port 6200, EM port 2016, Uses SSL: false
展示服务信息。
1)语法结构
Usage: srvctl config service -db <db_unique_name> [-service <service_name>] [-verbose]
2)示例
[grid@sz ~]$ srvctl config service -db orcl
srvctl status命令用于展示组件对应的运行状态信息。
1)语法结构
Usage: srvctl status asm [-all] [-verbose]
2)示例
[grid@sz ~]$ srvctl status asm -detail
ASM is running on sz
ASM is enabled.
1)语法结构
Usage: srvctl status database {-db <db_unique_name> | -thisversion | -thishome} [-force] [-verbose]
2)示例
[grid@sz ~]$ srvctl status database -db orcl -verbose
Database orcl is running. Instance status: Open.
1)语法结构
Usage: srvctl status diskgroup -diskgroup <dg_name> [-all] [-verbose]
2)示例
[grid@sz ~]$ srvctl status diskgroup -diskgroup DATA -detail
Disk Group DATA is running on sz
Disk Group DATA is enabled
展示特定的ORACLE HOME下的所有组件的运行状态。
1)语法结构
Usage: srvctl status home -oraclehome <oracle_home> -statefile <state_file>
2)示例
[grid@sz ~]$ srvctl status home -oraclehome /u01/app/grid/product/12.1.0/grid -statefile /home/grid/grid.txt
Disk Group ora.DATA.dg is running on sz
Disk Group ora.FRA.dg is running on sz
ASM is running on sz
Listener LISTENER is running on node sz
[grid@sz ~]$ cat grid.txt
diskgroup-ora.DATA.dg
diskgroup-ora.FRA.dg
asm-ora.asm
lsnr-LISTENER
1)语法结构
Usage: srvctl status listener [-listener <lsnr_name>] [-verbose]
2)示例
[grid@sz ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): sz
1)语法结构
Usage: srvctl status ons [-verbose]
2)示例
[grid@sz ~]$ srvctl status ons
ONS is disabled
ONS daemon is not running
1)语法结构
Usage: srvctl status service -db <db_unique_name> [-service "<service_name_list>"] [-force] [-verbose]
2)示例
[grid@sz ~]$ srvctl status service -db orcl
srvctl stop用于停止特定的组件或组件集。
[grid@sz ~]$ srvctl stop -help
The SRVCTL stop command stops, Oracle Restart enabled, starting or running objects.
Usage: srvctl stop database -db <db_unique_name> [-stopoption <stop_options>] [-force]
Usage: srvctl stop service -db <db_unique_name> [-service "<service_name_list>"] [-global_override] [-force] [-verbose]
Usage: srvctl stop asm [-stopoption <stop_options>] [-force]
Usage: srvctl stop listener [-listener <lsnr_name>] [-force]
Usage: srvctl stop diskgroup -diskgroup <dg_name> [-force]
Usage: srvctl stop ons [-verbose]
Usage: srvctl stop home -oraclehome <oracle_home> -statefile <state_file> [-stopoption <stop_options>] [-force]
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
srvctl start用于启动组件及其服务。
[grid@sz ~]$ srvctl start -help
The SRVCTL start command starts, Oracle Restart enabled, non-running objects.
Usage: srvctl start database -db <db_unique_name> [-startoption <start_options>]
Usage: srvctl start service -db <db_unique_name> [-service "<service_name_list>"] [-startoption <start_options>] [-global_override] [-verbose]
Usage: srvctl start asm [-startoption <start_options>]
Usage: srvctl start listener [-listener <lsnr_name>]
Usage: srvctl start diskgroup -diskgroup <dg_name>
Usage: srvctl start ons [-verbose]
Usage: srvctl start home -oraclehome <oracle_home> -statefile <state_file>
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl remove -help
The SRVCTL remove command removes the configuration, for the object from the Oracle Restart. Environment settings for the object are also removed.
Usage: srvctl remove database -db <db_unique_name> [-force] [-noprompt] [-verbose]
Usage: srvctl remove service -db <db_unique_name> -service <service_name> [-global_override] [-force]
Usage: srvctl remove asm [-force]
Usage: srvctl remove listener [-listener <lsnr_name> | -all] [-force]
Usage: srvctl remove diskgroup -diskgroup <dg_name> [-force]
Usage: srvctl remove ons [-force] [-verbose]
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl add -help
The SRVCTL add command adds the configuration and the Oracle Restart application to the OCR for the cluster database, named instances, named services, or for the named nodes.
Usage: srvctl add database -db <db_unique_name> -oraclehome <oracle_home> [-domain <domain_name>] [-spfile <spfile>] [-pwfile <password_file_path>] [-role {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY | FAR_SYNC}] [-startoption <start_options>] [-stopoption <stop_options>] [-dbname <db_name>] [-instance <inst_name>] [-policy {AUTOMATIC | MANUAL | NORESTART}] [-diskgroup "<diskgroup_list>"]
Usage: srvctl add service -db <db_unique_name> -service <service_name> [-role [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-policy {AUTOMATIC | MANUAL}][-notification {TRUE|FALSE}] [-clbgoal {SHORT|LONG}] [-rlbgoal {NONE|SERVICE_TIME|THROUGHPUT}][-failovertype {NONE|SESSION|SELECT|TRANSACTION}] [-failovermethod {NONE|BASIC}][-failoverretry <failover_retries>] [-failoverdelay <failover_delay>] [-edition <edition>] [-pdb <pluggable_database>] [-global <TRUE|FALSE>] [-maxlag <max_lag_time>] [-sql_translation_profile <sql_translation_profile>] [-commit_outcome {TRUE|FALSE}] [-retention <retention>] [replay_init_time <replay_initiation_time>] [-session_state {STATIC|DYNAMIC}] [-force]
Usage: srvctl add asm [-listener <lsnr_name>] [-spfile <spfile>] [-pwfile <password_file_path>] [-diskstring <asm_diskstring>]
Usage: srvctl add listener [-listener <lsnr_name>] [-skip] [-endpoints "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-oraclehome <path>]
Usage: srvctl add ons [-emport <em_port>] [-onslocalport <ons_local_port>] [-onsremoteport <ons_remote_port>] [-remoteservers <host>[:<port>][,<host>[:<port>]...]] [-verbose]
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl modify -help
The SRVCTL modify command enables user to modify configuration of the object without removing and adding Oracle Restart resources. The changes takes effect when the application is restarted.
Usage: srvctl modify database -db <db_unique_name> [-dbname <db_name>] [-instance <inst_name>] [-oraclehome <oracle_home>] [-user <oracle_user>] [-domain <domain>] [-spfile <spfile>] [-pwfile <password_file_path>] [-role {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-startoption <start_options>] [-stopoption <stop_options>] [-policy {AUTOMATIC | MANUAL | NORESTART}] [-diskgroup "<diskgroup_list>"|-nodiskgroup] [-force]
Usage: srvctl modify service -db <db_unique_name> -service <service_name> [-role [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-policy {AUTOMATIC | MANUAL}][-notification {TRUE|FALSE}] [-clbgoal {SHORT|LONG}] [-rlbgoal {NONE|SERVICE_TIME|THROUGHPUT}] [-failovertype {NONE|SESSION|SELECT|TRANSACTION}] [-failovermethod {NONE|BASIC}] [-failoverretry <integer>] [-failoverdelay <integer>] [-edition <edition>] [-pdb <pluggable_database>] [-sql_translation_profile <sql_translation_profile>] [-commit_outcome {TRUE|FALSE}] [-retention <retention>] [replay_init_time <replay_initiation_time>] [-session_state {STATIC|DYNAMIC}] [-global_override]
Usage: srvctl modify asm [-listener <lsnr_name>] [-spfile <spfile>] [-pwfile <password_file_path>] [-diskstring <asm_diskstring>]
Usage: srvctl modify listener [-listener <lsnr_name>] [-oraclehome <path>] [-endpoints "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"]
Usage: srvctl modify ons [-emport <em_port>] [-onslocalport <ons_local_port>] [-onsremoteport <ons_remote_port>] [-remoteservers <host>[:<port>][,<host>[:<port>]...]] [-verbose]
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl disable -help
The SRVCTL disable command disables the named object so that it is unavailable to run under Oracle Restart for automatic startup, failover, or restart.
Usage: srvctl disable database -db <db_unique_name>
Usage: srvctl disable service -db <db_unique_name> -service "<service_name_list>" [-global_override]
Usage: srvctl disable asm
Usage: srvctl disable listener [-listener <lsnr_name>]
Usage: srvctl disable diskgroup -diskgroup <dg_name>
Usage: srvctl disable ons [-verbose]
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl enable -help
The SRVCTL enable command enables the named object so that it can run under Oracle Restart for automatic startup, failover, or restart.
Usage: srvctl enable database -db <db_unique_name>
Usage: srvctl enable service -db <db_unique_name> -service "<service_name_list>" [-global_override]
Usage: srvctl enable asm
Usage: srvctl enable listener [-listener <lsnr_name>]
Usage: srvctl enable diskgroup -diskgroup <dg_name>
Usage: srvctl enable ons [-verbose]
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl getenv -help
The SRVCTL getenv command Gets and displays values for the environment from the configuration file. It allows users to administer environment configuration for the objects.
Usage: srvctl getenv database -db <db_unique_name> [-envs "<name>[,...]"]
Usage: srvctl getenv asm [-envs "<name>[,...]"]
Usage: srvctl getenv listener [-listener <lsnr_name>] [-envs "<name>[,...]"]
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl setenv -help
The SRVCTL setenv command sets values for the environment in the configuration file. It allows users to administer environment configuration for the objects.
Usage: srvctl setenv database -db <db_unique_name> {-envs "<name>=<val>[,...]" | -env "<name>=<val>"}
Usage: srvctl setenv asm {-envs "<name>=<val>[,...]" | -env "<name>=<value>"}
Usage: srvctl setenv listener [-listener <lsnr_name>] -envs "<name>=<val>[,...]" | -env "<name>=<value>"
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl update -help
The SRVCTL update command requests specified running object to use the new configuration information stored in the OCR.
Usage: srvctl update database -db <db_unique_name> -startoption <start_options>
For detailed help on each command and object and its options use:
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl upgrade -help
Upgrades the resources types and resources from an older version to a newer version.
Usage: srvctl upgrade database -db <db_unique_name> -oraclehome <oracle_home>
srvctl <command> <object> -help [-compatible]
[grid@sz ~]$ srvctl downgrade -help
The SRVCTL downgrade command enables the user to downgrade resources from their current software version to an older version.
Usage: srvctl downgrade database -db <db_unique_name> -oraclehome <oracle_home> -targetversion <to_version>
srvctl <command> <object> -help [-compatible]
版权声明:
本文来源网络,所有图片文章版权属于原作者,如有侵权,联系删除。
本文网址:https://www.mushiming.com/mjsbk/11263.html