Oracle 叢集軟體資源的手工註冊(zt)

zhouwf0726發表於2019-06-25



1. 登出crs本身自帶的ons、gsd、vip資源

root@rac01 # crs_stop -all
Attempting to stop `ora.rac01.gsd` on member `rac01`
Attempting to stop `ora.rac01.ons` on member `rac01`
Attempting to stop `ora.rac02.gsd` on member `rac02`
Attempting to stop `ora.rac02.ons` on member `rac02`
Stop of `ora.rac02.gsd` on member `rac02` succeeded.
Stop of `ora.rac02.ons` on member `rac02` succeeded.
Stop of `ora.rac01.gsd` on member `rac01` succeeded.
Stop of `ora.rac01.ons` on member `rac01` succeeded.
Attempting to stop `ora.rac01.vip` on member `rac01`
Attempting to stop `ora.rac02.vip` on member `rac02`
Stop of `ora.rac02.vip` on member `rac02` succeeded.
Stop of `ora.rac01.vip` on member `rac01` succeeded.

root@rac01 # crs_unregister ora.rac01.gsd
root@rac01 # crs_unregister ora.rac01.ons
root@rac01 # crs_unregister ora.rac01.vip
root@rac01 # crs_unregister ora.rac02.vip
root@rac01 # crs_unregister ora.rac02.ons
root@rac01 # crs_unregister ora.rac02.gsd
root@rac01 # crs_stat -t
CRS-0202: No resources are registered.

2.建立虛擬IP資源:

root@rac01 # crs_profile -create havip -t application -a /oracle/crs/bin/usrvip \
-o i=e1000g0,ov=10.198.94.139,on=255.255.248.0
root@rac01 # crs_register havip
root@rac01 # crs_setperm havip -o root
root@rac01 # crs_setperm havip -u user:oracle:r-x
root@rac01 # crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ha_vip application 0/1 0/0 OFFLINE OFFLINE
root@rac01 # crs_start havip
root@rac01 # crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
havip application 0/1 0/0 ONLINE ONLINE rac01



對crs_profile命令中的選項和引數做簡單說明:


(1) 選項-r定義了該資源所依賴的資源,在下面的例子中,資源oradata_mount啟動時依賴於
disk_group先 啟動,需要停止disk_group的時候必須先停止資源oradata_mount,
資源orcl_db的啟動則同時依賴於oradata_mount/disk_group/havip/listener;
(2) 引數-o 包括:ci的意思是crs對資源狀態的監測間隔(check interval),單位為秒;
ra : crs重啟資源的嘗試次數,RESTART_ATTEMPTS,次數到達以後將重新分配;
fi : 資源狀態出現錯誤以後,crs的嘗試間隔,FAILURE_INTERVAL,單位是秒;
ft : 資源狀態出現錯誤以後,crs的嘗試次數,FAILURE_THRESHOLD;
這些引數可以使用預設值,分別是60秒/1/0秒/0。
(3) 引數-a 是指ACTION_SCRIPT,引數值為資源啟動、關閉、監測的指令碼,指令碼固定的三個引數為
start/stop/check;

管理資料庫監聽的部分:

修改$ORACLE_HOME/network/admin/listener.ora檔案,
將其中(HOST = rac01 )部分修改成(HOST = 10.198.94.139 ) (虛擬IP地址)

crs_profile -create listener -t application -a /oracle/crs/crs/public/lsnr.sh -r havip -o \
ci=180,ra=6,ft=2,fi=12
crs_register listener
crs_setperm listener -o root
crs_setperm listener -u user:oracle:r-x
crs_start listener

管理磁碟組和邏輯卷的部分:

crs_profile -create disk_group -t application -a /oracle/crs/crs/public/dg.sh -r havip -o \
ci=180,ra=6,ft=2,fi=12
crs_register disk_group
crs_setperm disk_group -o root
crs_setperm disk_group -u user:oracle:r-x

注:本身磁碟組的啟動並不依賴於虛擬IP的啟動,這裡之所以設定兩者的依賴關係,
是為了防止虛擬IP在一個節點啟動,而磁碟組在另外一個節點啟動,造成資源不一致的情況出現。

管理檔案系統的部分:

crs_profile -create oradata_mount -t application -a /oracle/crs/crs/public/fs.sh -r disk_group -o \
ci=180,ra=6,ft=2,fi=12
crs_register oradata_mount
crs_setperm oradata_mount -o root
crs_setperm oradata_mount -u user:oracle:r-x

管理資料庫例項的部分:

crs_profile -create orcl_db -t application -a /oracle/crs/crs/public/db.sh -r \
"oradata_mount listener" -o ci=180,ra=6,ft=2,fi=12
crs_register orcl_db
crs_setperm orcl_db -o root
crs_setperm orcl_db -u user:oracle:r-x
crs_start orcl_db

4.確保指令碼具有執行屬性,並把public 和profile的內容拷到第二個節點上


# chmod +x /oracle/crs/crs/public/*
# rcp -r -p /oracle/crs/crs/public/* rac02:/oracle/crs/crs/public/

5.啟動所有的資源


下面可以看到,在crs啟動和關閉資源的過程中,其順序是按照前面定義的資源依賴關係進行的:

root@rac01 # crs_stop -all
Attempting to stop `orcl_db` on member `rac01`
Stop of `orcl_db` on member `rac01` succeeded.
Attempting to stop `oradata_mount` on member `rac01`
Stop of `oradata_mount` on member `rac01` succeeded.
Attempting to stop `disk_group` on member `rac01`
Stop of `disk_group` on member `rac01` succeeded.
Attempting to stop `listener` on member `rac01`
Stop of `listener` on member `rac01` succeeded.
Attempting to stop `havip` on member `rac01`
Stop of `havip` on member `rac01` succeeded.

root@rac01 # crs_start -all
Attempting to start `havip` on member `rac01`
Start of `havip` on member `rac01` succeeded.
Attempting to start `listener` on member `rac01`
Start of `listener` on member `rac01` succeeded.
Attempting to start `disk_group` on member `rac01`
Start of `disk_group` on member `rac01` succeeded.
Attempting to start `oradata_mount` on member `rac01`
Start of `oradata_mount` on member `rac01` succeeded.
Attempting to start `orcl_db` on member `rac01`
Start of `orcl_db` on member `rac01` succeeded.

檢查資源狀態是否正常:

oracle@rac01 $ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
disk_group application ONLINE ONLINE rac01
havip application ONLINE ONLINE rac01
listener application ONLINE ONLINE rac01
oradata_mount application ONLINE ONLINE rac01
orcl_db application ONLINE ONLINE rac01

 

全文連結:

http://www.itpub.net/viewthread.php?tid=941389&extra=&page=1

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/756652/viewspace-321801/,如需轉載,請註明出處,否則將追究法律責任。

相關文章