【12c】Oracle Restart中的SRVCTL命令详解
SRVCTL,服务控制实用工具(Service Control Utility),可用于对Oracle Restart和Oracle RAC的配置和管理,本篇主要介绍SRVCTL命令在Oracle Restart中的应用,其中,详细介绍config、status命令,并列出其它命令的用法。
1 srvctl命令语法
Usage: srvctl
commands: enable|disable|start|stop|status|add|remove|modify|update|getenv|setenv|unsetenv|config|upgrade|downgrade
objects: database|service|asm|diskgroup|listener|home|ons
2 config命令
srvctl config命令可以展示特定组件或一组组件的Oracle Restart配置信息。
2.1 srvctl config asm
展示asm实例的Oracle Restart配置信息。
1)语法结构
Usage: srvctl config asm [-all]
2)示例
[grid@sz ~]$ srvctl config asm
ASM home:
Password file: +DATA/orapwasm
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.253.1037659875
ASM diskgroup discovery string: /dev/oracleasm/disks/*
2.2 srvctl config database
展示数据库相关信息。
1)语法结构
Usage: srvctl config database [-db
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.1037831659
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
2.3 srvctl config listener
展示监听器相关信息。
1)语法结构
Usage: srvctl config listener [-listener
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.
2.4 srvctl config ons
展示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
2.5 srvctl config service
展示服务信息。
1)语法结构
Usage: srvctl config service -db
2)示例
[grid@sz ~]$ srvctl config service -db orcl
3 status命令
srvctl status命令用于展示组件对应的运行状态信息。
3.1 srvctl status asm
1)语法结构
Usage: srvctl status asm [-all] [-verbose]
2)示例
[grid@sz ~]$ srvctl status asm -detail
ASM is running on sz
ASM is enabled.
3.2 srvctl status database
1)语法结构
Usage: srvctl status database {-db
2)示例
[grid@sz ~]$ srvctl status database -db orcl -verbose
Database orcl is running. Instance status: Open.
3.3 srvctl status diskgroup
1)语法结构
Usage: srvctl status diskgroup -diskgroup
2)示例
[grid@sz ~]$ srvctl status diskgroup -diskgroup DATA -detail
Disk Group DATA is running on sz
Disk Group DATA is enabled
3.4 srvctl status home
展示特定的ORACLE HOME下的所有组件的运行状态。
1)语法结构
Usage: srvctl status home -oraclehome
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
3.5 srvctl status listener
1)语法结构
Usage: srvctl status listener [-listener
2)示例
[grid@sz ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): sz
3.6 srvctl status ons
1)语法结构
Usage: srvctl status ons [-verbose]
2)示例
[grid@sz ~]$ srvctl status ons
ONS is disabled
ONS daemon is not running
3.7 srvctl status service
1)语法结构
Usage: srvctl status service -db
2)示例
[grid@sz ~]$ srvctl status service -db orcl
4 stop命令
srvctl stop用于停止特定的组件或组件集。
[grid@sz ~]$ srvctl stop -help
The SRVCTL stop command stops, Oracle Restart enabled, starting or running objects.
Usage: srvctl stop database -db
Usage: srvctl stop service -db
Usage: srvctl stop asm [-stopoption
Usage: srvctl stop listener [-listener
Usage: srvctl stop diskgroup -diskgroup
Usage: srvctl stop ons [-verbose]
Usage: srvctl stop home -oraclehome
For detailed help on each command and object and its options use:
srvctl
5 start命令
srvctl start用于启动组件及其服务。
[grid@sz ~]$ srvctl start -help
The SRVCTL start command starts, Oracle Restart enabled, non-running objects.
Usage: srvctl start database -db
Usage: srvctl start service -db
Usage: srvctl start asm [-startoption
Usage: srvctl start listener [-listener
Usage: srvctl start diskgroup -diskgroup
Usage: srvctl start ons [-verbose]
Usage: srvctl start home -oraclehome
For detailed help on each command and object and its options use:
srvctl
6 remove命令
[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
Usage: srvctl remove service -db
Usage: srvctl remove asm [-force]
Usage: srvctl remove listener [-listener
Usage: srvctl remove diskgroup -diskgroup
Usage: srvctl remove ons [-force] [-verbose]
For detailed help on each command and object and its options use:
srvctl
7 add命令
[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
Usage: srvctl add service -db
Usage: srvctl add asm [-listener
Usage: srvctl add listener [-listener
Usage: srvctl add ons [-emport
For detailed help on each command and object and its options use:
srvctl
8 modify命令
[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
Usage: srvctl modify service -db
Usage: srvctl modify asm [-listener
Usage: srvctl modify listener [-listener
Usage: srvctl modify ons [-emport
For detailed help on each command and object and its options use:
srvctl
9 disable命令
[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
Usage: srvctl disable service -db
Usage: srvctl disable asm
Usage: srvctl disable listener [-listener
Usage: srvctl disable diskgroup -diskgroup
Usage: srvctl disable ons [-verbose]
For detailed help on each command and object and its options use:
srvctl
10 enable命令
[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
Usage: srvctl enable service -db
Usage: srvctl enable asm
Usage: srvctl enable listener [-listener
Usage: srvctl enable diskgroup -diskgroup
Usage: srvctl enable ons [-verbose]
For detailed help on each command and object and its options use:
srvctl
11 getenv命令
[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
Usage: srvctl getenv asm [-envs "
Usage: srvctl getenv listener [-listener
For detailed help on each command and object and its options use:
srvctl
12 setenv命令
[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
Usage: srvctl setenv asm {-envs "
Usage: srvctl setenv listener [-listener
For detailed help on each command and object and its options use:
srvctl
13 update命令
[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
For detailed help on each command and object and its options use:
srvctl
14 upgrade命令
[grid@sz ~]$ srvctl upgrade -help
Upgrades the resources types and resources from an older version to a newer version.
Usage: srvctl upgrade database -db
srvctl
15 downgrade命令
[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
srvctl
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341