共计 8238 个字符,预计需要花费 21 分钟才能阅读完成。
这篇文章主要介绍“ocr 的备份恢复方法是什么”,在日常操作中,相信很多人在 ocr 的备份恢复方法是什么问题上存在疑惑,丸趣 TV 小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”ocr 的备份恢复方法是什么”的疑惑有所帮助!接下来,请跟着丸趣 TV 小编一起来学习吧!
操作系统版本:readhat 6.4
数据库版本:11203
1. 查看集群状态
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/crsctl stat res -t
——————————————————————————–
NAME TARGET STATE SERVER STATE_DETAILS
——————————————————————————–
Local Resources
——————————————————————————–
ora.ARC.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATADG01.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.DATADG02.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.LISTENER.lsnr
ONLINE OFFLINE rac1
ONLINE ONLINE rac2
ora.VOTE.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
ora.gsd
OFFLINE OFFLINE rac1
OFFLINE OFFLINE rac2
ora.net1.network
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ons
ONLINE ONLINE rac1
ONLINE ONLINE rac2
——————————————————————————–
Cluster Resources
——————————————————————————–
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2
ora.cvu
1 ONLINE ONLINE rac2
ora.oc4j
1 ONLINE ONLINE rac1
ora.orcl.db
1 ONLINE ONLINE rac1 Open
2 ONLINE ONLINE rac2 Open
ora.rac1.vip
1 ONLINE ONLINE rac1
ora.rac2.vip
1 ONLINE ONLINE rac2
ora.scan1.vip
1 ONLINE ONLINE rac2
2. 查看 ocr 的备份,和手工备份,紧急情况下没有 ocr 的备份也不要紧,
在 $CRS_HOME 的 cdata 目录下有 ocr 的自动备份,默认每天和每周都会保存的,只要没做过架构变更,都一直可用。
[root@rac1 cdata]# pwd
/oracle/app/grid/11.2.0/cdata
[root@rac1 cdata]# ls -lrt
总用量 2852
drwxr-xr-x 2 grid oinstall 4096 1 月 17 2016 localhost
drwxr-xr-x 2 grid oinstall 4096 1 月 17 2016 rac1
-rw——- 1 root oinstall 272756736 9 月 5 07:36 rac1.olr
drwxrwxr-x 2 grid oinstall 4096 9 月 5 07:37 rac-cluster
查看 ocr 磁盘组的未知和 votingdisk 的位置。
[root@rac1 cdata]# /oracle/app/grid/11.2.0/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2904
Available space (kbytes) : 259216
ID : 635069277
Device/File Name : +VOTE
Device/File integrity check succeeded
Device/File not configured
Device/File not configured
Device/File not configured
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
[root@rac1 cdata]# /oracle/app/grid/11.2.0/bin/crsctl query css votedisk
## STATE File Universal Id File Name Disk group
— —– —————– ——— ———
1. ONLINE 956b16ceaff14f4ebf37414725a67350 (/dev/asm-diskb) [VOTE]
2. ONLINE adb3a38f36514f2bbfcaa798303df4a1 (/dev/asm-diskc) [VOTE]
3. ONLINE aa9bfeef2ddd4f01bf212f8e020cd040 (/dev/asm-diskd) [VOTE]
查看 OCR 备份的位置和情况
查看自动备份:
ocrconfig -showbackup auto
查看手工备份:
ocrconfig -showbackup manual
显示的备份全是系统自动备份 ocr 的备份,最下面的 PROT-25 提示没有手动的备份
[root@rac1 cdata]# /oracle/app/grid/11.2.0/bin/ocrconfig -showbackup
rac1 2019/09/05 07:37:35 /oracle/app/grid/11.2.0/cdata/rac-cluster/backup00.ocr
rac1 2019/09/05 03:37:34 /oracle/app/grid/11.2.0/cdata/rac-cluster/backup01.ocr
rac1 2019/09/04 16:44:33 /oracle/app/grid/11.2.0/cdata/rac-cluster/backup02.ocr
rac1 2019/09/04 16:44:33 /oracle/app/grid/11.2.0/cdata/rac-cluster/day.ocr
rac1 2019/09/04 16:44:33 /oracle/app/grid/11.2.0/cdata/rac-cluster/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
查看 ASM SPFILE 的存储位置:
[root@rac1 cdata]# su – grid
[grid@rac1 ~]$ asmcmd
ASMCMD spget
+VOTE/rac-cluster/asmparameterfile/registry.253.901344197
开始操作
1. 做好 ocr 的手工备份
[root@rac1 rac-cluster]# /oracle/app/grid/11.2.0/bin/ocrconfig -export /home/oracle/ocr.bak
2. 备份 ASM 的参数文件
su – grid
sqlplus / as sysasm
create pfile= /home/grid/initasm.ora from spfile;
3.dd 原来的 OCR 磁盘组中的磁盘,重建 OCR 磁盘组
[root@rac1 oracle]# dd if=/dev/zero of=/dev/asm-diskb bs=1024 count=1000
[root@rac1 oracle]# dd if=/dev/zero of=/dev/asm-diskc bs=1024 count=1000
[root@rac1 oracle]# dd if=/dev/zero of=/dev/asm-diskd bs=1024 count=1000
4. 2 个节点关闭数据库和集群
节点 1
[root@rac1 oracle]# /oracle/app/grid/11.2.0/bin/crsctl stop crs
节点 2
[root@rac2 ~]# /oracle/app/grid/11.2.0/bin/crsctl stop crs
5. 以独占模式(NOCRS 模式)启动节点 1 GRID 组件 – 只在节点 1 执行
[root@rac1 oracle]# /oracle/app/grid/11.2.0/bin/crsctl start crs -excl -nocrs
6. 查看日志
集群 alert 日志
[cssd(3150)]CRS-1601:CSSD Reconfiguration complete. Active nodes are rac1 .
2019-09-05 04:15:10.314
[ctssd(3192)]CRS-2407:The new Cluster Time Synchronization Service reference node is host rac1.
2019-09-05 04:15:10.315
[ctssd(3192)]CRS-2401:The Cluster Time Synchronization Service started on host rac1.
2019-09-05 04:15:19.173
[/oracle/app/grid/11.2.0/bin/oraagent.bin(3071)]CRS-5011:Check of resource +ASM failed: details at (:CLSN00006:) in /oracle/app/grid/11.2.0/log/rac1/agent/ohasd/oraagent_grid/oraagent_grid.log
2019-09-05 04:15:21.828
[/oracle/app/grid/11.2.0/bin/oraagent.bin(3071)]CRS-5011:Check of resource +ASM failed: details at (:CLSN00006:) in /oracle/app/grid/11.2.0/log/rac1/agent/ohasd/oraagent_grid/oraagent_grid.log
2019-09-05 04:15:31.212
[/oracle/app/grid/11.2.0/bin/oraagent.bin(3071)]CRS-5019:All OCR locations are on ASM disk groups [VOTE], and none of these disk groups are mounted. Details are at (:CLSN00100:) in /oracle/app/grid/11.2.0/log/rac1/agent/ohasd/oraagent_grid/oraagent_grid.log .
[grid@rac1 rac1]$ crsctl stat res -t -init
——————————————————————————–
NAME TARGET STATE SERVER STATE_DETAILS
——————————————————————————–
Cluster Resources
——————————————————————————–
ora.asm
1 ONLINE INTERMEDIATE rac1 OCR not started
ora.cluster_interconnect.haip
1 ONLINE ONLINE rac1
ora.crf
1 OFFLINE OFFLINE
ora.crsd
1 OFFLINE OFFLINE
ora.cssd
1 ONLINE ONLINE rac1
ora.cssdmonitor
1 ONLINE ONLINE rac1
ora.ctssd
1 ONLINE ONLINE rac1 ACTIVE:0
ora.diskmon
1 OFFLINE OFFLINE
ora.evmd
1 OFFLINE OFFLINE
ora.gipcd
1 ONLINE ONLINE rac1
ora.gpnpd
1 ONLINE ONLINE rac1
ora.mdnsd
1 ONLINE ONLINE rac1
7. 创建新的磁盘组节点 1 操作
su – grid
sqlplus / as sysasm
set line 200 pages 999
col name for a15
col compatibility for a15
select inst_id,group_number,name,allocation_unit_size/1024/1024 au_mb,type,state,compatibility,database_compatibility from gv$asm_diskgroup order by 3,1;
create diskgroup VOTE
normal redundancy
disk
/dev/asm-diskb ,
/dev/asm-diskc ,
/dev/asm-diskd
attribute compatible.asm = 11.2.0.0.0
8. 恢复 OCR 文件并设置 votedisk – 节点 1 操作
root 执行
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/ocrconfig -import /home/oracle/ocr.bak – 如果使用的是自动备份,则这里需要使用 -restore 来替换 -import
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/ocrcheck
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/crsctl replace votedisk +VOTE
Successful addition of voting disk 6b91880919e64fe3bfc01701f29256d1.
Successful addition of voting disk 2a0eef6d3ee64f10bfa2040621cef851.
Successful addition of voting disk a063e70967dd4fdcbf3b32e675c3246a.
Successfully replaced voting disk group with +VOTE.
CRS-4266: Voting file(s) successfully replaced
9. 重启集群
节点 1
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/crsctl stop crs -f
[root@rac1 ~]# /oracle/app/grid/11.2.0/bin/crsctl start crs
节点 2
[root@rac2 ~]# /oracle/app/grid/11.2.0/bin/crsctl start crs
到此,关于“ocr 的备份恢复方法是什么”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注丸趣 TV 网站,丸趣 TV 小编会继续努力为大家带来更多实用的文章!