srvctl常用命令

==查看数据库信息

srvctl config database -d orcl -a


==数据库随CRS启动而启动

srvctl enable database -d orcl


==禁止服务在某个实例上运行
srvctl disable service -d orcl -s servicename -i orcl1

srvctl config service -d orcl -s servicename -o orcl2


==删除服务

srvctl remove service -d orcl -i orcl1


==推荐适用srvctl来启动/关闭数据,这样可以保证及时更新crs中的信息
srvctl start database -d orc
srvctl start database -d orcl -i orcl2 -o nomount/mount

srvctl stop instance -d orcl -i orcl2 -o immediate

[root@juliaz3 ~]# srvctl status scan -i 1
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node juliaz3
[root@juliaz3 ~]#

[root@juliaz3 ~]# srvctl status diskgroup -g sysdb
Disk Group sysdb is running on juliaz2,juliaz3
[root@juliaz3 ~]#

[root@juliaz3 ~]# srvctl stop database -d orcl
[root@juliaz3 ~]# srvctl status database -d orcl
Instance orcl1 is not running on node juliaz2

Instance orcl2 is not running on node juliaz3


[root@juliaz3 ~]# srvctl start database -d orcl

[root@juliaz3 ~]# srvctl stop database -d orcl -o immediate


[root@juliaz3 ~]# srvctl start database -d orcl -o mount
[root@juliaz3 ~]# srvctl status database -d orcl
Instance orcl1 is running on node juliaz2

Instance orcl2 is running on node juliaz3


[root@juliaz3 ~]# srvctl start database -d orcl -o open   /*在已经mount的时候不能进一步open了,功能不够强大啊
PRCR-1004 : Resource ora.orcl.db is already running


管理RAC中的网络

当rac集群投入使用以后,如果发现节点的IP地址设置不合理,需要对其进行修改。因为节点的IP地址配置信息都记录在OCR中,所以为了更新IP地址需要更新两个地方:

1.DNS 或/etc/hosts

2.OCR中的信息

以上可以通过srvctl 和oicfg完成

rac中客户端通过VIP 11.2后可以vip或scan访问数据库。在不停止数据库的情况下对vip进行修改。

vip信息

[root@juliaz3 ~]# srvctl config vip -n juliaz2
VIP exists.:juliaz2
VIP exists.: /juliaz2-vip/9.115.17.94/255.255.255.0/eth0
[root@juliaz3 ~]# srvctl config vip -n juliaz3
VIP exists.:juliaz3
VIP exists.: /juliaz3-vip/9.115.17.95/255.255.255.0/eth0
[root@juliaz3 ~]# 
修改vip,需要停止数据库service的运行,service也是ocr中的一种资源,它的功能是提高数据库高可能性,在默认情况下,它的名称和数据库名称相同。

停止节点juliaz2上的service 

参考书上的命令行不通,可以用srvctl stop service -d orcl -n juliaz2

[root@juliaz3 ~]# srvctl stop service -d orcl -s orcl -n juliaz2
PRCR-1001 : Resource ora.orcl.orcl.svc does not exist

然后需要关闭这个节点上的vip资源。

[root@juliaz3 ~]# srvctl stop vip -n juliaz2
PRCR-1014 : Failed to stop resource ora.juliaz2.vip
PRCR-1065 : Failed to stop resource ora.juliaz2.vip
CRS-2529: Unable to act on 'ora.juliaz2.vip' because that would require stopping or relocating 'ora.LISTENER.lsnr', but the force option was not specified

[root@juliaz3 ~]# srvctl stop vip -n juliaz2 -f
[root@juliaz3 ~]# srvctl status  vip -n juliaz2
VIP juliaz2-vip is enabled
VIP juliaz2-vip is not running

确保你要更新的ip已经,添加到DNS或者/etc/hosts文件中。

[root@juliaz3 ~]# srvctl modify nodeapps -n juliaz2 -A 9.115.17.98/255.255.255.0/eth0

[root@juliaz3 ~]# srvctl start vip -n juliaz2
IP修改成功以后,就可以启动这个资源,在启动VIP时,数据库的service资源将一起启动。
[root@juliaz3 ~]# srvctl status vip -n juliaz2
VIP juliaz2-vip is enabled
VIP juliaz2-vip is running on node: juliaz2

网上找来的可以了通过stop nodesapps 来停服务,记得修改/etc/hosts。

[root@juliaz3 ~]# srvctl stop nodeapps -n juliaz2
PRCR-1065 : Failed to stop resource ora.juliaz2.vip
CRS-2529: Unable to act on 'ora.juliaz2.vip' because that would require stopping or relocating 'ora.LISTENER.lsnr', but the force option was not specified
PRCR-1014 : Failed to stop resource ora.net1.network
PRCR-1065 : Failed to stop resource ora.net1.network
CRS-2529: Unable to act on 'ora.net1.network' because that would require stopping or relocating 'ora.juliaz2.vip', but the force option was not specified


[root@juliaz3 ~]# srvctl stop nodeapps -n juliaz2 -f
PRKO-2426 : ONS is already stopped on node(s): juliaz2
PRKO-2427 : eONS is already stopped on node(s): juliaz2

[root@juliaz3 ~]# srvctl status nodeapps 
VIP juliaz2-vip is enabled
VIP juliaz2-vip is not running
VIP juliaz3-vip is enabled
VIP juliaz3-vip is running on node: juliaz3
Network is enabled
Network is not running on node: juliaz2
Network is running on node: juliaz3
GSD is disabled
GSD is not running on node: juliaz2
GSD is not running on node: juliaz3
ONS is enabled
ONS daemon is not running on node: juliaz2
ONS daemon is running on node: juliaz3
eONS is enabled
eONS daemon is not running on node: juliaz2
eONS daemon is running on node: juliaz3
[root@juliaz3 ~]# srvctl modify nodeapps -n juliaz2 -A 9.115.17.94/255.255.255.0/eth0
[root@juliaz3 ~]# srvctl start  nodeapps  -n juliaz2
[root@juliaz3 ~]# 


11.2中,scan是oracle推荐使用的ip地址,客户端应用程序通过scan,可以把请求轮流发送到各个节点上。scan代表的是一个整个集群,这个scan可以被映射成一个或者多个ip地址,通过scan可以实现客户端访问负载均衡。 首先要保证scan所对应的名称和ip地址记录在dns中,能够通过nslookup解析。

[root@juliaz3 ~]# srvctl config scan
SCAN name: juliaz-cluster, Network: 1/9.115.17.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /9.115.17.96/9.115.17.96

[root@juliaz3 ~]# srvctl status scan -i 1
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node juliaz3
[root@juliaz3 ~]#  
[root@juliaz3 ~]# srvctl stop scan -i 1
PRCR-1065 : Failed to stop resource ora.scan1.vip
CRS-2529: Unable to act on 'ora.scan1.vip' because that would require stopping or relocating 'ora.LISTENER_SCAN1.lsnr', but the force option was not specified

[root@juliaz3 ~]# srvctl stop scan -i 1 -f
[root@juliaz3 ~]# srvctl modify scan -n rac-clusster
PRCS-1016 : Failed to resolve Single Client Access Name rac-clusster
[root@juliaz3 ~]# 

/*因为我没有配置dbs,所以命令失败。

修改私有和公共ip地址

[root@juliaz3 ~]# oifcfg getif
eth0  9.115.17.0  global  public
eth1  192.168.1.0  global  cluster_interconnect
[root@juliaz3 ~]# 
暂时到这,。。后续

参考 大话 oracle RAC

oracle RAC实战指南刘宪军--不错的一本书
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值