RAC 日常管理命令

*****************************************************************

*

* RAC 日常管理命令

*

*****************************************************************

说明:大部分的RAC日常管理命令都是在:$CRS_HOME/bin $ORACLE_HOME/bin 目录下

olsnodes

//显示所有节点的私有、VIP名及节点名

[root@yxdb2 oracle]# olsnodes -n -p -i

yxdb1 1 yxdb1-priv yxdb1-vip

yxdb2 2 yxdb2-priv yxdb2-vip

===============================================================================

oifcfg

//显示所有网卡信息

[oracle@yxdb1 bin]$ oifcfg getif

eth1 10.10.17.0 global cluster_interconnect

eth0 120.6.0.0 global public

//添加新的网卡信息

[oracle@yxdb1 bin]$ oifcfg setif -global tunnel_1@NONE/10.0.0.0:public

[oracle@yxdb1 bin]$ oifcfg getif

eth1 10.10.17.0 global cluster_interconnect

eth0 120.6.0.0 global public

tunnel_1@NONE 10.0.0.0 global public

#说明:setif这个命令并不会检查网卡是否真的存在,比如上面的tunnel_1@NONE这个网卡实际根本不存在,因此在使用此命令添加新网卡时一定要仔细!

//删除网卡信息

[oracle@yxdb1 bin]$ oifcfg delif -global tunnel_1@NONE

[oracle@yxdb1 bin]$ oifcfg getif

eth1 10.10.17.0 global cluster_interconnect

eth0 120.6.0.0 global public

#说明:当更改现有RAC环境中的IP地址时,需要利用delif命令先将旧的网卡信息删掉,然后再利用setif命令将新的的网卡信息添加进去。

===============================================================================

crsctl

//检查CRS栈状态

[oracle@yxdb1 bin]$ crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

//配置CRS栈是否随着操作系统的启动而自动启动

[oracle@yxdb1 bin]$ crsctl disable crs

[oracle@yxdb1 bin]$ crsctl enable crs

#说明:这两个命令的应用通常是针对维护需要

//启动、停止CRS

[root@yxdb1 ~]# crsctl stop crs

Stopping resources. This could take several minutes.

Successfully stopped CRS resources.

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

[root@yxdb1 ~]# crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

//查看Votedisk磁盘

[root@yxdb1 ~]# crsctl query css votedisk

0. 0 /dev/raw/raw3

1. 0 /dev/raw/raw4

2. 0 /dev/raw/raw5

located 3 votedisk(s).

//添加、删除Votedisk

[root@yxdb1 ~]# crsctl query css votedisk

[root@yxdb1 ~]# crsctl stop crs

[root@yxdb1 ~]# crsctl delete css votedisk /dev/raw/raw5 -force

[root@yxdb1 ~]# crsctl add css votedisk /dev/raw/raw6 -force

[root@yxdb1 ~]# crsctl start crs

#说明:首先添加和删除Votedisk操作必须是在停止所有节点CRS后进行,其次因为Votedisk采用的是“多数可用算法”,即必须一半以上的

Votedisk同时可用,Clusterware才能正常工作,因此在添加Votedisk时因注意此因素。

===============================================================================

OCR命令系列

#说明:Oracle Clusterware把整个集群的配置信息放在共享存储上,这个存储就是OCR Disk。在整个集群中,只能有一个节点对OCR Disk进行

读写操作,这个节点叫作Master Node,所有节点都会在内存中保留一份OCR的拷贝,同时有一个OCR Process从这个内存中读取内容。OCR内容

发生改变时,由Master NodeOCR Process负责同步到其他节点的OCR Process。因为OCR的重要性,因此Oracle会每4个小时对其备份一次,并

且保留最后的3个备份

ocrdump

//显示OCR所有内容信息

[oracle@yxdb1 ~]$ ocrdump -stdout -xml | more

//显示OCRSYSTEM.css键的内容

[oracle@yxdb1 ~]$ ocrdump -stdout -keyname SYSTEM.OCR.BACKUP -xml | more

ocrcheck

//OCR的状态验证

[root@yxdb2 oracle]# ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 2

Total space (kbytes) : 511264

Used space (kbytes) : 3856

Available space (kbytes) : 507408

ID : 613311862

Device/File Name : /dev/raw/raw1

Device/File integrity check succeeded

Device/File Name : /dev/raw/raw2

Device/File integrity check succeeded

Cluster registry integrity check succeeded

#说明:以上显示的结果为OCR内容一致的情况,如果OCR内容不一致,则在某一个Device信息中会显示Device/File needs to be synchronized with the other device

ocrconfig

//查看自动备份结果

[root@yxdb2 oracle]# ocrconfig -showbackup

yxdb1 2011/06/03 13:41:59 /oracle/app/oracle/product/10.2.0/crs/cdata/crs

yxdb1 2011/06/03 13:41:59 /oracle/app/oracle/product/10.2.0/crs/cdata/crs

yxdb1 2011/06/03 13:41:59 /oracle/app/oracle/product/10.2.0/crs/cdata/crs

//导出OCR内容

[root@yxdb1 tmp]# ocrconfig -export ocrexp.exp -s online

//导入OCR内容

[root@yxdb1 tmp]# ocrconfig -import ocrexp.exp

//添加一个Mirror OCR

[root@yxdb1 tmp]# ocrconfig -replace ocrmirror /dev/raw/raw21

//更改Primary OCR

[root@yxdb1 tmp]# ocrconfig -replace ocr /dev/raw/raw31

//删除Primary OCR/Mirror OCR

[root@yxdb1 tmp]# ocrconfig -replace ocr

[root@yxdb1 tmp]# ocrconfig -replace ocrmirror

#说明:以上命令的应用场景

导入和导出命令的目的就是为了进行对OCR的备份和恢复;

OCR的磁盘最多只能有两个Primary OCRMirror OCR,所以当只有CRS现在只有Primary OCR时可以添加一个Mirror OCR,而更改OCR的前提条

件就是当前CRS中已经有PrimaryMirror两个OCR;

删除Primary OCRMirror OCR自动成为Primary

执行以上操作后,CRS会将OCR信息自动同步到/etc/oracle/ocr.loc

===============================================================================

crs_stat

//CRS_STAT的几种常见用法

[root@yxdb1 ~]# crs_stat –t

[root@yxdb1 ~]# crs_stat -p ora.yxdb.db

===============================================================================

srvctl

//查看数据库配置

[root@yxdb1 cluvfy]# srvctl config database

yxdb

[root@yxdb1 cluvfy]# srvctl config database -d yxdb -a

yxdb1 yxdb1 /oracle/app/oracle/product/10.2.0/db_1

yxdb2 yxdb2 /oracle/app/oracle/product/10.2.0/db_1

DB_NAME: yxdb

ORACLE_HOME: /oracle/app/oracle/product/10.2.0/db_1

SPFILE: +ORADISK/yxdb/spfileyxdb.ora

DOMAIN: null

DB_ROLE: null

START_OPTIONS: null

POLICY: AUTOMATIC

ENABLE FLAG: DB ENABLED

[root@yxdb1 cluvfy]# srvctl config nodeapps -n yxdb1 -a

VIP exists.: /yxdb1-vip/120.6.10.146/255.255.255.0/eth0

//通过SRVCTL命令来start/stop/check所有的实例
[root@yxdb1 cluvfy]# srvctl start|stop|status database -d

//start/stop指定的实例:
[root@yxdb1 cluvfy]# srvctl start|stop|status instance -d -i

//列出当前RAC下所有的
[root@yxdb1 cluvfy]# srvctl config database -d

//start/stop/check所有的nodeapps,比如:VIP, GSD, listener, ONS
[root@yxdb1 cluvfy]# srvctl start|stop|status nodeapps -n

//如果你使用ASMsrvctl也可以start/stop ASM实例:
[root@yxdb1 cluvfy]# srvctl start|stop asm -n [-i ] [-o]

//可以获取所有的环境信息:
[root@yxdb1 cluvfy]# srvctl getenv database -d [-i ]

//设置全局环境和变量:
[root@yxdb1 cluvfy]# srvctl setenv database -d -t LANG=en

//OCR中删除已有的数据库:
[root@yxdb1 cluvfy]# srvctl remove database -d

//OCR中添加一个数据库:
[root@yxdb1 cluvfy]# srvctl add database -d -o

[-m ] [-p] [-A /netmask] [-r {PRIMARY | PHYSICAL_STANDBY |LOGICAL_STANDBY}] [-s ]

//OCR中添加一个数据库的实例:
[root@yxdb1 cluvfy]# srvctl add instance -d -i -n
[root@yxdb1 cluvfy]# srvctl add instance -d -i -n

//OCR中添加一个ASM实例:
[root@yxdb1 cluvfy]# srvctl add asm -n -i -o

//添加一个service
[root@yxdb1 cluvfy]# srvctl add service -d -s -r [-a ] [-P ] [-u]

//修改在其他节点上的service
[root@yxdb1 cluvfy]# srvctl modify service -d -s -I -t

===============================================================================

init.crs

//停止CRS

[root@yxdb1 cluvfy]# /etc/init.d/init.crs stop

//启动CRS
[root@yxdb1 cluvfy]# /etc/init.d/init.crs start

//禁止Clusterware在系统重启后自动启动的方法:
[root@yxdb1 cluvfy]# /etc/init.d/init.crs disable

//启动Clusterware在系统重启后自动启动的方法:
[root@yxdb1 cluvfy]# /etc/init.d/init.crs enable

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14338195/viewspace-1052008/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/14338195/viewspace-1052008/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值