crs之上的resource管理總結(CRS_PROFILE)
重點介紹了crs_profile以及srvctl相關命令的用法。
oracle從10g開始把crs打造成了一個獨立的叢集軟體了,
儘管除了在rac裡使用較多,但是本身crs具備了叢集軟體的很多功能了,下面是在crs主目錄的bin目錄下的一些命令,這些命令主要就是管理crs基礎之上的resource(可以理解成os之上的服務)。
[root@node2
bin]# pwd
/crs/bin
[root@node2 bin]# ls crs*
crsctl crs_profile
crs_setperm crs_stop
crsctl.bin crs_profile.bin crs_setperm.bin
crs_stop.bin
crsd crs_register crs_start crstmpl.scr
crsd.bin
crs_register.bin crs_start.bin crs_unregister
crs_getperm crs_relocate
crs_stat crs_unregister.bin
crs_getperm.bin crs_relocate.bin
crs_stat.bin
[root@node2 bin]#
下面以一套執行在redhat
as4上10gR2版本下的rac為例我們來看這些命令的用途:
[root@node2 bin]# crs_stat -t
Name Type
Target State Host
------------------------------------------------------------
ora....b1.inst
application ONLINE ONLINE node1
ora....b2.inst application ONLINE ONLINE
node2
ora.asmdb.db application ONLINE ONLINE node1
ora....db1.srv
application OFFLINE OFFLINE
ora....db2.srv application OFFLINE OFFLINE
ora.....taf.cs application OFFLINE OFFLINE
ora....SM1.asm application
ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application
ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr
application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE
node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip
application ONLINE ONLINE node2
[root@node2 bin]#
--================================
1、crs_profile
crs_profile僅對resource的profile進行操作
A.在介紹crs_profile的時侯我們以ora.node2.LISTENER_NODE2.lsnr為例
其實每一個crs基礎之上的resource都一個profile檔案,比如我們可以透過
crs_stat
-p來顯示profile的內容:
[root@node2 bin]# crs_stat -p
ora.node2.LISTENER_NODE2.lsnr
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
ACTION_SCRIPT=/app/oracle/product/10.2.0/db_1/bin/racgwrap
ACTIVE_PLACEMENT=0
AUTO_START=2
CHECK_INTERVAL=60
DESCRIPTION=ora.node2.LISTENER_NODE2.lsnr
FAILOVER_DELAY=0
FAILURE_INTERVAL=0
FAILURE_THRESHOLD=0
HOSTING_MEMBERS=
OPTIONAL_RESOURCES=
PLACEMENT=balanced
REQUIRED_RESOURCES=
RESTART_ATTEMPTS=1
SCRIPT_TIMEOUT=60
START_TIMEOUT=0
STOP_TIMEOUT=0
UPTIME_THRESHOLD=7d
USR_ORA_ALERT_NAME=
USR_ORA_CHECK_TIMEOUT=0
USR_ORA_CONNECT_STR=/
as
sysdba
USR_ORA_DEBUG=0
USR_ORA_DISCONNECT=false
USR_ORA_FLAGS=
USR_ORA_IF=
USR_ORA_INST_NOT_SHUTDOWN=
USR_ORA_LANG=
USR_ORA_NETMASK=
USR_ORA_OPEN_MODE=
USR_ORA_OPI=false
USR_ORA_PFILE=
USR_ORA_PRECONNECT=none
USR_ORA_SRV=
USR_ORA_START_TIMEOUT=0
USR_ORA_STOP_MODE=immediate
USR_ORA_STOP_TIMEOUT=0
USR_ORA_VIP=
[root@node2 bin]#
[root@node2 bin]#
--==================================
上面這些內容是從ocr裡讀取出來的,我們可以透過crs_profile
-create
來生成一個檔案:
[root@node2 profile]# crs_profile -create
ora.node2.LISTENER_NODE2.lsnr -t application
[root@node2 profile]#
ls
ora.node2.LISTENER_NODE2.lsnr.cap
[root@node2 profile]#
pwd
/crs/crs/profile
[root@node2 profile]#
預設以root使用者執行的話在/crs/crs/profile下生成,以其他使用者執行
的話在/crs/crs/public/下面。
檔案的名字就是resource_name的後面多了.cap
--===================================
檔案的內容如下:
[root@node2
profile]# more ora.node2.LISTENER_NODE2.lsnr.cap
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
ACTION_SCRIPT=/crs/crs/script/ora.node2.LISTENER_NODE2.lsnr.scr
ACTIVE_PLACEMENT=0
AUTO_START=restore
CHECK_INTERVAL=60
DESCRIPTION=ora.node2.LISTENER_NODE2.lsnr
FAILOVER_DELAY=0
FAILURE_INTERVAL=0
FAILURE_THRESHOLD=0
HOSTING_MEMBERS=
OPTIONAL_RESOURCES=
PLACEMENT=balanced
REQUIRED_RESOURCES=
RESTART_ATTEMPTS=1
SCRIPT_TIMEOUT=60
START_TIMEOUT=0
STOP_TIMEOUT=0
UPTIME_THRESHOLD=7d
USR_ORA_ALERT_NAME=
USR_ORA_CHECK_TIMEOUT=0
USR_ORA_CONNECT_STR=/
as
sysdba
USR_ORA_DEBUG=0
USR_ORA_DISCONNECT=false
USR_ORA_FLAGS=
USR_ORA_IF=
USR_ORA_INST_NOT_SHUTDOWN=
USR_ORA_LANG=
USR_ORA_NETMASK=
USR_ORA_OPEN_MODE=
USR_ORA_OPI=false
USR_ORA_PFILE=
USR_ORA_PRECONNECT=none
USR_ORA_SRV=
USR_ORA_START_TIMEOUT=0
USR_ORA_STOP_MODE=immediate
USR_ORA_STOP_TIMEOUT=0
USR_ORA_VIP=
[root@node2
profile]#
這與我們透過crs_stat -p
ora.node2.LISTENER_NODE2.lsnr
看到的內容相比差在ACTION_SCRIPT上:
ACTION_SCRIPT=/app/oracle/product/10.2.0/db_1/bin/racgwrap
ACTION_SCRIPT=/crs/crs/script/ora.node2.LISTENER_NODE2.lsnr.scr
動作指令碼恰恰是一個resource能否執行的最重要的內容。
--=============================
B.crs_profile
-delete
[root@node2 profile]#
ls
ora.node2.LISTENER_NODE2.lsnr.cap
[root@node2 profile]# cp
ora.node2.LISTENER_NODE2.lsnr.cap
ora.node2.LISTENER_NODE2.lsnr.cap.bak
[root@node2 profile]# crs_profile
-delete ora.node2.LISTENER_NODE2.lsnr
[root@node2 profile]#
ls
ora.node2.LISTENER_NODE2.lsnr.cap.bak
[root@node2 profile]#
[root@node2 profile]#
很顯然crs_profile
-delete就是刪除/crs/crs/profile下的資原始檔
--===================================
C.crs_profile
-validate
[root@node2 profile]# crs_profile -validate
ora.node2.LISTENER_NODE2.lsnr
CRS-0181: Cannot access the resource profile
'/crs/crs/profile/ora.node2.LISTENER_NODE2.lsnr.cap'.
CRS-0180: Resource '/crs/crs/profile/ora.node2.LISTENER_NODE2.lsnr.cap' validation failed.
[root@node2 profile]#
ls
ora.node2.LISTENER_NODE2.lsnr.cap.bak
[root@node2 profile]# mv
ora.node2.LISTENER_NODE2.lsnr.cap.bak
ora.node2.LISTENER_NODE2.lsnr.cap
[root@node2 profile]# crs_profile -validate
ora.node2.LISTENER_NODE2.lsnr
[root@node2 profile]#
crs_profile
-validate就是在對應的目錄下堅持resource
profile的有效性
--===============================
D.crs_profile -print
crs_profile -print 就是顯示相應目錄下resource profile的內容
[root@node2 profile]#
crs_profile -print
ora.node2.LISTENER_NODE2.lsnr
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
ACTION_SCRIPT=/crs/crs/script/ora.node2.LISTENER_NODE2.lsnr.scr
ACTIVE_PLACEMENT=0
AUTO_START=restore
CHECK_INTERVAL=60
DESCRIPTION=ora.node2.LISTENER_NODE2.lsnr
FAILOVER_DELAY=0
FAILURE_INTERVAL=0
FAILURE_THRESHOLD=0
HOSTING_MEMBERS=
OPTIONAL_RESOURCES=
PLACEMENT=balanced
REQUIRED_RESOURCES=
RESTART_ATTEMPTS=1
SCRIPT_TIMEOUT=60
START_TIMEOUT=0
STOP_TIMEOUT=0
UPTIME_THRESHOLD=7d
USR_ORA_ALERT_NAME=
USR_ORA_CHECK_TIMEOUT=0
USR_ORA_CONNECT_STR=/
as
sysdba
USR_ORA_DEBUG=0
USR_ORA_DISCONNECT=false
USR_ORA_FLAGS=
USR_ORA_IF=
USR_ORA_INST_NOT_SHUTDOWN=
USR_ORA_LANG=
USR_ORA_NETMASK=
USR_ORA_OPEN_MODE=
USR_ORA_OPI=false
USR_ORA_PFILE=
USR_ORA_PRECONNECT=none
USR_ORA_SRV=
USR_ORA_START_TIMEOUT=0
USR_ORA_STOP_MODE=immediate
USR_ORA_STOP_TIMEOUT=0
USR_ORA_VIP=
[root@node2 profile]#
--=====================================
E.crs_profile -update
crs_profile -update 就是修改resource
profile
比如想把AUTO_START的值改為0或者其他
AUTO_START控制著在crs啟動之後是否把這個resource一同起來,
一共有3個值,下面是doc的原話:
Indicates whether Oracle Clusterware should automatically start a resource after a cluster restart. Valid AUTO_START values are:
always—Restarts the resource when the node restarts regardless of the state of the resource when the node stopped.
restore—Restores the resource to the same state that it was in when the node went down. If the state of the resource was offline (STATE=OFFLINE, TARGET=OFFLINE) when the node went down, then the resource remains offline when the node comes back up. The resource is started only if it was online before the node went down.
never—Oracle Clusterware never restarts the resource regardless of the state of the resource when the node stopped.
The default is restore.
Note: Oracle only supports lower-case values for always, restore, and
never.
其中我們透過crs_stat
-p顯示出來經常看到AUTO_START的值是1
我的理解1對應的就是restore,2對應的是never(這個過一會下面透過srvctl還有驗證),0對應的就是never
--================================
[root@node2
profile]# more ora.node2.LISTENER_NODE2.lsnr.cap
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
ACTION_SCRIPT=/crs/crs/script/ora.node2.LISTENER_NODE2.lsnr.scr
ACTIVE_PLACEMENT=0
AUTO_START=restore
...............
--========================
[root@node2
profile]# crs_profile -update ora.node2.LISTENER_NODE2.lsnr -o
as=always
[root@node2 profile]# more ora.node2.LISTENER_NODE2.lsnr.cap
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
ACTION_SCRIPT=/crs/crs/script/ora.node2.LISTENER_NODE2.lsnr.scr
ACTIVE_PLACEMENT=0
AUTO_START=always
.........................
[root@node2
profile]# crs_profile -validate ora.node2.LISTENER_NODE2.lsnr
[root@node2
profile]#
[root@node2 profile]#
修改之後有效性檢查也沒有問題。
--==============================
F.crs_profile
-template resource_name
[root@node2 profile]# crs_profile -template
ora.node2.LISTENER_NODE2.lsnr
[root@node2 profile]#
ls
ora.node2.LISTENER_NODE2.lsnr.cap template.cap
[root@node2 profile]#
執行命令之後生成了一個模板檔案:template.cap
內容如下:
[root@node2 profile]# more
template.cap
NAME=
TYPE=application
ACTION_SCRIPT=
ACTIVE_PLACEMENT=0
AUTO_START=always
CHECK_INTERVAL=60
DESCRIPTION=
FAILOVER_DELAY=0
FAILURE_INTERVAL=0
FAILURE_THRESHOLD=0
HOSTING_MEMBERS=
OPTIONAL_RESOURCES=
PLACEMENT=balanced
REQUIRED_RESOURCES=
RESTART_ATTEMPTS=1
SCRIPT_TIMEOUT=60
START_TIMEOUT=0
STOP_TIMEOUT=0
UPTIME_THRESHOLD=7d
USR_ORA_ALERT_NAME=
USR_ORA_CHECK_TIMEOUT=0
USR_ORA_CONNECT_STR=/
as
sysdba
USR_ORA_DEBUG=0
USR_ORA_DISCONNECT=false
USR_ORA_FLAGS=
USR_ORA_IF=
USR_ORA_INST_NOT_SHUTDOWN=
USR_ORA_LANG=
USR_ORA_NETMASK=
USR_ORA_OPEN_MODE=
USR_ORA_OPI=false
USR_ORA_PFILE=
USR_ORA_PRECONNECT=none
USR_ORA_SRV=
USR_ORA_START_TIMEOUT=0
USR_ORA_STOP_MODE=immediate
USR_ORA_STOP_TIMEOUT=0
USR_ORA_VIP=
[root@node2
profile]#
[root@node2 profile]#
很顯然這都是些type為application的resource需要的通用引數,
name和ACTION_SCRIPT的值都已經為空了。
--============================
G.crs_profile
-template -t
application
這條命令乾脆直接是從系統的模板中生成模板檔案,當然條件是type為application
[root@node2
profile]# crs_profile -template -t application
CRS-0162: The file
'./template.cap' exists. Creation is cancelled.
[root@node2 profile]# ls
ora.node2.LISTENER_NODE2.lsnr.cap
template.cap
[root@node2 profile]# crs_profile -template -t application -O
test.ora
[root@node2 profile]# ls
ora.node2.LISTENER_NODE2.lsnr.cap
template.cap test.ora
[root@node2 profile]#
test.ora和template.cap的內容是一樣的,因為template.cap是從
ora.node2.LISTENER_NODE2.lsnr生成的模板,而ora.node2.LISTENER_NODE2.lsnr
的type就是application;生成test.ora時選項-t的值也是application
另外本身crs也自帶了一些模板在目錄/crs/crs/template下:
[root@node2
template]# pwd
/crs/crs/template
[root@node2 template]#
ls
application.tdf generic.tdf TYPE_application.cap
TYPE_generic.cap
[root@node2 template]#
有關模板是物件導向中的概念,oracle中也常用,我們在建庫的時侯就可以
儲存模板。
--==================================
2.crs_unregister
不註冊resource,對rac來說就是把resource從ocr中刪除。
還是以ora.node2.LISTENER_NODE2.lsnr
為例
[root@node2 bin]# crs_unregister ora.node2.LISTENER_NODE2.lsnr
CRS-0214: Could not unregister resource 'ora.node2.LISTENER_NODE2.lsnr'.
[root@node2 bin]# crs_stat ora.node2.LISTENER_NODE2.lsnr
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE
on node2
[root@node2 bin]#
由於ora.node2.LISTENER_NODE2.lsnr目前的狀態是online,所以出錯了
[root@node2 bin]#
crs_stop ora.node2.LISTENER_NODE2.lsnr
Attempting to stop
`ora.node2.LISTENER_NODE2.lsnr` on member `node2`
Stop of
`ora.node2.LISTENER_NODE2.lsnr` on member `node2` succeeded.
[root@node2
bin]# crs_unregister ora.node2.LISTENER_NODE2.lsnr
[root@node2 bin]#
crs_stat ora.node2.LISTENER_NODE2.lsnr
CRS-0210: Could not find resource
'ora.node2.LISTENER_NODE2.lsnr'.
[root@node2 bin]#
--===========================
3.crs_register
下面相辦法把ora.node2.LISTENER_NODE2.lsnr再註冊到ocr中
[root@node2
profile]# crs_register ora.node2.LISTENER_NODE2.lsnr
Action Script
`/crs/crs/script/ora.node2.LISTENER_NODE2.lsnr.scr` does not exist!
CRS-0213:
Could not register resource 'ora.node2.LISTENER_NODE2.lsnr'.
[root@node2 profile]#
註冊時侯出錯了,因為預設要在/crs/crs/script下找執行指令碼,結果
沒有這個指令碼,在最開始就說過透過crs_profile
-create生成的
profile和crs_stat
-p實際顯示出來的內容ACTION_SCRIPT內容是一樣的,
我們把ACTION_SCRIPT的內容修改為:
/app/oracle/product/10.2.0/db_1/bin/racgwrap
繼續執行就沒有問題了:
[root@node2
profile]# crs_register ora.node2.LISTENER_NODE2.lsnr
[root@node2 profile]#
crs_stat
ora.node2.LISTENER_NODE2.lsnr
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
[root@node2 profile]#
[root@node2 profile]# crs_stat -ls
Name Owner
Primary PrivGrp Permission
-----------------------------------------------------------------
ora....b1.inst
oracle oinstall rwxrwxr--
ora....b2.inst oracle oinstall
rwxrwxr--
ora.asmdb.db oracle oinstall rwxrwxr--
ora....db1.srv oracle
oinstall rwxrwxr--
ora....db2.srv oracle oinstall rwxrwxr--
ora.....taf.cs
oracle oinstall rwxrwxr--
ora....SM1.asm oracle oinstall
rwxrwxr--
ora....E1.lsnr oracle oinstall rwxrwxr--
ora.node1.gsd oracle
oinstall rwxr-xr--
ora.node1.ons oracle oinstall rwxr-xr--
ora.node1.vip
root oinstall rwxr-xr--
ora....SM2.asm oracle oinstall
rwxrwxr--
ora....E2.lsnr root root rwxr-xr--
ora.node2.gsd oracle oinstall
rwxr-xr--
ora.node2.ons oracle oinstall rwxr-xr--
ora.node2.vip root
oinstall rwxr-xr--
[root@node2 profile]#
註冊進去之後,owner和Primary
PrivGrp以及Permission與
ora.node1.LISTENER_NODE1.lsnr(注意這是node1上的listner)
都不一致,下面我們來修改,這裡我是為了試驗需要,特意用root使用者
來做的,建議大家做的時侯可以用oracle使用者來做。
--==================================
4.crs_getperm
結合著crs_register遺留的owner等不一致問題,我們來看crs_getperm,
crs_getperm可以把resource詳細的owner、group以及許可權都可以取出來:
[root@node2
profile]# crs_getperm ora.node1.LISTENER_NODE1.lsnr
Name:
ora.node1.LISTENER_NODE1.lsnr
owner:oracle:rwx,pgrp:oinstall:rwx,other::r--,
[root@node2
profile]#
這裡注意格式:owner:oracle:rwx,pgrp:oinstall:rwx,other::r--
下面我們結合這種格式來調整ora.node2.LISTENER_NODE2.lsnr
的owner等屬性。
--================================
5.crs_setperm
crs_setperm和crs_getperm相對應,一個是get,一個是set,但是不管
crs_setperm的語法提示還是oracle
doc對aclstring的解釋都有點坑爹啊。
doc和crs_setperm的語法提示都是group,其實需要的關鍵字是pgrp
這個我們從上面crs_getperm
ora.node1.LISTENER_NODE1.lsnr的結果可以得知
,害的我費了很大勁...我寫成group報如下錯誤:
[root@node2
profile]# crs_setperm ora.node2.LISTENER_NODE2.lsnr -u
group:oinstall:rwx
CRS-0257: Groupname conflicts with the primary group of
the resource.
[root@node2 profile]#
--===========================================
[root@node2 profile]#
crs_setperm
Usage: crs_setperm resource_name -u aclstring [-q]
crs_setperm
resource_name -x aclstring [-q]
crs_setperm resource_name -o user_name
[-q]
crs_setperm resource_name -g group_name [-q]
-u Update the acl string
-x Delete the acl string
-o Change the owner
of the resource
-g Change the primary group of the resource
aclstring is one of the following:
user:
group:
other::r--
[root@node2 profile]#
參照一下crs_getperm
ora.node1.LISTENER_NODE1.lsnr的結果直接把
ora.node2.LISTENER_NODE2.lsnr的owner等屬性改成和ora.node1.LISTENER_NODE1.lsnr
一致:
[root@node2
profile]# crs_setperm ora.node2.LISTENER_NODE2.lsnr -g oinstall
[root@node2
profile]# crs_setperm ora.node2.LISTENER_NODE2.lsnr -o oracle
[root@node2
profile]# crs_setperm ora.node2.LISTENER_NODE2.lsnr -u
pgrp:oinstall:rwx
[root@node2 profile]# crs_stat -ls
Name Owner Primary
PrivGrp Permission
-----------------------------------------------------------------
ora....b1.inst
oracle oinstall rwxrwxr--
ora....b2.inst oracle oinstall
rwxrwxr--
ora.asmdb.db oracle oinstall rwxrwxr--
ora....db1.srv oracle
oinstall rwxrwxr--
ora....db2.srv oracle oinstall rwxrwxr--
ora.....taf.cs
oracle oinstall rwxrwxr--
ora....SM1.asm oracle oinstall
rwxrwxr--
ora....E1.lsnr oracle oinstall rwxrwxr--
ora.node1.gsd oracle
oinstall rwxr-xr--
ora.node1.ons oracle oinstall rwxr-xr--
ora.node1.vip
root oinstall rwxr-xr--
ora....SM2.asm oracle oinstall
rwxrwxr--
ora....E2.lsnr oracle oinstall rwxrwxr--
ora.node2.gsd oracle
oinstall rwxr-xr--
ora.node2.ons oracle oinstall rwxr-xr--
ora.node2.vip
root oinstall rwxr-xr--
[root@node2 profile]#
6.crs_relocate
改變資源執行的節點,對於處於online並且既可以執行在node1也可以執行在node2的資源如ora.asmdb.db以及ora.asmdb.taf.cs
等可以透過crs_relocate由於維護需要等改變資源執行的節點,對於那些處於offline以及狀態是unkown的資源以及本身就可以只執行在自己節點的資源如ora....b1.inst
,ora.node1.gsd ,ora.node1.ons等這些資源是沒法使用crs_relocate改變其執行節點的。
[oracle@node2
~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....b1.inst
application ONLINE ONLINE node1
ora....b2.inst application ONLINE ONLINE
node2
ora.asmdb.db application ONLINE ONLINE node2
ora....db1.srv
application ONLINE ONLINE node1
ora....db2.srv application ONLINE ONLINE
node2
ora.....taf.cs application ONLINE ONLINE node2
ora....SM1.asm
application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE
node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons
application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE
node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr
application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE
node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip
application ONLINE ONLINE node2
[oracle@node2 ~]$ crs_relocate ora.asmdb.db
-c node1
Attempting to stop `ora.asmdb.db` on member `node2`
Stop of
`ora.asmdb.db` on member `node2` succeeded.
Attempting to start
`ora.asmdb.db` on member `node1`
Start of `ora.asmdb.db` on member `node1`
succeeded.
[oracle@node2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....b1.inst
application ONLINE ONLINE node1
ora....b2.inst application ONLINE ONLINE
node2
ora.asmdb.db application ONLINE ONLINE node1
ora....db1.srv
application ONLINE ONLINE node1
ora....db2.srv application ONLINE ONLINE
node2
ora.....taf.cs application ONLINE ONLINE node2
ora....SM1.asm
application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE
node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons
application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE
node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr
application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE
node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip
application ONLINE ONLINE node2
[oracle@node2 ~]$ crs_relocate ora.asmdb.taf.cs
Attempting to stop
`ora.asmdb.taf.cs` on member `node2`
Stop of `ora.asmdb.taf.cs` on member
`node2` succeeded.
Attempting to start `ora.asmdb.taf.cs` on member
`node1`
Start of `ora.asmdb.taf.cs` on member `node1`
succeeded.
[oracle@node2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....b1.inst
application ONLINE ONLINE node1
ora....b2.inst application ONLINE ONLINE
node2
ora.asmdb.db application ONLINE ONLINE node1
ora....db1.srv
application ONLINE ONLINE node1
ora....db2.srv application ONLINE ONLINE
node2
ora.....taf.cs application ONLINE ONLINE node1
ora....SM1.asm
application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE
node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons
application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE
node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr
application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE
node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip
application ONLINE ONLINE node2
[oracle@node2 ~]$
[oracle@node2 ~]$
7.crs_stat,crs_start,crs_stop這個常用,相比大家都比較熟悉,不多介紹了。
--===========================
8.srvctl
介紹srvctl的enable和disable功能之前,先補充crs_register的update選項功能,透過update可以直接修改ocr中的
resource的屬性,比如我們還是來修改AUTO_START的值:
[root@node2
bin]# crs_stat -p
ora.node2.LISTENER_NODE2.lsnr
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
ACTION_SCRIPT=/app/oracle/product/10.2.0/db_1/bin/racgwrap
ACTIVE_PLACEMENT=0
AUTO_START=always
...............
--================================
[root@node2
bin]# crs_register ora.node2.LISTENER_NODE2.lsnr -update -o as=1
[root@node2
bin]# crs_stat -p
ora.node2.LISTENER_NODE2.lsnr
NAME=ora.node2.LISTENER_NODE2.lsnr
TYPE=application
ACTION_SCRIPT=/app/oracle/product/10.2.0/db_1/bin/racgwrap
ACTIVE_PLACEMENT=0
AUTO_START=1
.................
--==========================
AUTO_START=1已經被修改成功。針對rac而言,AUTO_START這個特性
的一些resource我們還可以透過srvctl
enable|disable來修改,具體
可以使用enable|disable的resource有:
objects:
database|instance|service|asm
其中objects:nodeapps和listener不支援enable|disable
下面看一個例子:
[oracle@node2
~]$ crs_stat -p
ora.asmdb.db
NAME=ora.asmdb.db
TYPE=application
ACTION_SCRIPT=/crs/bin/racgwrap
ACTIVE_PLACEMENT=0
AUTO_START=1
...........
--==================
ora.asmdb.db的AUTO_START值是1,disable之後看看結果:
[oracle@node2
~]$ srvctl disable database -d asmdb
[oracle@node2 ~]$ crs_stat -p
ora.asmdb.db
NAME=ora.asmdb.db
TYPE=application
ACTION_SCRIPT=/crs/bin/racgwrap
ACTIVE_PLACEMENT=0
AUTO_START=2
--=====================
修改之後AUTO_START的值是2,我想這裡的2對應的就是doc上提到的never。
--=======================
[oracle@node2
~]$ crs_register ora.node2.gsd -update -o as=2
[oracle@node2 ~]$ crs_register
ora.node2.ons -update -o as=2
[oracle@node2 ~]$ crs_register ora.node2.vip
-update -o as=2
CRS-0200: CRS general failure. No reason is provided.
Usage: crs_register resource_name [-dir directory_path] [...] [-u] [-f]
[-q]
crs_register resource_name -update [option ...] [-o option,...] -q
[root@node2 bin]# crs_register ora.node2.vip -update -o as=2
[root@node2
bin]#
--==============================
這裡注意resource
vip的owner和group分別是root和root,所以
修改vip的auto_start時需要透過root來修改,oracle修改報錯。
[oracle@node2
~]$ crs_register ora.node2.LISTENER_NODE2.lsnr -update -o as=2
[oracle@node2
~]$ crs_register ora.node2.ASM2.asm -update -o as=2
[oracle@node2 ~]$
crs_register ora.asmdb.asmdb2.inst -update -o
as=2
--=================================
重新啟動node2來驗證一下看看crs啟動之後這些resource是否還會自動起來:
重啟node2之後等待crs啟動完畢:
[root@node2
~]# ps -ef|grep crs
root 4714 1 0 02:47 ? 00:00:00 /bin/su -l oracle -c sh -c
'ulimit -c unlimited; cd /crs/log/node2/evmd; exec /crs/bin/evmd '
root 4716
1 1 02:47 ? 00:00:01 /crs/bin/crsd.bin reboot
oracle 5511 4714 2 02:48 ?
00:00:00 /crs/bin/evmd.bin
root 5635 5494 0 02:48 ? 00:00:00 /bin/su -l
oracle -c /bin/sh -c 'ulimit -c unlimited; cd /crs/log/node2/cssd;
/crs/bin/ocssd || exit $?'
oracle 5637 5635 0 02:48 ? 00:00:00 /bin/sh -c
ulimit -c unlimited; cd /crs/log/node2/cssd; /crs/bin/ocssd || exit $?
oracle
5664 5637 2 02:48 ? 00:00:00 /crs/bin/ocssd.bin
oracle 6032 5511 0 02:49 ?
00:00:00 /crs/bin/evmlogger.bin -o /crs/evm/log/evmlogger.info -l
/crs/evm/log/evmlogger.log
root 6335 5429 0 02:49 pts/1 00:00:00 grep
crs
[root@node2 ~]#
檢視狀態發現node2上的resource都沒有起來,說明我們之前修改的
auto_start=2起了作用。
[root@node2 ~]#
crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....b1.inst
application ONLINE ONLINE node1
ora....b2.inst application OFFLINE OFFLINE
ora.asmdb.db application ONLINE ONLINE node1
ora....db1.srv application
OFFLINE OFFLINE
ora....db2.srv application OFFLINE OFFLINE
ora.....taf.cs application OFFLINE OFFLINE
ora....SM1.asm application
ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application
ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application OFFLINE OFFLINE
ora....E2.lsnr application
OFFLINE OFFLINE
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons
application OFFLINE OFFLINE
ora.node2.vip application OFFLINE OFFLINE
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271283/viewspace-1058866/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- crs之上的resource管理總結
- CRS-1205:Auto-start failed for the CRS resourceAI
- CRS: Resource in UNKNOWN state and srvctl Cannot Start/Stop Resource_845709.1
- 解決 CRS-2640: Required resourceUI
- ORACLE-RAC的CRS維護命令總結Oracle
- CRS-2765: Resource 'ora.crsd' has failed on serverAIServer
- 【RAC】使用頻率較高的CRS維護命令總結
- crs常用管理命令
- 總結:ORACLE RAC 常用命令之CRS(1)Oracle
- VMware中安裝ORACLE RAC出現的CRS錯誤總結Oracle
- k8s resource的管理K8S
- RAC管理總結
- Oracle 資源管理(resource manager)Oracle
- oracle的許可權管理的總結Oracle
- Oracle10g RAC管理 - CRSOracle
- Oracle RAC 日常管理之CRS篇Oracle
- Python分享之上下文管理器Python
- IT職場管理經驗總結
- 排程管理大總結
- ASM管理手冊總結ASM
- LVM管理全面總結LVM
- 記憶體_管理總結記憶體
- 【Vue專案總結】後臺管理專案總結Vue
- Oracle的UNDO表空間管理總結Oracle
- Oracle RAC 日常管理之CRS篇-3Oracle
- Oracle RAC 日常管理之CRS篇-2Oracle
- 【kingsql分享】解決RAC大量UNKNOWN和CRS-0216: Could not stop resourceSQL
- Linux 系統管理總結Linux
- Spring事務管理總結Spring
- React 路由狀態管理總結React路由
- RAC GUARD概念和管理總結
- DATA GUARD概念和管理總結
- 流行的後臺管理系統模板總結
- 《卓有成效的管理者》總結
- 我的學生資訊管理系統總結
- 電腦檔案系統的管理總結
- C# Resource Management (資源管理器)C#
- CRS Resource Introduction In Oracle 19c RAC-20220125Oracle