這篇文章主要介紹“ocr的備份恢復(fù)方法是什么”,在日常操作中,相信很多人在ocr的備份恢復(fù)方法是什么問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”ocr的備份恢復(fù)方法是什么”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!
專注于為中小企業(yè)提供做網(wǎng)站、成都網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)環(huán)翠免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了近1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
操作系統(tǒng)版本: readhat 6.4
數(shù)據(jù)庫版本: 11203
1.查看集群狀態(tài)
[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的自動備份,默認(rèn)每天和每周都會保存的,只要沒做過架構(gòu)變更,都一直可用。
[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
顯示的備份全是系統(tǒng)自動備份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的參數(shù)文件
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個節(jié)點(diǎn)關(guān)閉數(shù)據(jù)庫和集群
節(jié)點(diǎn)1
[root@rac1 oracle]# /oracle/app/grid/11.2.0/bin/crsctl stop crs
節(jié)點(diǎn)2
[root@rac2 ~]# /oracle/app/grid/11.2.0/bin/crsctl stop crs
5.以獨(dú)占模式(NOCRS模式)啟動節(jié)點(diǎn)1 GRID組件--只在節(jié)點(diǎn)1執(zhí)行
[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. 創(chuàng)建新的磁盤組節(jié)點(diǎn)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.恢復(fù)OCR文件并設(shè)置votedisk --節(jié)點(diǎn)1操作
root執(zhí)行
[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.重啟集群
節(jié)點(diǎn)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
節(jié)點(diǎn)2
[root@rac2 ~]# /oracle/app/grid/11.2.0/bin/crsctl start crs
到此,關(guān)于“ocr的備份恢復(fù)方法是什么”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!