Oracle RAC --- 集群常用的命令

本文详细介绍了Oracle RAC集群在节点层、网络层、集群层和应用层的常用管理命令,包括crsctl、srvctl等工具的使用,如资源启停、OCR检查与维护、监听状态查询等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#RAC集群常用命令

# 节点层(-h  获取help)

[grid@rac1 ~]$ olsnodes -h

# 网络层

*查询,定义,修改Oracle集群需要的网卡属性,包括网卡的网段地址,子网掩码,接口类型等。

[grid@rac1 ~]$ oifcfg

# 集群层

crsctl ocrcheck ocrdump ocrconfig

crsctl命令 用法介绍

[root@rac1 ~]# crsctl -h
Usage: crsctl add       - add a resource, type or other entity
       crsctl check     - check a service, resource or other entity
       crsctl config    - output autostart configuration
       crsctl debug     - obtain or modify debug state
       crsctl delete    - delete a resource, type or other entity
       crsctl disable   - disable autostart
       crsctl enable    - enable autostart
       crsctl get       - get an entity value
       crsctl getperm   - get entity permissions
       crsctl lsmodules - list debug modules
       crsctl modify    - modify a resource, type or other entity
       crsctl query     - query service state
       crsctl pin       - Pin the nodes in the nodelist
       crsctl relocate  - relocate a resource, server or other entity
       crsctl replace   - replaces the location of voting files
       crsctl setperm   - set entity permissions
       crsctl set       - set an entity value
       crsctl start     - start a resource, server or other entity
       crsctl status    - get status of a resource or other entity
       crsctl stop      - stop a resource, server or other entity
       crsctl unpin     - unpin the nodes in the nodelist
       crsctl unset     - unset a entity value, restoring its default

环境中用的:

检查crs服务:

[root@rac1 ~]# crsctl check crs

启停集群:

[root@rac1 ~]# crsctl stop cluster -all  //不影响ohas服务

[root@rac1 ~]# crsctl start cluster -all

启停所有节点的资源

[oracle@rac1 ~]$ crsctl start resource -all

[oracle@rac1 ~]$ crsctl stop resource -all

启停单个资源

[oracle@rac1 ~]$ crsctl start resource resname

[oracle@rac1 ~]$ crsctl stop resource resname

查看监听状态

[oracle@rac1 ~]$ crsctl status res ora.LISTENER.lsnr -t

os命令也可以:lsnrctl status

查看CRS版本信息

[oracle@rac1 ~]$ crsctl query crs softwareversion

查看表决磁盘

[root@rac1 ~]# crsctl query css votedisk

添加和删除表决磁盘

[root@rac1 ~]# crsctl add css votedisk ORCL:CRS2 -force

[root@rac1 ~]# crsctl delete css votedisk ORCL:CRS2 -force

ocrcheck

用于检查OCR内容的一致性,不需要参数

[root@rac1 ~]# ocrcheck

ocrdump

该命令能以ASCII的方式打印出OCR的内容,但是这个命令不能用作OCR的备份恢复,产生的文件只能用作阅读,而不能恢复。

[grid@rac1 ~]$ cd /oracle/app/11.2.0/grid/log/rac1/client

[grid@rac1 client]$ ocrdump  

PROT-304: Failed to create dump file [OCRDUMPFILE]

//打印生成了一个.log文件

[grid@rac1 client]$ ocrdump -stdout|less //显示打印内容

ocrconfig

该命令用来维护OCR磁盘

当集群中的节点信息发生变化,或数据库发生改变时,OCR内容将会更新

*备份OCR信息

[root@rac1 ~]# ocrconfig -export /tmp/ocr_exp.dmp

[root@rac1 ~]#

[root@rac1 ~]# ll /tmp/ocr_exp.dmp

-rw-r--r-- 1 root root 87310 3月   7 10:59 /tmp/ocr_exp.dmp

*恢复OCR信息

[root@rac1 ~]# ocrconfig -import /tmp/ocr_exp.dmp

*创建新的OCR磁盘镜像

[root@rac1 ~]# ocrconfig -replace ocrmirror /dev/raw/raw6

# 应用层

srvctl 命令用法介绍

srvctl命令工具可以管理操作:database instance ASM  service listener node APP(GSD,ONS,VIP)等集群内部资源。

[oracle@rac1 ~]$ srvctl -h  // 可获取命令的用法帮助

add:ONS可以用onsctl命令管理,监听可以用lsnrctl命令管理

常用的有:

启停数据库:

srvctl start/stop database -d racdb

启停实例:

srvctl start/stop instance -d racdb -i [指定节点]

查看状态:

srvctl status asm

srvctl status diskgroup -g [磁盘组名]

srvctl status listener

srvctl status scan

srvctl status database -d racdb

srvctl status instance -d racdb -i [指定节点]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值