jolly10的个人空间

暂无签名

  • 博客访问: 426453
  • 博文数量: 275
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-20 16:58
个人简介

暂无介绍

ITPUB论坛APP

ITPUB论坛APP



APP发帖 享双倍积分

文章分类

全部博文(275)

文章存档

2013年(1)

2012年(32)

2011年(1)

2010年(5)

2009年(81)

2008年(130)

2007年(25)

我的朋友
微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

分类: Oracle

重点介绍了crs_profile以及srvctl相关命令的用法。

oracle从10g开始把crs打造成了一个独立的集群软件了,
尽管除了在rac里使用较多,但是本身crs具备了集群软件的很多功能了,下面是在crs主目录的bin目录下的一些命令,这些命令主要就是管理crs基础之上的resource(可以理解成os之上的服务)。

[@more@]


[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::rwx
group::r-x
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

阅读(2035) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册