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

来源:https://www.cnblogs.com/alen-liu-sz/archive/2020/05/27/12975558.html
-Advertisement-
Play Games

SRVCTL,服務控制實用工具(Service Control Utility),可用於對Oracle Restart和Oracle RAC的配置和管理,本篇主要介紹SRVCTL命令在Oracle Restart中的應用,其中,詳細介紹config、status命令,併列出其它命令的用法。 1 sr ...


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]

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • () 批量ping for /L %i IN (起始,掃描間距,結束) DO ping -w 2 -n 1 10.224.131.%i 如 for /L %i IN (55,1,80) DO ping -w 2 -n 1 10.224.131.%i 輸出到指定文件 arp -a > 111.txt ...
  • 1. 基礎環境準備1.1 環境準備:兩台虛擬機 db01 db02每台創建四個mysql實例:3307 3308 3309 33101.2 刪除歷史環境:pkill mysqldrm -rf /data/33{07..10} mv /etc/my.cnf /etc/my.cnf.bak 1.3 創建 ...
  • 上一篇文章我寫了 Nginx 的 11 個階段,很多人都說太長了。這是出於文章完整性的考慮的,11 個階段嘛,一次性說完就完事了。今天這篇文章比較短,看完沒問題。 過濾模塊的位置 之前我們介紹了 Nginx 的 11 個階段,在 content 階段時,Nginx 會生成返回給用戶的響應內容,對用戶 ...
  • 下麵我們就來安裝Linux操作系統吧~ 首先你得確認自己有沒有下好ISO鏡像文件,就是下圖這個東西 然後打開虛擬機,找到虛擬機設置, 啟動虛擬機,選擇install Centos7 一直按回車鍵,進入光碟檢測界面,按ESC跳過檢測 來到選擇語言界面,這裡選擇English 下一步後,來到 instl ...
  • 可以使用Oracle內置的程式包DBMS_STATS來查看或修改搜集的資料庫統計信息,本篇主要介紹GATHER_TABLE_STATS過程,通過該過程,可以搜集表和列(或索引)的統計信息。 1 語法 dbms_stats.gather_table_stats(ownname varchar2, ta ...
  • 在Oracle資料庫中,優化器欲產生最優的執行計劃,需要依賴於相關對象的統計信息的搜集。資料庫可以自動的搜集執行計劃,也可以使用程式包DBMS_STATS進行手動搜集,本篇對常規統計信息的搜集不做說明,重點演示下關於擴展的統計信息(Extended Statistics)的的搜集。 1 擴展的統計信 ...
  • 直方圖,一種特殊類型的列的統計信息,它能提供表中列的更詳細的數據分佈信息,直方圖將值存放於桶(buckets)中。基於不同值的數目和數據的分佈,資料庫選擇要創建的直方圖類型,直方圖的類型有如下幾種: 頻率直方圖和頂頻直方圖:Frequency histograms and to frequency ...
  • 問題描述: 在Grid環境中,如果修改了主機名,啟動Grid時會出現如下錯誤: [grid@sztest ~]$ sqlplus / as sysasm SQL*Plus: Release 12.1.0.2.0 Production on Wed Apr 15 20:42:27 2020 Copyr ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...