Oracle RAC OCR 和 VotingDisk 的备份与恢复
一:Voting Disk
Voting Disk 这个文件主要用于记录节点成员状态,在出现脑裂时,决定那个Partion获得控制权,其他的Partion必须从集群中剔除。Voting disk使用的是一种“多数可用算法”,如果有多个Voting disk,则必须一半以上的Votedisk同时使用,Clusterware才能正常使用。 比如配置了4个Votedisk,坏一个Votedisk,集群可以正常工作,如果坏了2个,则不能满足半数以上,集群会立即宕掉,
所有节点立即重启,所以如果添加Votedisk,尽量不要只添加一个,而应该添加2个。这点和OCR 不一样。OCR 只需配置一个。
1.1查看votedisk的位置:
[root@jy1 ~]# cd u01/app/oracle/product/10.2.0/crs/bin [root@jy1 bin]# ./crsctl query css votedisk
0. 0 /dev/raw/raw2 located 1 votedisk(s).
1.2备份votedisk盘:
[root@jy1 bin]# dd if=/dev/raw/raw2 of=/home/oracle/votedisk.bak
6291456+0 records in
6291456+0 records out
3221225472 bytes (3.2 GB) copied, 201.63 seconds, 16 MB/s
1.3通过Strings 命令来查看 voting disk 的内容
[root@jy1 bin]# strings /home/oracle/votedisk.bak | sort -u
fSLC
ssLckcoT
SslcLlik
sSlcrEp0
}|{z
1.4恢复votedisk盘:
[root@jy1 bin]# dd if=/home/oracle/votedisk.bak of=/dev/raw/raw2
6291456+0 records in
6291456+0 records out
3221225472 bytes (3.2 GB) copied, 201.63 seconds, 16 MB/s
二 :OCR
Oracle Clusterware把整个集群的配置信息放在共享存储上,这些信息包括了集群节点的列表,集群数据库实例到节点的映射以及CRS应用程序资源信息。存放的位置就在OCR Disk上. 在整个集群中,只有一个节点能对OCR Disk 进行读写操作,这个节点叫作Master Node,所有节点都会在内存中保留一份OCR的拷贝,同时有一个OCR Process 从这个内存中读取内容。 OCR 内容发生改变时,由Master Node的OCR Process负责同步到其他节点的OCR Process。
Oracle 每4个小时对其做一次备份,并且保留最后的3个备份,以及前一天,前一周的最后一个备份。 这个备份由Master Node CRSD进程完成,备份的默认位置是$CRS_HOME/crs/cdata/<cluster_name>目录下,可以通过ocrconfig -backuploc <directory_name>命令修改到新的目录。 每次备份后,备份文件名自动更改,以反应备份时间顺序,最近一次的备份
叫作backup00.ocr。这些备份文件除了保存在本地,DBA还应该在其他存储设备上保留一份,以防止意外的存储故障。
[root@jy1 crs]# pwd
/u01/app/oracle/product/10.2.0/crs/cdata/crs
[root@jy1 crs]# ls -lrt
total 12396
-rw-r--r-- 1 root root 4227072 Nov 17 14:45 backup00.ocr
-rw-r--r-- 1 root root 4227072 Nov 17 14:45 week.ocr
-rw-r--r-- 1 root root 4227072 Nov 17 14:45 day.ocr
在安装clusterware过程中,如果选择External Redundancy冗余方式,则只能输入一个OCR磁盘位置。 但是Oracle允许配置两个OCR 磁盘互为镜像,以防止OCR 磁盘的单点故障。 OCR 磁盘和Votedisk磁盘不一样,OCR磁盘最多只能有两个,一个Primary OCR 和一个Mirror OCR。
Oracle 推荐在对集群做调整时,比如增加,删除节点之前,修改RAC IP之前,对OCR做一个备份,可以使用export 备份到指定文件,如果做了replace或者restore 等操作,Oracle 建议使用 cluvfy comp ocr -n all 命令来做一次全面的检查。对OCR的备份与恢复,我们可以使用ocrconfig 命令。
[root@jy1 bin]# ./ocrconfig --help
Name:
ocrconfig - Configuration tool for Oracle Cluster Registry. Synopsis:
ocrconfig [option]
option:
-export [-s online]
- Export cluster register contents to a file
-import - Import cluster registry contents from a file
-upgrade [ []]
- Upgrade cluster registry from previous version
-downgrade [-version ]
- Downgrade cluster registry to the specified version
-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.
1. 用导出导入备份恢复OCR
1.1首先关闭所有节点的CRS
[root@jy1 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued. [root@jy2 bin]# ./crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
1.2用root 用户导出OCR内容
[root@jy1 bin]# ./ocrconfig -export /u01/ocrbak.exp
[root@jy1 bin]# ls -lrt /u01
total 96
drwxr-xr-x 3 root root 4096 Nov 10 23:12 app
drwxrwxrwx 6 root root 4096 Nov 11 11:54 tmp
-rw-r--r-- 1 root root 84375 Nov 17 16:52 ocrbak.exp
1.3重启CRS
[root@jy1 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly [root@jy2 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
1.4检查CRS 状态
Cannot communicate with EVM
[root@jy1 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy [root@jy2 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy [root@jy1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE jy1
ora....Y1.lsnr application ONLINE ONLINE jy1
ora.jy1.gsd application ONLINE ONLINE jy1
ora.jy1.ons application ONLINE ONLINE jy1
ora.jy1.vip application ONLINE ONLINE jy1
ora....SM2.asm application ONLINE ONLINE jy2
ora....Y2.lsnr application ONLINE ONLINE jy2
ora.jy2.gsd application ONLINE ONLINE jy2
ora.jy2.ons application ONLINE ONLINE jy2
ora.jy2.vip application ONLINE ONLINE jy2
ora.jyrac.db application ONLINE ONLINE jy2
ora....c1.inst application ONLINE ONLINE jy1
ora....c2.inst application ONLINE ONLINE jy2
1.5 检查OCR一致性
[root@jy1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 3145640
Used space (kbytes) : 3816
Available space (kbytes) : 3141824
ID : 1032702449
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded
1.6破坏OCR内容
[root@jy1 bin]# dd if=/dev/zero of=/dev/raw/raw1 bs=8192 count=1000
1000+0 records in
1000+0 records out
8192000 bytes (8.2 MB) copied, 0.355733 seconds, 23.0 MB/s
1.7再次检查OCR一致性
[root@jy1 bin]# ./ocrcheck
PROT-601: Failed to initialize ocrcheck
再来执行crs_stat -t命令就会发现crs已经终止了
[root@jy1 bin]# ./crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.
1.8使用cluvfy 工具检查一致性
[root@jy1 cluvfy]# su - oracle
[oracle@jy1 ~]$ cd /soft/clusterware/cluvfy
[oracle@jy1 ~]$ ./runcluvfy.sh comp ocr -n all Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware. Verification cannot proceed.
1.9使用Import 恢复OCR 内容(使用restore选项只能导入OCR自动产生的物理备份, import选项只能导入通过export选项导出的的逻辑备份)
[root@jy1 bin]# ./ocrconfig -import /u01/ocrbak.exp
1.10 再次检查OCR
[root@jy1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 3145640
Used space (kbytes) : 3816
Available space (kbytes) : 3141824
ID : 1032702449
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded
1.11 使用cluvfy工具检查
[root@jy1 cluvfy]# su - oracle
[oracle@jy1 ~]$ cd /soft/clusterware/cluvfy
[oracle@jy1 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 "2" exists. Checking data integrity of OCR...
Data integrity check for OCR passed. OCR integrity check passed. Verification of OCR integrity was successful.
2使用自动备份恢复OCR
2.1关闭运行在集群数据库的所有节点上的CRS服务程序(在Oracle 11gR2 中已经没有了init.crs 命令了。 只能通过crsctl stop crs命令来关闭CRS.)
/etc/init.d/init.crs stop 或者crsctl stop crs
2.2 通过ocrconfig 的showbackup选项查看最近的备份
[root@jy1 bin]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon. [root@jy2 bin]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
2.2通过ocrconfig 的showbackup选项查看最近的备份
[root@jy1 bin]# ./ocrconfig -showbackup jy1 2014/11/17 14:45:54 /u01/app/oracle/product/10.2.0/crs/cdata/crs jy1 2014/11/17 14:45:54 /u01/app/oracle/product/10.2.0/crs/cdata/crs jy1 2014/11/17 14:45:54 /u01/app/oracle/product/10.2.0/crs/cdata/crs
[root@jy1 bin]# ls -lrt /u01/app/oracle/product/10.2.0/crs/cdata/crs
total 12396
-rw-r--r-- 1 root root 4227072 Nov 17 14:45 backup00.ocr
-rw-r--r-- 1 root root 4227072 Nov 17 14:45 week.ocr
-rw-r--r-- 1 root root 4227072 Nov 17 14:45 day.ocr
2.3破坏OCR内容
[root@jy1 bin]# dd if=/dev/zero of=/dev/raw/raw1 bs=8192 count=1000
1000+0 records in
1000+0 records out
8192000 bytes (8.2 MB) copied, 0.355733 seconds, 23.0 MB/s
2.4再次检查OCR一致性
[root@jy1 bin]# ./ocrcheck
PROT-601: Failed to initialize ocrcheck
再来执行crs_stat -t命令就会发现crs已经终止了
[root@jy1 bin]# ./crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.
2.5使用cluvfy 工具检查一致性
[root@jy1 cluvfy]# su - oracle
[oracle@jy1 ~]$ cd /soft/clusterware/cluvfy
[oracle@jy1 ~]$ ./runcluvfy.sh comp ocr -n all Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware. Verification cannot proceed.
2.6通过ocrconfig的restore或import选项导入OCR数据(使用restore选项只能导入OCR自动产生的物理备份,import选项只能导入通过export选项导出的的逻辑备份)
ocrconfig -restore filename_location
[root@jy1 bin]# ./ocrconfig -restore /u01/app/oracle/product/10.2.0/crs/cdata/crs/backup00.ocr
2.7 检查CRS
[root@jy1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 3145640
Used space (kbytes) : 3816
Available space (kbytes) : 3141824
ID : 1387716561
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded
2.8 使用cluvfy工具检查
[root@jy1 cluvfy]# su - oracle
[oracle@jy1 ~]$ cd /soft/clusterware/cluvfy
[oracle@jy1 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 "2" exists. Checking data integrity of OCR...
Data integrity check for OCR passed. OCR integrity check passed. Verification of OCR integrity was successful.
2.9 在所有节点上重新启动CRS
/etc/init.d/init.crs start 而在Oracle 11gR2使用:crsctl start crs 命令来启动CRS.
[root@jy1 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds. [root@jy2 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds. [root@jy1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE jy1
ora....Y1.lsnr application ONLINE ONLINE jy1
ora.jy1.gsd application ONLINE ONLINE jy1
ora.jy1.ons application ONLINE ONLINE jy1
ora.jy1.vip application ONLINE ONLINE jy1
ora....SM2.asm application ONLINE ONLINE jy2
ora....Y2.lsnr application ONLINE ONLINE jy2
ora.jy2.gsd application ONLINE ONLINE jy2
ora.jy2.ons application ONLINE ONLINE jy2
ora.jy2.vip application ONLINE ONLINE jy2
ora.jyrac.db application ONLINE ONLINE jy1
ora....c1.inst application ONLINE ONLINE jy1
ora....c2.inst application ONLINE ONLINE jy2
Oracle RAC OCR 和 VotingDisk 的备份与恢复的更多相关文章
- Oracle 10g RAC OCR 和 VotingDisk 的备份与恢复
Oracle RAC 中OCR 和Voting Disk 备份在我的blog: Oracle RAC 常用维护工具和命令 中已经有说明,现在再次把它单独拿出做一个说明, 因为OCR 和Voting D ...
- Oracle RAC OCR 的备份与恢复
Oracle Clusterware把整个集群的配置信息放在共享存储上,这些信息包括了集群节点的列表.集群数据库实例到节点的映射以及CRS应用程序资源信息.也即是存放在ocr 磁盘(或者ocfs文件) ...
- Oracle RAC OCR 与健忘症
OCR就好比Windows的一个注册表,存储了所有与集群,RAC数据库相关的配置信息.而且是公用的配置,也就是说多个节点共享相同的配置信息.因此该配置应当存储于共享磁盘.本文主要基于Oracle 10 ...
- Oracle RAC OCR 的管理与维护
OCR相当于Windows的注册表.对于Windows而言,所有的软件信息,用户,配置,安全等等统统都放到注册表里边.而集群呢,同样如此,所有和集群相关的资源,配置,节点,RAC数据库统统都放在这个仓 ...
- 由于OCR文件损坏造成Oracle RAC不能启动的现象和处理方法
v$cluster_interconnects 集群节点间通信使用的IP地址 错误信息 使用了公网进行连接 SQL> select * from v$cluster_interconnects; ...
- Oracle rac集群环境中的特殊问题
备注:本文摘抄于张晓明<大话Oracle RAC:集群 高可用性 备份与恢复> 因为集群环境需要多个计算机协同工作,要达到理想状态,必须要考虑在集群环境下面临的新挑战. 1.并发控制 在集 ...
- oracle rac理解和用途扩展
Oracle RAC的优势在于利用多个节点(数据库实例)组成一个数据库,这样在保证了数据库高可用性的情况下更充分的利用了多个主机的性能,而且可以通过增加节点进行性能的扩展.实现Oracle RAC需要 ...
- 深入理解Oracle RAC 12c 笔记
深入理解Oracle RAC 12c 跳转至: 导航. 搜索 文件夹 1 概述 2 集群件管理和故障诊断 3 执行实践 4 新特性 5 存储和ASM 6 应用设计上的问题 7 管理和调优一个复杂的RA ...
- ORACLE RAC 11.2.0.4 CentOS release 6.9 静默安装1.0版本
RAC11.2.0.4静默安装 1.0版本,20180613 #本文档IP地址使用X隐藏,个人可按照自己的当前环境IP进行适当修改 1. 清除原环境中的单实例软件 #清除原环境: 删除/etc/ora ...
随机推荐
- 动态规划(计数DP):JLOI 2016 成绩比较
Description G系共有n位同学,M门必修课.这N位同学的编号为0到N-1的整数,其中B神的编号为0号.这M门必修课编号为0到M- 1的整数.一位同学在必修课上可以获得的分数是1到Ui中的一个 ...
- Linux下安装搜狗输入法
目前的搜狗输入法 for Linux 是Linux Deepin 社区版的测试版,基于Fcitx 框架. 话不多说,直接上. 准备工作:卸载Ubuntu默认的ibus输入法: sudo apt-get ...
- TeamViewer 远程时出现:现在无法捕捉画面。这可能是由于恰的用户切换或远程桌面会话断开、最小化
关掉远程访问主机的TeamViewer ,再重新打开软件
- 进军es6(2)---解构赋值
本该两周之前就该总结的,但最近一直在忙校招实习的事,耽误了很久.目前依然在等待阿里HR面后的结果中...但愿好事多磨!在阿里的某轮面试中面试官问到了es6的掌握情况,说明es6真的是大势所趋,我们更需 ...
- HDOJ/HDU 1251 统计难题(字典树啥的~Map水过)
Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己 ...
- Oracle 11gR2 create init script
设置oracle用户变量. [oracle@db01 ~]$ vi /etc/oratab # end line: change db01:/oracle/app/product/11.2.0/db_ ...
- linux 多线程基础1
一.什么是线程 在一个程序里的多个执行路线就叫做线程.更准确的定义是:线程是“一个进程内部的一个控制序列”. 典型的unix进程可以看成只有一个控制线程:一个进程在同一时刻只做一件事情. ...
- MySQL WorkBench中文教程
在网上找到了一份MySQL WorkBench的教程,点此可以下载Work Bench教程(原文),为了便于学习和交流,请朋友帮忙翻译成了中文,点此可以下载Work Bench教程(中文翻译版). 具 ...
- Java验证码和ajax判断
关于来了解相关的api BufferedImage(int width, int height, int imageType) 构造一个类型为预定义图像类型之一的 BufferedImage. Buf ...
- Creating custom datatypes using the umbraco usercontrol wrapper
本篇文章介绍的是基于UmbracoCMS技术搭建的网站所使用的相关技术. 1. 需求 Umbraco CMS的dataType中有richTexhEditor控件,但是它不是太完善,比如没有 ...