溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

oracle中clusterware的命令集有幾種

發布時間:2021-12-13 14:42:52 來源:億速云 閱讀:199 作者:小新 欄目:關系型數據庫

小編給大家分享一下oracle中clusterware的命令集有幾種,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

oracle clusterware的命令集可以分為以下4種:
 
節點層:osnodes
網絡層:oifcfg
集群層:crsctl, ocrcheck,ocrdump,ocrconfig
應用層:srvctl,onsctl,crs_stat

下面分別來介紹這些命令。
1、節點層
olsnodes,這個命令用來顯示集群點列表,可用的參數如下:grid用戶執行
$olsnodes -h

用法: olsnodes [-n] [-p][-i] [<node> | -l] [-g] [-v]
-n打印節點編號和節點名
-p打印專用互聯名和節點名
-i打印虛擬ip名和節點名
<node>打印指定節點的信息
-l打印本地節點的信息
-g啟用事件記錄
-v在詳細模式下運行

--這些參數可以混合使用,如下:
[grid@dbrac2 bin]$ which olsnodes
/oracle/app/11.2.0/grid/bin/olsnodes
[grid@dbrac2 bin]$
[grid@dbrac2 bin]$ olsnodes
dbrac1
dbrac2
[grid@dbrac2 bin]$ olsnodes -n
dbrac1  1
dbrac2  2
[grid@dbrac2 bin]$
[grid@dbrac2 bin]$ olsnodes -s
dbrac1  active
dbrac2  active
[grid@dbrac2 bin]$


2、網絡層

網絡層由各個節點的網絡組件組成,包括2個物理網卡和3個ip地址。也只有一個命令:oifcfg

oifcfg命令的格式如下:

用法:
[grid@dbrac2 bin]$ oifcfg
name:
        oifcfg - oracle interface configuration tool.

usage:  oifcfg iflist [-p [-n]]
        oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
        oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]
        oifcfg delif {{-node <nodename> | -global} [<if_name>[/<subnet>]] [-force] | -force}
        oifcfg [-help]

        <nodename> - name of the host, as known to a communications network
        <if_name>  - name by which the interface is configured in the system
        <subnet>   - subnet address of the interface
        <if_type>  - type of the interface { cluster_interconnect | public }

<nodename> -為通信網絡所知的主機名
<if_name> -系統中配置的接口的名稱 (interface_name網絡接口包括名稱)
<subnet> -接口的子網地址 (subnet網段地址)
<if_type> -接口類型{ cluster_interconnect | public | storage } (interface_type接口類型)
oifcfg命令用來定義和修改oracle集群需要的網卡屬性,這些屬性包括網卡的網段地址,子網掩碼,接口類型等。
要想正確的使用這個命令,必須先知道oracle是如何定義網絡接口的,oracle的每個網絡接口包括名稱,網段地址,接口類型3個屬性:interface_name/subnet:interface_type。
這些屬性中沒有ip地址,但接口類型有兩種,public和private,前者說明接口用于外部通信,用于oracle net和vip地址,而后者說明接口用于interconnect。

接口的配置方式分為兩類:
global和node-specific。前者說明集群所有節點的配置信息相同,也就是說所有節點的配置是對稱的;而后者意味著這個節點的配置和其他節點配置不同,是非對稱的。
iflist:顯示網口列表
getif:獲得單個網口信息
setif:配置單個網口
delif:刪除網口

--顯示網口列表
[grid@dbrac1 ~]$ oifcfg iflist
eth0  192.168.56.0
eth2  10.10.10.0
eth2  169.254.0.0

--顯示網口信息
[grid@dbrac1 ~]$ oifcfg getif
eth0  192.168.56.0  global  public
eth2  10.10.10.0  global  cluster_interconnect
[grid@dbrac1 ~]$   

--查看public類型的網卡
[grid@dbrac2 bin]$ oifcfg getif -type public
eth0  192.168.56.0  global  public

--刪除接口配置
[grid@dbrac2 bin]$  oifcfg delif -global

--添加接口配置
[grid@dbrac2 bin]$ oifcfg setif -global eth0/192.168.1.119:public
[grid@dbrac2 bin]$ oifcfg setif -globaleth2/10.85.10.119:cluster_interconnect


3、集群層

集群層是指由clusterware組成的核心集群, 這一層負責維護集群內的共享設備,并為應用集群提供完整的集群狀態視圖,應用集群依據這個視圖進行調整。這一層共有4個命令:crsctl, ocrcheck,ocrdump,ocrconfig.后三個是針對ocr磁盤的。

3.1 crsctl
crsctl命令可以用來檢查crs進程棧,每個crs進程狀態,管理votedisk,跟蹤crs進程功能

3.1.1 檢查crs狀態
[grid@dbrac2 bin]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@dbrac2 bin]$

--檢查單個狀態
[grid@dbrac2 bin]$ crsctl check cssd
CRS-272: This command remains for backward compatibility only
Cluster Synchronization Services is online
[grid@dbrac2 bin]$ crsctl check crsd
CRS-272: This command remains for backward compatibility only
Cluster Ready Services is online
[grid@dbrac2 bin]$ crsctl check evmd
CRS-272: This command remains for backward compatibility only
Event Manager is online
[grid@dbrac2 bin]$  

3.1.2 配置crs棧是否自啟動
crs進程棧默認隨著操作系統的啟動而自啟動,有時出于維護目的需要關閉這個特性,可以用root用戶執行下面命令。
[grid@dbrac2 bin]$ crsctl disable crs
[grid@dbrac2 bin]$ crsctl enable crs

3.1.3 啟動,停止crs棧
oracle在10.1時,必須通過重新啟動系統重啟clusterware,但是從oracle 10.2開始,可以通過命令來啟動和停止crs。
--啟動crs:
[grid@dbrac2 bin]$ crsctl start crs

attempting to start crs stack
the crs stack will be started shortly

--關閉crs:
[grid@dbrac2 bin]$ crsctl stop crs
stopping resources.
successfully stopped crs resources
stopping cssd.
shutting down css daemon.
shutdown request successfully issued.

3.1.4 查看votedisk磁盤位置
[grid@dbrac2 bin]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   844bb4b723954f31bf8e6a0002e335aa (/dev/asm_ocrvote1) [OCRVOTE]
 2. ONLINE   4a88237c23a84fe5bf8f235e84d60b5b (/dev/asm_ocrvote2) [OCRVOTE]
 3. ONLINE   8398f24ab1e34faebf890fe7a7ef7919 (/dev/asm_ocrvote3) [OCRVOTE]
Located 3 voting disk(s).
[grid@dbrac2 bin]$

3.1.5 查看和修改crs參數
--查看參數:用get
[grid@dbrac2 bin]$ crsctl get css misscount
CRS-4678: Successful get misscount 30 for Cluster Synchronization Services.
[grid@dbrac2 bin]$
[grid@dbrac2 bin]$ crsctl get css disktimeout
CRS-4678: Successful get disktimeout 200 for Cluster Synchronization Services.

--修改參數: 用set,但是這個功能要慎用
[grid@dbrac2 bin]$ crsctl set css miscount 60

3.1.6 跟蹤crs模塊,提供輔助功能
crs由crs,css,evm三個服務組成,每個服務又是由一系列module組成,crsctl允許對每個module進行跟蹤,并把跟蹤內容記錄到日志中。
[grid@dbrac2 bin]$ crsctl lsmodules css
[grid@dbrac2 bin]$ crsctl lsmodules evm

--跟蹤cssd模塊,需要root用戶執行:
[grid@dbrac2 bin]$ crsctl debug log css "cssd:1"
configuration parameter trace is now set to 1.
set crsd debug module: cssd level: 1

--查看跟蹤日志
[root@rac1 cssd]# pwd
/u01/app/oracle/product/crs/log/rac1/cssd
[root@rac1 cssd]# more ocssd.log


3.1.7 維護votedisk
以圖形方式安裝clusterware的過程中,在配置votedisk時,如果選擇external redundancy策略,則只能填寫一個votedisk。但是即使使用external redundancy作為冗余策略,也可以添加多個vodedisk,只是必須通過crsctl命令來添加,添加多個votedisk后,這些votedisk互為鏡像,可以防止votedisk的單點故障。

需要注意的是,votedisk使用的是一種“多數可用算法”,如果有多個votedisk,,則必須一半以上的votedisk同時使用,clusterware才能正常使用。 比如配置了4個votedisk,壞一個votedisk,集群可以正常工作,如果壞了2個,則不能滿足半數以上,集群會立即宕掉,所有節點立即重啟,所以如果添加votedisk,盡量不要只添加一個,而應該添加2個。這點和ocr不一樣。ocr只需配置一個。

添加和刪除votedisk的操作比較危險,必須停止數據庫,停止asm,停止crs stack后操作,并且操作時必須使用-force參數。
1) 查看當前配置
[grid@dbrac2 ~]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   844bb4b723954f31bf8e6a0002e335aa (/dev/asm_ocrvote1) [OCRVOTE]
 2. ONLINE   4a88237c23a84fe5bf8f235e84d60b5b (/dev/asm_ocrvote2) [OCRVOTE]
 3. ONLINE   8398f24ab1e34faebf890fe7a7ef7919 (/dev/asm_ocrvote3) [OCRVOTE]
Located 3 voting disk(s).
[grid@dbrac2 ~]$

2) 停止所有節點的crs:
[grid@dbrac2 bin]$ crsctl stop crs

3) 添加votedisk
[grid@dbrac2 bin]$ crsctl add css votedisk /dev/raw/rac1 -force
注意:即使在crs關閉后,也必須通過-force參數來添加和刪除votedisk,并且-force參數只有在crs關閉的場合下使用才安全,否則會報:cluter is not a ready state for online disk addition.

4) 確認添加后的情況:
[grid@dbrac2 bin]$ crsctl query css votedisk

5) 啟動crs
[grid@dbrac2 bin]$ crsctl start crs

--可以動態更改表決磁盤配置,如添加新的表決磁盤,請使用以下命令:
# crsctl add css votedisk <new voting disk path>

--要刪除表決磁盤,請使用以下命令:
# crsctl delete css votedisk <old voting disk path>

--如果所有節點上的 Oracle Clusterware 都已關閉,請使用 –force 選項:
# crsctl add css votedisk <new voting disk path> -force
# crsctl delete css votedisk <old voting disk path> -force

6)備份和恢復表決磁盤:
當在如下情況下,可使用 dd 命令備份一個表決磁盤
– 在安裝 Oracle Clusterware 之后
– 在添加或刪除節點之后
– 可以聯機執行
$ crsctl query css votedis
$ dd if=<voting disk path> of=<backup path> bs=4k

可以使用以下方法恢復表決磁盤:使用 dd 命令恢復第一個表決磁盤,然后根據需要對該磁盤進行多路復用。如果沒有可用的表決磁盤備份,則應重新安裝 Oracle Clusterware。

3.2 ocr命令系列
oracle clusterware把整個集群的配置信息放在共享存儲上,這個存儲就是ocr disk.在整個集群中,只有一個節點能對ocr disk進行讀寫操作,這個節點叫作master node,所有節點都會在內存中保留一份ocr的拷貝,同時有個ocr process從這個內存中讀取內容。ocr內容發生改變時,由master node的ocr process負責同步到其他節點的ocr process。
因為ocr的內容如此重要,oracle每4個小時對其做一次備份,并且保留最后的3個備份,以及前一天,前一周的最后一個備份。這個備份由master node crsd進程完成,備份的默認位置是$crs_home\cdata\<cluster_name>目錄下。每次備份后,備份文件名自動更改,以反應備份時間順序,最近一次的備份叫作backup00.ocr。這些備份文件除了保存在本地,dba還應該在其他存儲設備上保留一份,以防止意外的存儲故障。

3.2.1 ocrdump
該命令能以ascii的方式打印出ocr的內容,但是這個命令不能用作ocr的備份恢復,也就是說產生的文件只能用作閱讀,而不能用于恢復。+
 
命令格式:
[grid@acctdb01 ~]$ ocrdump -help
Name:
        ocrdump - Dump contents of Oracle Cluster/Local Registry to a file.

Synopsis:
        ocrdump [-local] [<filename>|-stdout] [-backupfile <backupfilename>] [-keyname <keyname>] [-xml] [-noheader]

Description:
        Default filename is OCRDUMPFILE. Examples are:

        prompt> ocrdump
        writes cluster registry contents to OCRDUMPFILE in the current directory

        prompt> ocrdump MYFILE
        writes cluster registry contents to MYFILE in the current directory

        prompt> ocrdump -stdout -keyname SYSTEM
        writes the subtree of SYSTEM in the cluster registry to stdout

        prompt> ocrdump -local -stdout -xml
        writes local registry contents to stdout in xml format

        prompt> ocrdump -backupfile /oracle/CRSHOME/backup.ocr -stdout -xml
        writes registry contents in the backup file to stdout in xml format

Notes:
        The header information will be retrieved based on best effort basis.
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrdump_<pid>.log. Make sure
        you have file creation privileges in the above directory before
        running this tool.
        Use option '-local' to indicate that the operation is to be performed on the Oracle Local Registry.

[grid@acctdb01 ~]$

參數說明:
-stdout:把內容打印輸出到屏幕上
filename:內容輸出到文件中
-keyname:只打印某個鍵及其子健內容
-xml:以xml格式打印輸出

示例:把system.css鍵的內容以.xml格式打印輸出到屏幕
[grid@dbrac2 bin]$ocrdump -stdout -keyname system.css -xml|more
……
這個命令在執行過程中,會在$crs_home\log\<node_name>\client目錄下產生日志文件,文件名ocrdump_<pid>.log,如果命令執行出現問題,可以從這個日志查看問題原因。

3.2.2 ocrcheck(以root命令執行)
ocrcheck命令用于檢查ocr內容的一致性,命令執行過程會在$crs_home\log\nodename\client目錄下產生ocrcheck_pid.log日志文件。 這個命令不需要參數。
語法:
[grid@dbrac2 ~]$ ocrcheck -h
Name:
        ocrcheck - Displays health of Oracle Cluster/Local Registry.

Synopsis:
        ocrcheck [-config] [-local]

  -config       Displays the configured locations of the Oracle Cluster Registry.
                This can be used with the -local option to display the configured
                location of the Oracle Local Registry
  -local        The operation will be performed on the Oracle Local Registry.

Notes:
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrcheck_<pid>.log.
        File creation privileges in the above directory are needed
        when running this tool.

--root執行
[grid@dbrac2 ~]$
[root@dbrac2 ~]# /oracle/app/11.2.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3120
         Available space (kbytes) :     259000
         ID                       :    6988404
         Device/File Name         :   +OCRVOTE
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

[root@dbrac2 ~]#

3.2.3 ocrconfig

該命令用于維護ocr磁盤,安裝clusterware過程中,如果選擇external redundancy冗余方式,則只能輸入一個ocr磁盤位置。但是oracle允許配置兩個ocr磁盤互為鏡像,以防止ocr磁盤的單點故障。ocr磁盤和votedisk磁盤不一樣,ocr磁盤最多只能有兩個,一個primary ocr和一個mirror ocr。
[grid@dbrac2 ~]$  ocrconfig -help
Name:
        ocrconfig - Configuration tool for Oracle Cluster/Local Registry.

Synopsis:
        ocrconfig [option]
        option:
                [-local] -export <filename>
                                                    - Export OCR/OLR contents to a file
                [-local] -import <filename>         - Import OCR/OLR contents from a file
                [-local] -upgrade [<user> [<group>]]
                                                    - Upgrade OCR from previous version
                -downgrade [-version <version string>]
                                                    - Downgrade OCR to the specified version
                [-local] -backuploc <dirname>       - Configure OCR/OLR backup location
                [-local] -showbackup [auto|manual]  - Show OCR/OLR backup information
                [-local] -manualbackup              - Perform OCR/OLR backup
                [-local] -restore <filename>        - Restore OCR/OLR from physical backup
                -replace <current filename> -replacement <new filename>
                                                    - Replace an OCR device or file <current filename> with <new filename>
                -add <filename>                     - Add a new OCR device/file
                -delete <filename>                  - Remove a OCR device/file
                -overwrite                          - Overwrite OCR configuration on disk
                -repair -add <filename> | -delete <filename> | -replace <current filename> -replacement <new filename>
                                                    - Repair OCR configuration on the local node
                -help                               - Print out this help information

Note:
        * A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrconfig_<pid>.log. Please ensure
        you have file creation privileges in the above directory before
        running this tool.
        * Only -local -showbackup [manual] is supported.
        * Use option '-local' to indicate that the operation is to be performed on the Oracle Local Registry.

[grid@dbrac2 ~]$

--查看自助備份
在缺省情況下,ocr自動備份在$crs_home\cdata\cluster_name目錄下,可以通過ocrconfig -backuploc <directory_name>命令修改到新的目錄
[grid@dbrac2 ~]$ ocrconfig -showbackup
dbrac2     2018/01/12 03:10:52     /oracle/app/11.2.0/grid/cdata/dbrac-cluster/backup00.ocr
dbrac2     2017/10/20 00:32:00     /oracle/app/11.2.0/grid/cdata/dbrac-cluster/backup01.ocr
dbrac2     2017/10/19 15:09:44     /oracle/app/11.2.0/grid/cdata/dbrac-cluster/backup02.ocr
dbrac2     2018/01/12 03:10:52     /oracle/app/11.2.0/grid/cdata/dbrac-cluster/day.ocr
dbrac2     2018/01/12 03:10:52     /oracle/app/11.2.0/grid/cdata/dbrac-cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
[grid@dbrac2 ~]$

3.2.4 使用導出,導入進行備份和恢復(root用戶執行)
oracle推薦在對集群做調整時,比如增加,刪除節點之前,應該對ocr做一個備份,可以使用export備份到指定文件,如果做了replace或者restore等操作,oracle建議使用cluvfy comp ocr -n all命令來做一次全面的檢查。該命令在clusterware的安裝軟件里。

1)、首先關閉所有節點的crs
[root@dbrac1 ~]# /oracle/app/11.2.0/grid/bin/crsctl stop crs
[root@dbrac2 ~]# /oracle/app/11.2.0/grid/bin/crsctl stop crs

2)、用root用戶導出ocr內容
[root@dbrac2 ~]# /oracle/app/11.2.0/grid/bin/ocrconfig -export /home/grid/ocr.exp

--查看
[grid@dbrac2 ~]$ pwd
/home/grid
[grid@dbrac2 ~]$ ls -lrt ocr*
-rw------- 1 root root 122854 Jan 12 03:42 ocr.exp
[grid@dbrac2 ~]$

3)、重啟crs
[root@dbrac1 ~]# /oracle/app/11.2.0/grid/bin/crsctl start crs
[root@dbrac2 ~]# /oracle/app/11.2.0/grid/bin/crsctl start crs

4)、檢查crs狀態
[grid@dbrac2 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@dbrac2 ~]$

5)破壞OCR內容
[root@rac1 bin]# dd if=/dev/zero of=/dev/raw/rac1 bs=1024 count=102400
102400+0 records in
102400+0 records out

6)、檢查ocr一致性
[root@dbrac2 ~]#  ocrcheck
prot-601: failed to initialize ocrcheck

7)、使用cluvfy工具檢查一致性
[root@dbrac2 ~]#  runcluvfy.sh comp ocr -n all
verifying ocr integrity
unable to retrieve nodelist from oracle clusterware.
verification cannot proceed.

8)、使用import恢復ocr內容
[root@dbrac2 ~]#  ocrconfig -import /home/grid/ocr.exp

9)、再次檢查ocr
[root@dbrac2 ~]#  ocrcheck

10)、使用cluvfy工具檢查
[root@rac1 cluvfy]# runcluvfy.sh comp ocr -n all

3.2.5 移動ocr文件位置
實例演示將ocr從/dev/raw/rac1移動到/dev/raw/raw3上
 
1) 查看是否有ocr備份
[grid@dbrac2 bin]$ocrconfig -showbackup
如果沒有備份,可以立即執行一次導出作為備份:
[root@dbrac2 ~]# ocrconfig -export /u01/ocrbackup -s online

2) 查看當前ocr配置
[root@dbrac2 ~]# ocrcheck

3)添加一個mirror ocr
[root@dbrac2 ~]# ocrconfig -replace ocrmirror /dev/raw/raw4

4)確認添加成功
[grid@dbrac2 bin]$ocrcheck

5)改變primary ocr位置
[root@dbrac2 ~]# ocrconfig -replace ocr /dev/raw/raw3
確認修改成功:
[grid@dbrac2 bin]$ocrcheck

6)使用ocrconfig命令修改后,所有rac節點上的/etc/oracle/ocr.loc文件內容也會自動同步了,如果沒有自動同步,可以手工的改成以下內容。
[grid@dbrac2 bin]$more /etc/oracle/ocr.loc
ocrconfig_loc=/dev/raw/rac1
ocrmirrorconfig_loc=/dev/raw/raw3
local_only=false

總結:
使用物理備份恢復 OCR
1. 找到物理備份:
   $ ocrconfig –showbackup
2. 檢查其內容:
   # ocrdump –backupfile file_name
3. 停止所有節點上的Oracle Clusterware:
   # crsctl stop
4. 還原 OCR 物理備份:
   # ocrconfig –restore <CRS HOME>/cdata/jfv_clus/day.ocr
5. 重新啟動所有節點上的Oracle Clusterware:
   # crsctl start crs
6. 檢查 OCR 完整性:
   $ cluvfy comp ocr -n all


使用邏輯備份恢復 OCR
1. 找到使用 OCR 導出文件創建的邏輯備份。
2. 停止所有節點上的 Oracle Clusterware:
   # crsctl stop crs
3. 還原邏輯 OCR 備份:
    # ocrconfig –import /shared/export/ocrback.dmp
4. 重新啟動所有節點上的 Oracle Clusterware:
   # crsctl start crs
5. 檢查 OCR 完整性:
   $ cluvfy comp ocr -n all

替換 OCR
# ocrcheck
  Status of Oracle Cluster Registry is as follows:
  Version : 2
  Total space (kbytes) : 200692
  Used space (kbytes) : 3752
  Available space (kbytes) : 196940
  ID : 495185602
  Device/File Name : /oradata/OCR1
  Device/File integrity check succeeded
  Device/File Name : /oradata/OCR2
      Device/File needs to be synchronized with the other device

# ocrconfig –replace ocrmirror /oradata/OCR2

修復 OCR 配置
1. 停止節點 2 上的 Oracle Clusterware:   
   # crsctl stop crs    
2. 從節點 1 添加 OCR 鏡像:      
   # ocrconfig –replace ocrmirror /OCRMirror         
3. 修復節點 2 上的 OCR 鏡像位置:  
   # ocrconfig –repair ocrmirror /OCRMirror       
4. 啟動節點 2 上的 Oracle Clusterware:
   # crsctl start crs     

OCR 注意事項
1. 如果使用裸設備還原 OCR 文件,則在執行添加或替換操作之前需要先確保這些文件已存在。
2. 使用 ocrconfig 時,必須具有 root 用戶身份才能添加、替換或刪除 OCR 文件。
3. 添加或替換 OCR 文件時,其鏡像需要處于聯機狀態。
4. 如果刪除了 OCR 主文件,則 OCR 鏡像文件將成為主文件。
5. 任何時候都不能刪除最后一個保留的 OCR 文件。


4、應用層
應用層就是指rac數據庫了,這一層有若干資源組成,每個資源都是一個進程或者一組進程組成的完整服務,這一層的管理和維護都是圍繞這些資源進行的。有如下命令:srvctl, onsctl, crs_stat三個命令。

4.1.1 crs_stat
crs_stat這個命令用于查看crs維護的所有資源的運行狀態,如果不帶任何參數時,顯示所有資源的概要信息。每個資源顯示是各個屬性:資源名稱,類型,目錄,資源運行狀態等。
[grid@dbrac2 bin]$ crs_stat
……
也可以指定資源名,查看指定資源的狀態,并可以使用-v和-p選項,以查看詳細信息,其中-p參數顯示的內容比-v更詳細。

1) 查看制定資源狀態
[grid@dbrac2 ~]$ crs_stat ora.dbrac2.vip
NAME=ora.dbrac2.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on dbrac2

[grid@dbrac2 ~]$

2) 使用-v選項,查看詳細內容,這時輸出多出4項內容,分別是允許重啟次數,已執行重啟次數,失敗閥值,失敗次數。
[grid@dbrac2 ~]$ crs_stat -v ora.dbrac2.vip
NAME=ora.dbrac2.vip
TYPE=ora.cluster_vip_net1.type
RESTART_ATTEMPTS=0
RESTART_COUNT=0
FAILURE_THRESHOLD=0
FAILURE_COUNT=0
TARGET=ONLINE
STATE=ONLINE on dbrac2

[grid@dbrac2 ~]$

3) 使用-p選項查看更詳細內容
[grid@dbrac2 ~]$ crs_stat -p ora.dbrac2.vip
NAME=ora.dbrac2.vip
TYPE=ora.cluster_vip_net1.type
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AUTO_START=restore
CHECK_INTERVAL=1
DESCRIPTION=Oracle VIP resource
FAILOVER_DELAY=0
FAILURE_INTERVAL=0
FAILURE_THRESHOLD=0
HOSTING_MEMBERS=dbrac2
PLACEMENT=favored
RESTART_ATTEMPTS=0
SCRIPT_TIMEOUT=60
START_TIMEOUT=120
STOP_TIMEOUT=0
UPTIME_THRESHOLD=1h

[grid@dbrac2 ~]$
這些字段是所有資源共有的,但是根據資源類型不同,某些字段可以空值。

4) 使用-ls選項,可以查看每個資源的權限定義,權限定義格式和linux一樣。
[grid@dbrac2 ~]$  crs_stat -ls ora.dbrac2.vip
Name           Owner          Primary PrivGrp          Permission  
-----------------------------------------------------------------
ora.dbrac2.vip root           root                     rwxr-xr--
[grid@dbrac2 ~]$

這個命令用于管理配置ons(oracle notification service). ons是oracle clusterware實現fan event push模型的基礎。在傳統模型中,客戶端需要定期檢查服務器來判斷服務端狀態,本質上是一個pull模型,oracle 10g引入了一個全新的push機制╟fan(fast application notification),當服務端發生某些事件時,服務器會主動的通知客戶端這種變化,這樣客戶端就能盡早得知服務端的變化。而引入這種機制就是依賴ons實現, 在使用onsctl命令之前,需要先配置ons服務。

4.1.2.1 ons配置內容
在rac環境中,需要使用$crs_home下的ons,而不是$oracle_home下面的ons, 這點需要注意。 配置文件在$crs_home\opmn\conf\ons.config.
[grid@acctdb01 conf]$ pwd
/oracle/app/11.2.0/grid/opmn/conf
[grid@acctdb01 conf]$ ls
ons.config  ons.config.acctdb01  ons.config.acctdb01.bak  ons.config.bak.acctdb01
[grid@acctdb01 conf]$ more ons.config
usesharedinstall=true
allowgroup=true
localport=6100          # line added by Agent
remoteport=6200         # line added by Agent
nodes=acctdb01:6200,acctdb02:6200               # line added by Agent
[grid@acctdb01 conf]$

參數說明:
localport:這個參數代表本地監聽端口,這里本地特指:127.0.0.1這個回環地址,用來和運行在本地的客戶端進行通信
remoteport:這個參數代表的是遠程監聽端口,也就是除了127.0.0.1以外的所有本地ip地址,用來和遠程的客戶端進行通信。
loglevel:oracle允許跟蹤ons進程的運行,并把日志記錄到本地文件中,這個參數用來定義ons進程要記錄的日志級別,從1-9,缺省值是3.
logfile:這個參數和loglevel參數一起使用,用于定義ons進程日志文件的位置,缺省值是$crs_home\opmn\logs\opmn.log
nodes和useocr:這兩個參數共同決定本地的ons daemon要和哪些遠程節點上的ons daemon進行通信。
nodes參數值格式如下:hostname/ip:port[hostname/ip:port]
如:useoce=off
nodes=rac1:6200,rac2:6200
而useocr參數值為on/off,如果useocr是on, 說明信息保存在ocr中,如果是off,說明信息取nodes中的配置。對于單實例而言,要把useocr設置為off。

4.1.2.2 配置ons
可以直接編譯ons的配置文件來修改配置,如果使用了ocr,則可以通過racgons命令進行配置,但必須以root用戶來執行,如果用oracle用戶來執行,不會提示任何錯誤,但也不會更改任何配置。
若要添加配置,可以使用下面命令:
racgons add_config rac1:6200 rac2:6200

若要刪除配置,可以用下面命令:
racgons remove_config rac1:6200 rac2:6200

4.1.2.3 onsctl命令
使用onsctl命令可以啟動,停止,調試ons,并重新載入配置文件,其命令格式如下:
ons進程運行,并不一定代表ons正常工作,需要使用ping命令來確認
[grid@acctdb01 ~]$ onsctl
ERROR!

usage: onsctl [verbose] <command> [<options>]

The verbose option enables debug tracing and logging (for the server start).

Permitted <command>/<options> combinations are:

command   options
-------   ---------
start                       - Start ons
shutdown                    - Shutdown ons
reload                      - Trigger ons to reread its configuration file
debug     [<attr>=<val> ..] - Display ons server debug information
set       [<attr>=<val> ..] - Set ons log parameters
query     [<attr>=<val>]    - Query ons log parameters
ping      [<max-retry>]     - Ping local ons
help                        - Print brief usage description (this)
usage     [<command>]       - Print detailed usage description

[grid@acctdb01 ~]$
 
1) 在os級別查看進程狀態。
[grid@dbrac2 bin]$ps -aef|grep ons

2) 確認ons服務的狀態
[grid@dbrac2 bin]$onsctl ping

3) 啟動ons服務
[grid@dbrac2 bin]$onsctl start

4)使用debug選項,可以查看詳細信息,其中最有意義的就是能顯示所有連接。
[grid@dbrac1 ~]$ onsctl debug
HTTP/1.1 200 OK
Content-Length: 2435
Content-Type: text/html
Response:

== dbrac1:6200 9880 18/03/06 19:32:52 ==
Home: /oracle/app/11.2.0/grid

======== ONS ========
           IP ADDRESS                   PORT    TIME   SEQUENCE  FLAGS
--------------------------------------- ----- -------- -------- --------
                           192.168.56.2  6200 5a9e7c23 00000002 00000008

Listener:

  TYPE                BIND ADDRESS               PORT  SOCKET
-------- --------------------------------------- ----- ------
Local                                    0.0.0.1  6100      5
Local                                  127.0.0.1  6100      6
Remote                                       any  6200      7
Remote                                       any  6200      -

Servers: (1)

            INSTANCE NAME                  TIME   SEQUENCE  FLAGS     DEFER
---------------------------------------- -------- -------- -------- ----------
dbInstance_dbrac2_6200                   5a9e739d 00000006 00000002          0
                            192.168.56.4 6200

Connection Topology: (2)

                IP                      PORT   VERS  TIME
--------------------------------------- ----- ----- --------
                           192.168.56.4  6200     4 5a9e739d
                           **                            192.168.56.2 6200
                           192.168.56.2  6200     4 5a9e7c23=
                           **                            192.168.56.4 6200

Server connections:

   ID            CONNECTION ADDRESS              PORT  FLAGS  SENDQ REF WSAQ
-------- --------------------------------------- ----- ------ ----- --- ----
       0                            192.168.56.4  6200 010405 00000 001     

Client connections:

   ID            CONNECTION ADDRESS              PORT  FLAGS  SENDQ REF SUB W
-------- --------------------------------------- ----- ------ ----- --- --- -
       1                                internal     0 01008a 00000 001 002  
       4                                 0.0.0.1  6100 01001a 00000 001 000  
 request                                 0.0.0.1  6100 03201a 00000 001 000  

Worker Ticket: 18/18, Last: 18/03/06 19:32:47

   THREAD   FLAGS
  -------- --------
  aa4f9700 00000012
  aa4b8700 00000012
  aa477700 00000012

Resources:

  Notifications:
    Received: Total 6 (Internal 2), in Receive Q: 0
    Processed: Total 6, in Process Q: 0

  Pool Counts:
    Message: 1, Link: 1, Ack: 1, Match: 1
[grid@dbrac1 ~]$

4.1.3 srvctl
該命令是rac維護中最常用的命令,也是最復雜的命令。 這個工具可以操作下面的幾種資源:database,instance,asm,service,listener和node application,其中node application又包括gsd,ons,vip。 這些資源除了使用srvctl工具統一管理外,某些資源還有自己獨立的管理工具,比如ons可以使用onsctl命令進行管理;listener可以通過lsnrctl管理。
[grid@dbrac1 ~]$ srvctl -help
Usage: srvctl <command> <object> [<options>]
    commands: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config|convert|upgrade
    objects: database|instance|service|nodeapps|vip|network|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns|cvu
For detailed help on each command and object and its options use:
  srvctl <command> -h or
  srvctl <command> <object> -h
[grid@dbrac1 ~]$

4.1.3.1 使用config查看配置
1)查看數據庫配置
不帶任何參數時,顯示ocr中注冊的所有數據庫
[grid@dbrac1 ~]$ srvctl config database
dbrac
[grid@dbrac1 ~]$

--使用-d選項,查看某個數據庫配置
[grid@dbrac1 ~]$ srvctl config database
dbrac
[grid@dbrac1 ~]$
[grid@dbrac1 ~]$ srvctl config database -d dbrac
Database unique name: dbrac
Database name: dbrac
Oracle home: /oracle/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/dbrac/spfiledbrac.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: dbrac
Database instances: dbrac1,dbrac2
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[grid@dbrac1 ~]$
注: 該輸出結果顯示數據庫raw由2個節點組成,各自實例名交rac1和rac2.兩個實例的$oracle_home是/u01/app/oracle/product/10.2.0/db_1

--使用-a選項查看配置的詳細信息
[grid@dbrac1 ~]$ srvctl config database -d dbrac -a
Database unique name: dbrac
Database name: dbrac
Oracle home: /oracle/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/dbrac/spfiledbrac.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: dbrac
Database instances: dbrac1,dbrac2
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC
Database is enabled
Database is administrator managed
[grid@dbrac1 ~]$

2)查看node application的配置
[grid@dbrac1 ~]$  srvctl config nodeapps -h

Displays the configuration information for the node applications.

Usage: srvctl config nodeapps [-a] [-g] [-s]
    -a                       Display VIP configuration
    -g                       Display GSD configuration
    -s                       Display ONS daemon configuration
    -h                       Print usage
[grid@dbrac1 ~]$

不帶任何參數,返回節點名,實例名和$oracle_home
[grid@dbrac1 ~]$  srvctl config nodeapps
Network exists: 1/192.168.56.0/255.255.255.0/eth0, type static
VIP exists: /dbrac1-vip/192.168.56.3/192.168.56.0/255.255.255.0/eth0, hosting node dbrac1
VIP exists: /dbrac2-vip/192.168.56.5/192.168.56.0/255.255.255.0/eth0, hosting node dbrac2
GSD exists
ONS exists: Local port 6100, remote port 6200, EM port 2016
[grid@dbrac1 ~]$

--使用-a選項,查看vip配置
[grid@dbrac1 ~]$ srvctl config nodeapps -a
Network exists: 1/192.168.56.0/255.255.255.0/eth0, type static
VIP exists: /dbrac1-vip/192.168.56.3/192.168.56.0/255.255.255.0/eth0, hosting node dbrac1
VIP exists: /dbrac2-vip/192.168.56.5/192.168.56.0/255.255.255.0/eth0, hosting node dbrac2
[grid@dbrac1 ~]$

--使用-g選項, 查看gsd:
[grid@dbrac1 ~]$ srvctl config nodeapps -g
GSD exists
[grid@dbrac1 ~]$
 
--使用-s選項,查看ons:
[grid@dbrac1 ~]$ srvctl config nodeapps -s
ONS exists: Local port 6100, remote port 6200, EM port 2016
[grid@dbrac1 ~]$

3)查看listener.
[grid@dbrac1 ~]$ srvctl config listener -l LISTENER
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521
[grid@dbrac1 ~]$
[grid@dbrac1 ~]$ srvctl config listener -l LISTENER -a
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
  /oracle/app/11.2.0/grid on node(s) dbrac2,dbrac1
End points: TCP:1521
[grid@dbrac1 ~]$
[grid@dbrac1 ~]$

4)查看asm
[grid@dbrac1 ~]$ srvctl config asm -h

Displays the configuration for ASM.

Usage: srvctl config asm [-a]
    -a                       Print detailed configuration information
    -h                       Print usage
[grid@dbrac1 ~]$
[grid@dbrac1 ~]$ srvctl config asm
ASM home: /oracle/app/11.2.0/grid
ASM listener: LISTENER
[grid@dbrac1 ~]$
[grid@dbrac1 ~]$ srvctl config asm -a
ASM home: /oracle/app/11.2.0/grid
ASM listener: LISTENER
ASM is enabled.
[grid@dbrac1 ~]$

5) 查看service
--查看數據庫所有service配置
[grid@dbrac1 ~]$ srvctl config service -h

Displays the configuration for the service.

Usage: srvctl config service -d <db_unique_name> [-s <service_name>] [-v]
    -d <db_unique_name>      Unique name for the database
    -s <service>             Service name
    -v                       Verbose output
    -h                       Print usage
[grid@dbrac1 ~]$

4.1.3.2 使用add添加對象
一般情況下,應用層資源都是在圖形界面的幫助下注冊到ocr中的,比如vip,ons實在安裝最后階段創建的,而數據庫,asm是執行dbca的過程中自動注冊到ocr中的,listener是通過netca工具。 但是有些時候需要手工把資源注冊到ocr中。 這時候就需要add命令了。
1) 添加數據庫
[grid@dbrac2 bin]$srvctl add database -d dbrac -o $ORACLE_HOME

2) 添加實例
[grid@dbrac2 bin]$srvctl add instance -d dbrac -n dbrac1 -i dbrac1
[grid@dbrac2 bin]$srvctl add instance -d dbrac -n dbrac2 -i dbrac2

3)添加服務,需要使用4個參數
-s :服務名
-r:首選實例名
-a:備選實例名
-P:taf策略,可選值為none(缺省值),basic,preconnect。
[grid@dbrac1 ~]$ srvctl add service -d dbrac -s dmmservice -r dbrac1 -a dbrac2 -P basic

4)確認添加成功
[oracle@dbrac1 ~]$ srvctl add service -d dbrac -s dmmservice -r dbrac1 -a dbrac2 -P basic
[oracle@dbrac1 ~]$

--查看服務配置:
[oracle@dbrac1 ~]$ srvctl config service -d dbrac -s dmmservice -v
Service name: dmmservice
Service is enabled
Server pool: dbrac_dmmservice
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: dbrac1
Available instances: dbrac2
[oracle@dbrac1 ~]$

[grid@dbrac1 ~]$ crsctl status resource ora.dbrac.dmmservice.svc
NAME=ora.dbrac.dmmservice.svc
TYPE=ora.service.type
TARGET=OFFLINE
STATE=OFFLINE on dbrac1

[grid@dbrac1 ~]$

--啟動服務:
[oracle@dbrac1 ~]$ srvctl start service -d dbrac -s dmmservice

--再次查看服務狀態:
[grid@dbrac1 ~]$ crsctl status resource ora.dbrac.dmmservice.svc
NAME=ora.dbrac.dmmservice.svc
TYPE=ora.service.type
TARGET=ONLINE
STATE=ONLINE on dbrac1

[grid@dbrac1 ~]$
---------------------------------
[oracle@dbrac1 ~]$  srvctl add service -d dbrac -s abcde -r dbrac2 -a dbrac1 -P BASIC -y automatic -e SELECT -z 5 -w 180
[oracle@dbrac1 ~]$  srvctl add service -d dbrac -s aaaa -r dbrac1,dbrac2 -P BASIC -e SELECT -z 10 -w 60

[oracle@dbrac1 ~]$ srvctl config service -d dbrac -s abcde -v
Service name: abcde
Service is enabled
Server pool: dbrac_abcde
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: NONE
TAF failover retries: 5
TAF failover delay: 180
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: dbrac2
Available instances: dbrac1
[oracle@dbrac1 ~]$

[oracle@dbrac1 ~]$ srvctl config service -d dbrac -s aaaa -v
Service name: aaaa
Service is enabled
Server pool: dbrac_aaaa
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: NONE
TAF failover retries: 10
TAF failover delay: 60
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: dbrac1,dbrac2
Available instances:
[oracle@dbrac1 ~]$

4.1.3.3 使用enable/disable啟動,禁用對象
缺省情況下數據庫,實例,服務,asm都是隨著crs的啟動而自啟動的,有時候由于維護的需要,可以先關閉這個特性。
1)配置數據庫隨crs的啟動而自動啟動
--啟用數據庫的自啟動:
[grid@dbrac2 bin]$srvctl enable database -d dbrac

--查看配置
[oracle@dbrac1 ~]$ srvctl config database -d dbrac -a
Database unique name: dbrac
Database name: dbrac
Oracle home: /oracle/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/dbrac/spfiledbrac.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: dbrac
Database instances: dbrac1,dbrac2
Disk Groups: DATA,FRA
Mount point paths:
Services: aaaa,abcde,dmmservice
Type: RAC
Database is enabled
Database is administrator managed
[oracle@dbrac1 ~]$

--禁止數據庫在crs啟動后自啟動,這時需要手動啟動
[grid@dbrac2 bin]$ srvctl disable database -d dbrac

2) 關閉某個實例的自動啟動
[grid@dbrac2 bin]$ srvctl disable instance -d dbrac -i dbrac1
[grid@dbrac2 bin]$ srvctl enable instance -d dbrac -i dbrac2

--查看信息
[grid@dbrac2 bin]$ srvctl config database -d dbrac -a

3)禁止某個服務在實例上運行
[grid@dbrac2 bin]$ srvctl enable service -d dbrac -s aaaa -i dbrac1
[grid@dbrac2 bin]$ srvctl disable service -d dbrac -s aaaa -i dbrac2

--查看
[oracle@dbrac1 ~]$ srvctl config database -d dbrac -a

4.1.3.4 使用remove刪除對象
使用remove命令刪除的是對象在ocr中的定義信息,對象本身比如數據庫的數據文件等不會被刪除,以后隨時可以使用add命令重新添加到ocr中。
 
1)刪除service,在刪除之前,命令會給出確定提示
[oracle@dbrac1 ~]$ srvctl remove service -d dbrac -s aaaa

2)刪除實例,刪除之前同樣會給出提示
[grid@dbrac2 bin]$ srvctl remove instance -d dbrac -i dbrac1

3)刪除數據庫
[grid@dbrac2 bin]$ srvctl remove database -d dbrac

4.1.3.5 啟動,停止對象與查看對象
在rac環境下啟動,關閉數據庫雖然仍然可以使用sql/plus方法,但是更推薦使用srvctl命令來做這些工作,這可以保證即使更新crs中運行信息,可以使用start/stop命令啟動,停止對象,然后使用status命令查看對象狀態。
1) 啟動數據庫,默認啟動到open狀態
[grid@dbrac2 bin]$ srvctl start database -d dbrac

2) 指定啟動狀態
[grid@dbrac2 bin]$ srvctl start database -d dbrac -i dbrac1 -o mount
[grid@dbrac2 bin]$ srvctl start database -d dbrac -i dbrac2 -o nomount

3) 關閉對象,并指定關閉方式
[grid@dbrac2 bin]$ srvctl stop instance -d dbrac -i dbrac1 -o immediate
[grid@dbrac2 bin]$ srvctl stop instance -d dbrac -i dbrac2 -o abort

4) 在指定實例上啟動服務:
[grid@dbrac2 bin]$ srvctl start service -d dbrac -s aaaa -i dbrac1

--查看服務狀態
[grid@dbrac2 bin]$ srvctl status service -d aaaa -v

5) 關閉指定實例上的服務
[grid@dbrac2 bin]$ srvctl stop service -d dbrac -s aaaa -i dbrac1

--查看服務狀態
[grid@dbrac2 bin]$ srvctl status service -d dbrac -v

4.1.3.6 跟蹤srcctl
在oracle 10g中要跟蹤srvctl非常簡單,只要設置srvm_trace=true這個os環境變量即可,這個命令的所有函數調用都會輸出到屏幕上,可以幫助用戶進行診斷。
[grid@dbrac2 bin]$ export srvm_trace=true
[grid@dbrac2 bin]$ srvctl config database -d dbrac

4.1.4 恢復
設ocr磁盤和votedisk磁盤全部破壞,并且都沒有備份,該如何恢復,這時最簡單的方法就是重新初始話ocr和votedisk, 具體操作如下:

1) 停止所有節點的clusterware stack

crsctl stop crs;

2) 分別在每個節點用root用戶執行$crs_home\install\rootdelete.sh腳本

3) 在任意一個節點上用root用戶執行$crs_home\install\rootinstall.sh腳本

4) 在和上一步同一個節點上用root執行$crs_home\root.sh腳本

5) 在其他節點用root執行行$crs_home\root.sh腳本

6) 用netca命令重新配置監聽,確認注冊到clusterware中

#crs_stat -t -v
到目前為止,只有listener,ons,gsd,vip注冊到ocr中,還需要把asm, 數據庫都注冊到ocr中。

l 向ocr中添加asm

#srvctl add asm -n rac1 -i +asm1 -o /u01/app/product/database
#srvctl add asm -n rac2 -i +asm2 -o /u01/app/product/database

l 啟動asm

#srvctl start asm -n rac1
#srvctl start asm -n rac2
若在啟動時報ora-27550錯誤。是因為rac無法確定使用哪個網卡作為private interconnect,解決方法:在兩個asm的pfile文件里添加如下參數:
+asm1.cluster_interconnects=’10.85.10.119′
+asm2.cluster_interconnects=’10.85.10.121′

l 手工向ocr中添加database對象

#srvctl add database -d raw -o /u01/app/product/database

l 添加2個實例對象

#srvctl add instance -d raw -i rac1 -n rac1
#srvctl add instance -d raw -i rac2 -n rac2

l 修改實例和asm實例的依賴關系

#srvctl modify instance -d raw -i rac1 -s +asm1
#srvctl modify instance -d raw -i rac2 -s +asm2

l 啟動數據庫

#srvctl start database-d raw
若也出現ora-27550錯誤。也是因為rac無法確定使用哪個網卡作為private interconnect,修改pfile參數在重啟動即可解決。
sql>alter system set cluster_interconnects=’10.85.10.119′ scope=spfile sid=’rac1′;
sql>alter system set cluster_interconnects=’10.85.10.121′ scope=spfile sid=’rac2′;


以上是“oracle中clusterware的命令集有幾種”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女