【12c】Oracle Restart中的SRVCTL命令详解「终于解决」

【12c】Oracle Restart中的SRVCTL命令详解「终于解决」SRVCTL,服务控制实用工具(Service Control Utility),可用于对Oracle Restart和Oracle RAC的配置和管理,本篇主要介绍SRVCTL命令在Oracle R

【12c】Oracle Restart中的SRVCTL命令详解

SRVCTL,服务控制实用工具(Service Control Utility),可用于对Oracle Restart和Oracle RAC的配置和管理,本篇主要介绍SRVCTL命令在Oracle Restart中的应用,其中,详细介绍config、status命令,并列出其它命令的用法。

1 srvctl命令语法

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

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: <CRS 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 <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.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 <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.

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 <db_unique_name> [-service <service_name>] [-verbose]

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 <db_unique_name> | -thisversion | -thishome} [-force] [-verbose]

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 <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

3.4 srvctl status home

展示特定的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

3.5 srvctl status 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

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 <db_unique_name> [-service “<service_name_list>”] [-force] [-verbose]

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 <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]

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 <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]

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 <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]

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 <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]

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 <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]

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 <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]

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 <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]

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 <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]

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 <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]

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 <db_unique_name> -startoption <start_options>

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

srvctl <command> <object> -help [-compatible]

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 <db_unique_name> -oraclehome <oracle_home>

srvctl <command> <object> -help [-compatible]

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 <db_unique_name> -oraclehome <oracle_home> -targetversion <to_version>

srvctl <command> <object> -help [-compatible]

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/8216.html

(0)
上一篇 2023-03-05
下一篇 2023-03-05

相关推荐

  • Jupyter启动Python代码的教程

    Jupyter启动Python代码的教程Python是一种最流行的编程语言之一,广泛用于数据分析、科学计算以及Web开发等领域。而Jupyter是一种基于Web的交互式计算环境,可以支持多种编程语言,包括Python。Jupyter可以让程序员在一个笔记本中编写和编辑代码,并在同一个环境中查看和分析数据。在这篇文章中,我们将介绍如何使用Jupyter启动Python代码。

    2024-07-29
    36
  • mysql索引背后的数据结构及算法原理是什么_索引底层数据结构

    mysql索引背后的数据结构及算法原理是什么_索引底层数据结构本文(面对的是程序员而非专业数据库管理员DBA)以MySQL数据库为研究对象,讨论与数据库索引相关的一些话题。特别需要说明的是,MySQL支持诸多存储引擎,而各种存储引擎对索引的支持也各不相同,因此M

    2023-02-12
    149
  • 如何使用Python中的uniform函数

    如何使用Python中的uniform函数Python是一种面向对象、解释型的高级编程语言,它具有简洁、易读的语法结构以及强大的数据处理和科学计算能力,使其应用范围十分广泛。而在Python中,有很多内置函数可以帮助我们完成各种任务。其中,stronguniform()/strong函数是一个十分有用的函数,可用于生成指定范围内的浮点随机数。

    2024-08-11
    33
  • MySQL简单实现多字段模糊查询【转】「终于解决」

    MySQL简单实现多字段模糊查询【转】「终于解决」我所做的商城项目前些时提了新需求,要求前台搜索商品除了能通过商品名称搜索到以外,还可以通过别个信息搜索,比如:商品编号、详情内容描述等等,类似于全文搜索了。我首先想到的就是lucene,但是对代码这样

    2023-02-15
    145
  • Postgresql共享库预加载(Shared Library Preloading)

    Postgresql共享库预加载(Shared Library Preloading)Postgresql共享库预加载(Shared Library Preloading) PostgreSQL支持通过动态库的方式扩展PG的功能,pg在使用这些功能时需要预加载相关的共享库。 有几种设…

    2023-02-22
    176
  • Python中创建多级目录的方法

    Python中创建多级目录的方法Python中os模块提供了一种方便的方法来创建多级目录。有两种方法可以实现:os.makedirs()和os.mkdir()方法。

    2024-02-27
    103
  • sql数据库mac版_数据库insert into

    sql数据库mac版_数据库insert intoSQLPro for MSSQL Mac版客户端是一个Mac平台上的轻量级的Microsoft SQL Server数据库的客户端,用于MSSQL的SQLPro Mac版允许快速和简单的访问MySQ…

    2023-02-23
    152
  • 常用sql语句查询

    常用sql语句查询
    oracle常用经典SQL查询 常用SQL查询: 1、查看表空间的名称及大小 select t.tablespace_name, round(sum(byt…

    2023-04-05
    141

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注