OCR磁盘的导出和导入、备份和恢复以及移动(ocrconfig命令的应用)
数据库版本:10.2.0.1
一,使用导出、导入进行备份和恢复
Oracle推荐在对集群做调整时,比如增加、删除节点之前,应该对OCR做一个备份,可以使用export 备份到指定文件。如果做了replace或restore等操作,Oracle建议使用"cluvfy comp ocr -n all" 命令做一次全面检查。
1.首先关闭所有节点的CRS
[oracle@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4
ora.racdb.db application ONLINE ONLINE rac3
ora....b1.inst application ONLINE ONLINE rac3
ora....b2.inst application ONLINE ONLINE rac4
ora....rver.cs application ONLINE ONLINE rac3
ora....db2.srv application ONLINE ONLINE rac3 [root@rac3 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[oracle@rac4 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4
ora.racdb.db application ONLINE ONLINE rac3
ora....b1.inst application ONLINE ONLINE rac3
ora....b2.inst application ONLINE ONLINE rac4
ora....rver.cs application ONLINE ONLINE rac3
ora....db2.srv application ONLINE ONLINE rac3 [root@rac4 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
2.导出OCR内容(需要root用户导出)
[root@rac4 bin]# ./ocrconfig -export /home/oracle/ocr.exp
[root@rac4 bin]# ll /home/oracle/ocr.exp
-rw-r--r-- root root Jan : /home/oracle/ocr.exp
3.重新启动CRS
[root@rac3 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly [root@rac4 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
4.检查CRS状态
[root@rac3 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy [root@rac4 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
5.破坏ocr内容
[root@rac4 bin]# dd if=/dev/zero of=/dev/raw/raw1 bs=1M count=
dd: writing `/dev/raw/raw1': No space left on device
+ records in
+ records out
6.现在检查ocr一致性
[root@rac4 bin]# ./ocrcheck
PROT-: Failed to initialize ocrcheck [root@rac3 bin]# ./ocrcheck
PROT-: Failed to initialize ocrcheck
7.使用cluvfy工具检查一致性
[root@rac3 cluvfy]# pwd
/opt/clusterware/cluvfy
[root@rac3 cluvfy]# ./runcluvfy.sh comp ocr -n all Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware. Verification cannot proceed.
同样是检查失败
8.现在查看集群状态
[oracle@rac3 ~]$ crs_stat -t --ocr被破坏,集群已经宕掉
CRS-: Cannot communicate with the CRS daemon. [oracle@rac4 ~]$ crs_stat -t
CRS-: Cannot communicate with the CRS daemon.
9.使用import恢复OCR内容
[root@rac4 bin]# ./ocrconfig -import /home/oracle/ocr.exp
[root@rac4 bin]#
10.再次检查OCR
[root@rac4 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded
[root@rac3 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded
11.检查通过,用cluvfy工具检查
[oracle@rac3 cluvfy]$ ./runcluvfy.sh comp ocr -n all Verifying OCR integrity Checking OCR integrity... Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations. Uniqueness check for OCR device passed. Checking the version of OCR...
OCR of correct Version "" exists. Checking data integrity of OCR...
Data integrity check for OCR passed. OCR integrity check passed. Verification of OCR integrity was successful.
12.启动CRS
[root@rac3 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly [root@rac4 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[oracle@rac4 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE OFFLINE
ora....C3.lsnr application ONLINE OFFLINE
ora.rac3.gsd application ONLINE OFFLINE
ora.rac3.ons application ONLINE OFFLINE
ora.rac3.vip application ONLINE OFFLINE
ora....SM2.asm application ONLINE OFFLINE
ora....C4.lsnr application ONLINE OFFLINE
ora.rac4.gsd application ONLINE OFFLINE
ora.rac4.ons application ONLINE OFFLINE
ora.rac4.vip application ONLINE OFFLINE
ora.racdb.db application ONLINE OFFLINE
ora....b1.inst application ONLINE OFFLINE
ora....b2.inst application ONLINE OFFLINE
ora....rver.cs application ONLINE OFFLINE
ora....db2.srv application ONLINE OFFLINE
13.最后检查CRS的状态
[root@rac3 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy [root@rac4 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
二,移动OCR文件的位置
以下示例将演示如何把OCR从/dev/raw/raw1移动到/dev/raw/raw8上
1.首先查看是否有最近的OCR备份
[root@rac3 bin]# ./ocrconfig -showbackup rac4 // :: /opt/ora10g/product/10.2./crs_1/cdata/crs rac3 // :: /opt/ora10g/product/10.2./crs_1/cdata/crs rac3 // :: /opt/ora10g/product/10.2./crs_1/cdata/crs rac4 // :: /opt/ora10g/product/10.2./crs_1/cdata/crs rac4 // :: /opt/ora10g/product/10.2./crs_1/cdata/crs
更改备份位置 ocrconfig -backuploc /oracle/backup/ocr
如果没有备份,可以立即执行一次导出作为备份
[root@rac3 bin]# ./ocrconfig -export /home/oracle/ocr.bak2 -s online
[root@rac3 bin]#
2.查看当前ocr配置
[root@rac3 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
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
3.因为现在只有一个OCR文件,位于/dev/raw/raw1,所以不能直接改变这个OCR的位置,
必须先添加镜像后再修改,否则会出现错误:
[root@rac3 bin]# ./ocrconfig -replace ocr /dev/raw/raw8
PROT-: Internal Error
4.添加一个Mirror OCR
[root@rac3 bin]# ./ocrconfig -replace ocrmirror /dev/raw/raw7
[root@rac3 bin]#
5.确认添加成功
[root@rac3 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw7 --新添加的Mirror OCR
Device/File integrity check succeeded Cluster registry integrity check succeeded
现在有两个OCR了,可以修改原来的Primary OCR了
6.修改Primary OCR为/dev/raw/raw8
[root@rac3 bin]# ./ocrconfig -replace ocr /dev/raw/raw8
[root@rac3 bin]#
7.确认修改成功
[root@rac3 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw8 --Primary OCR改变了
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw7
Device/File integrity check succeeded Cluster registry integrity check succeeded
8.确认修改被同步到了其他节点
--在另一节点也能看到更新的信息
[root@rac4 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw8
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw7
Device/File integrity check succeeded Cluster registry integrity check succeeded
9.使用ocrconfig -replace命令后,所有节点上的/etc/oracle/ocr.loc文件内容也都自动同步了,
如果有点节点没有同步,也可以手工修改使其同步:
[root@rac4 bin]# more /etc/oracle/ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw8
ocrconfig_loc=/dev/raw/raw8
ocrmirrorconfig_loc=/dev/raw/raw7
local_only=false
三,解决PROT-22: Storage too small错误
现在我想改回原来的Primary OCR
[root@rac3 bin]# ./ocrconfig -replace ocr /dev/raw/raw1
PROT-: Storage too small
查询metalink发现,这是一个10.2.0.1上的bug,要求ocrmirror设备的大小要比原始ocr设备大128M,详细描述可以参考:ID 317628.1。
那如何更改过来???? 可参考 http://blog.itpub.net/14284241/viewspace-442842/
尝试直接修改/etc/oracle/orc.loc文件
1.查看目前的OCR配置
[root@rac3 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw8
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw7
Device/File integrity check succeeded Cluster registry integrity check succeeded
2.对目前的OCR备份
[root@rac3 bin]# ./ocrconfig -export /home/oracle/ocr.bak3 -s online
[root@rac3 bin]#
3.停掉所有节点的CRS
[root@rac3 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued. [root@rac4 bin]# ./crsctl stop crs
Stopping resources.
Error while stopping resources. Possible cause: CRSD is down.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
4.手动修改所有节点的/etc/oracle/ocr.loc文件
[root@rac3 bin]# more /etc/oracle/ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw8
ocrconfig_loc=/dev/raw/raw8
ocrmirrorconfig_loc=/dev/raw/raw7
local_only=false
[root@rac3 bin]# vi /etc/oracle/ocr.loc
[root@rac3 bin]# more /etc/oracle/ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw8
ocrconfig_loc=/dev/raw/raw1
#ocrmirrorconfig_loc=/dev/raw/raw7
local_only=false [root@rac4 bin]# more /etc/oracle/ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw8
ocrconfig_loc=/dev/raw/raw8
ocrmirrorconfig_loc=/dev/raw/raw7
local_only=false
[root@rac4 bin]# vi /etc/oracle/ocr.loc
[root@rac4 bin]# more /etc/oracle/ocr.loc
#Device/file /dev/raw/raw1 getting replaced by device /dev/raw/raw8
ocrconfig_loc=/dev/raw/raw1
#ocrmirrorconfig_loc=/dev/raw/raw7
local_only=false
5.检查一下ocr
--可以看到ocr现在检查报错
[root@rac3 bin]# ./ocrcheck
PROT-: Failed to initialize ocrcheck
6.导入之前备份的OCR数据
[root@rac3 bin]# ./ocrconfig -import /home/oracle/ocr.bak3
7.现在检查ocr
--两个节点检查正常,且ocr盘实现已经改过来了
[root@rac3 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded [root@rac4 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version :
Total space (kbytes) :
Used space (kbytes) :
Available space (kbytes) :
ID :
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded
8.启动crs
[root@rac3 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly [root@rac4 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[oracle@rac3 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
ora....SM2.asm application ONLINE ONLINE rac4
ora....C4.lsnr application ONLINE ONLINE rac4
ora.rac4.gsd application ONLINE ONLINE rac4
ora.rac4.ons application ONLINE ONLINE rac4
ora.rac4.vip application ONLINE ONLINE rac4
ora.racdb.db application ONLINE ONLINE rac4
ora....b1.inst application ONLINE ONLINE rac3
ora....b2.inst application ONLINE ONLINE rac4
ora....rver.cs application ONLINE ONLINE rac3
ora....db2.srv application ONLINE ONLINE rac4
9.检查crs状态
[root@rac3 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy [root@rac4 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
至此我么把ocr盘通过手动的方式更改过来了,RAC正常。
--本文章 部分参考张晓明<<大话Oracle RAC>>及其他
OCR磁盘的导出和导入、备份和恢复以及移动(ocrconfig命令的应用)的更多相关文章
- mysql导入导出数据,备份,恢复数据
MYSQL 实现导入数据 .备份和恢复数据库 1.使用msql命令导入数据 # mysql -uroot -p 需要选择一个数据库 < runoob.sql #mysql -u username ...
- 5.非关系数据库(Nosql)它mongodb:创建一个集合,导出和导入备份, 数据恢复,进出口
1 固定集合 固定集合值得是事先创建并且大小固定的集合 2 固定集合的特征:固定集合非常像环形队列.假设空间不足,最早文档就会被删除,为新的文档腾出空间.一般来说.固定集合适用于不论什么想要自己 ...
- mysql 备份和恢复的两条命令
压缩备份: 1.mysqldump -h localhost -u root -p dbname | gzip > dbname.sql.gz 压缩恢复: 1.gunzip < dbnam ...
- 13-MySQL DBA笔记-迁移、升级、备份、恢复数据库
第13章 迁移.升级.备份.恢复数据库本章将为读者讲述数据库的各种维护任务:迁移.升级.备份和恢复.因为每个人熟悉的工具不同,其对应的迁移.升级.备份和恢复的方式也都略有不同,本书将尽量对笔者认为最具 ...
- mysql数据库的基本操作:索引、视图,导入和导出,备份和恢复
1.索引: 索引是一种与表有关的结构,它的作用相当于书的目录,可以根据目录中的页码快速找到所需的内容. 当表中有大量记录时,若要对表进行查询,没有索引的情况是全表搜索:将所有记录一一取出,和查询条件进 ...
- MongoDB学习笔记(三)--权限 && 导出导入备份恢复 && fsync和锁
权限 绑定内网I ...
- mysql-索引、导入、导出、备份、恢复
1.索引 索引是一种与表有关的结构,它的作用相当于书的目录,可以根据目录中的页码快速找到所需的内容. 当表中有大量记录时,若要对表进行查询,没有索引的情况是全表搜索:将所有记录一一取出,和查询条件进行 ...
- MongoDB 备份(mongodump)恢复(mongorerstore) 导出 (Mongoexport) 导入( Mongoimport)
MongoDB 备份(mongodump) 在Mongodb中我们使用mongodump命令来备份MongoDB数据.该命令可以导出所有数据到指定目录中. mongodump命令可以通过参数指定导出的 ...
- paip 自定义输入法多多输入法词库的备份导出以及导入
paip 自定义输入法词库的备份导出以及导入 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net/ ...
随机推荐
- JQuery经典小例子——可编辑的表格
可编辑的表格: 屏幕剪辑的捕获时间: 2015/8/14 9:16 HTML代码为: <!DOCTYPE html> <htmlxmlns="http://www.w3.o ...
- Base64编码保存到文件服务器
byte[] buffer = Convert.FromBase64String(param.Base64Code); System.Net.WebClient webClient = new Sys ...
- POJ 3067 Japan(经典树状数组)
基础一维树状数组 题意:左边一排 1-n 的城市,右边一排 1-m 的城市,都从上到下依次对应.接着给你一些城市对,表示城市这两个城市相连,最后问你一共有多少个交叉,其中处于城市处的交叉不算并且每个 ...
- JQ学习(三)-ajax
jQuery - AJAX jQuery load() 方法 jQuery load() 方法是简单但强大的 AJAX 方法. load() 方法从服务器加载数据,并把返回的数据放入被选元素中. 语法 ...
- 静态成员函数(面向对象的static关键字)
静态成员函数 与静态数据成员一样,我们也可以创建一个静态成员函数,它为类的全部服务而不是某一个类的具体对象服务.静态成员函数与静态数据成员一样,都是类的内部实现,属于类定义的一部分.普通的成员函数一般 ...
- 在Windows宿主机中连接虚拟机中的Docker容器
1. 简单拓扑图
- 餐厅点餐APP总结
总结:经过这几个月的时间里,我们通过学习.讨论一起做出了餐厅点餐这个APP,我们在做这个APP的过程中,每个人都有自己的想法,也通过讨论最后做出了这个app,虽然做的不是很好,但是我们也尽自己的努力尽 ...
- 后缀数组 POJ 1743 Musical Theme
题目链接 题意:给定n个数字,求超过5个数字的,最长的,变化相同的,不相交的重复子串 分析:男人8题中的一题!数列相邻两项做差,形成新数列,即求数列中的最长重复子串(不可相交). 后缀数组+二分答案. ...
- java实现文件上传--flash上传
1.http请求的头信息是“application/octet-stream”,request body 是二进制的flash图片流 2.把流中的信息读入到文件中 代码如下,代码分三个部分: ---- ...
- 如何处理js的跨域问题
在bill.mail.10086.cn域内访问smsrebuild1.mail.10086.cn下的接口出现“阻止跨域源请求” 例如: URL 说明 是否允许通信 http://www.a.com/a ...