oracle维护工具,Oracle RAC 常用维护工具和命令大全(3)

-backuploc - Configure periodic backup location

-showbackup - Show backup information

-restore - Restore from physical backup

-replace ocr|ocrmirror [] - Add/replace/remove a OCR device/file

-overwrite - Overwrite OCR configuration on disk

-repair ocr|ocrmirror - Repair local OCR configuration

-help - Print out this help information

Note:

A log file will be created in

$ORACLE_HOME/log//client/ocrconfig_.log. Please ensure

you have file creation privileges in the above directory before

running this tool.

-- 查看自助备份

[root@raw1 bin]# ./ocrconfig -showbackup

在缺省情况下,OCR自动备份在$CRS_HOME\CRS\CDATA\cluster_name 目录下,可以通过ocrconfig -backuploc 命令修改到新的目录

3.2.4 使用导出,导入进行备份和恢复

Oracle 推荐在对集群做调整时,比如增加,删除节点之前,应该对OCR做一个备份,可以使用export 备份到指定文件,如果做了replace或者restore 等操作,Oracle 建议使用 cluvfy comp ocr -n all 命令来做一次全面的检查。该命令在clusterware 的安装软件里。

1) 首先关闭所有节点的CRS

[root@raw1 bin]# ./crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

2) 用root 用户导出OCR内容

[root@raw1 bin]# ./ocrconfig -export /u01/ocr.exp

3) 重启CRS

[root@raw1 bin]# ./crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

4) 检查CRS 状态

[root@raw1 bin]# ./crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

5)破坏OCR内容

[root@raw1 bin]# dd if=/dev/zero of=/dev/raw/raw1 bs=1024 count=102400

102400+0 records in

102400+0 records out

6) 检查OCR一致性

[root@raw1 bin]# ./ocrcheck

PROT-601: Failed to initialize ocrcheck

7)使用cluvfy 工具检查一致性

[root@raw1 cluvfy]# ./runcluvfy.sh comp ocr -n all

Verifying OCR integrity

Unable to retrieve nodelist from Oracle clusterware.

Verification cannot proceed.

8) 使用Import 恢复OCR 内容

[root@raw1 bin]# ./ocrconfig -import /u01/ocr.exp

9)再次检查OCR

[root@raw1 bin]# ./ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 2

Total space (kbytes) : 147352

Used space (kbytes) : 4364

Available space (kbytes) : 142988

ID : 610419116

Device/File Name : /dev/raw/raw1

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

10) 使用cluvfy工具检查

[root@raw1 cluvfy]# ./runcluvfy.sh comp ocr -n all

Verifying OCR integrity

WARNING:

These nodes cannot be reached:

raw2

Verification will proceed with nodes:

raw1

ERROR:

User equivalence unavailable on all the nodes.

Verification cannot proceed.

Verification of OCR integrity was unsuccessful on all the nodes.

注:此处不成功是因为我的机器卡,故raw2节点没有启动

3.2.5 移动OCR 文件位置

实例演示将OCR从/dev/raw/raw1 移动到/dev/raw/raw3上。

1) 查看是否有OCR备份

[root@raw1 bin]# ./ocrconfig -showbackup

如果没有备份,可以立即执行一次导出作为备份:

[root@raw1 bin]# ./ocrconfig -export /u01/ocrbackup -s online

2) 查看当前OCR配置

[root@raw1 bin]# ./ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 2

Total space (kbytes) : 147352

Used space (kbytes) : 4364

Available space (kbytes) : 142988

ID : 610419116

Device/File Name : /dev/raw/raw1

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

输出显示当前只有一个Primary OCR,在/dev/raw/raw1。 没有Mirror OCR。 因为现在只有一个OCR文件,所以不能直接改变这个OCR的位置,必须先添加镜像后在修改,否则会报:Failed to initialize ocrconfig.

3) 添加一个Mirror OCR

[root@raw1 bin]# ./ocrconfig -replace ocrmirror /dev/raw/raw4

4) 确认添加成功

[root@raw1 bin]# ./ocrcheck

5)改变primary OCR 位置

[root@raw1 bin]# ./ocrconfig -replace ocr /dev/raw/raw3

确认修改成功:

[root@raw1 bin]# ./ocrcheck

6)使用ocrconfig命令修改后,所有RAC节点上的/etc/oracle/ocr.loc 文件内容也会自动同步了,如果没有自动同步,可以手工的改成以下内容。

[root@raw1 bin]# more /etc/oracle/ocr.loc

ocrconfig_loc=/dev/raw/raw1

Ocrmirrorconfig_loc=/dev/raw/raw3

local_only=FALSE

四. 应用层

应用层就是指RAC数据库了,这一层有若干资源组成,每个资源都是一个进程或者一组进程组成的完整服务,这一层的管理和维护都是围绕这些资源进行的。 有如下命令: srvctl, onsctl, crs_stat 三个命令。

4.1 crs_stat

Crs_stat 这个命令用于查看CRS维护的所有资源的运行状态,如果不带任何参数时,显示所有资源的概要信息。每个资源显示是各个属性:资源名称,类型,目录,资源运行状态等。

[root@raw1 bin]# ./crs_stat

NAME=ora.raw.db

TYPE=application

TARGET=ONLINE

STATE=OFFLINE

......

也可以指定资源名,查看指定资源的状态,并可以使用-V 和-P 选项,以查看详细信息,其中-p 参数显示的内容比-V 更详细。

1) 查看制定资源状态

[root@raw1 bin]# ./crs_stat ora.raw2.vip

NAME=ora.raw2.vip

TYPE=application

TARGET=ONLINE

STATE=OFFLINE

2) 使用-v 选项,查看详细内容,这时输出多出4项内容,分别是允许重启次数,已执行重启次数,失败阀值,失败次数。

[root@raw1 bin]# ./crs_stat -v ora.raw2.vip

NAME=ora.raw2.vip

TYPE=application

RESTART_ATTEMPTS=0

RESTART_COUNT=0

FAILURE_THRESHOLD=0

FAILURE_COUNT=0

TARGET=ONLINE

STATE=OFFLINE

3) 使用-p 选项查看更详细内容

[root@raw1 bin]# ./crs_stat -p ora.raw2.vip

NAME=ora.raw2.vip

TYPE=application

ACTION_SCRIPT=/u01/app/oracle/product/crs/bin/racgwrap

ACTIVE_PLACEMENT=1

AUTO_START=1

CHECK_INTERVAL=60

DESCRIPTION=CRS application for VIP on a node

FAILOVER_DELAY=0

FAILURE_INTERVAL=0

FAILURE_THRESHOLD=0

HOSTING_MEMBERS=raw2

OPTIONAL_RESOURCES=

PLACEMENT=favored

REQUIRED_RESOURCES=

RESTART_ATTEMPTS=0

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值