ASM磁碟頭資訊損壞和修復(kfed/dd)
KFED主要用來編輯和修復ASM metadata,可以在DiskGroup沒有mount的情況下使用;因此在ASM無法啟動、DiskGroup無法mount的時候可以嘗試使用這個神器來修復。
kfed工具支援對於ASM資訊的READ/WRITE/MERGE/NEW/ FORM/FIND/STRUCT等操作,11gR2之前需要手工編譯.
一、編譯kfed工具
1.編譯
[oracle@node1 ~]$ cd $ORACLE_HOME/rdbms/lib
[oracle@node1 lib]$ make -f ins_rdbms.mk ikfed
2.配置環境變數
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/rdbms/lib:$PATH
3.檢視幫助
[oracle@node1 ~]$ kfed -help
as/mlibASM Library [asmlib='lib']
aun/umAU number to examine or update [AUNUM=number]
aus/zAllocation Unit size in bytes [AUSZ=number]
blkn/umBlock number to examine or update [BLKNUM=number]
blks/zMetadata block size in bytes [BLKSZ=number]
ch/ksumUpdate checksum before each write [CHKSUM=YES/NO]
cn/tCount of AUs to process [CNT=number]
de/vASM device to examine or update [DEV=string]
dm/pallDon't suppress repeated lines when dumping corrupt blocks [DMPALL=YES/NO]
o/p KFED operation type [OP=READ/WRITE/MERGE/REPAIR/NEW/FORM/FIND/STRUCT]
p/rovnmName for provisioning purposes [PROVNM=string]
s/eekAU number to seek to [SEEK=number]
te/xtFile name for translated block text [TEXT=string]
ty/peASM metadata block type number [TYPE=number]
asm的每個磁碟上有存放有asm的後設資料,後設資料一般大小為4k。disk header一般在第0個au,第0個塊上。
二、模擬損壞磁碟頭資訊
1. 備份磁碟頭資訊:
[root@axj-rac1 backup]#dd if=/dev/raw/raw5 of=/backup/raw5.bak bs=1M count=2
[root@axj-rac1 backup]#dd if=/dev/raw/raw6 of=/backup/raw6.bak bs=1M count=2
[root@axj-rac1 backup]#dd if=/dev/raw/raw7 of=/backup/raw7.bak bs=1M count=2
備份成txt格式
kfed read /dev/raw/raw6 text=/home/oracle/asmdisk_raw6.txt
2. 檢視備份的磁碟頭資訊
[root@axj-rac1 oracle]# cat asmdisk_raw6.txt
kfbh.endian: 1 ; 0x000: 0x01
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: blk=0
kfbh.block.obj: 2147483649 ; 0x008: disk=1
kfbh.check: 3657275721 ; 0x00c: 0xd9fd9949
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000
kfdhdb.compat: 186646528 ; 0x020: 0x0b200000
kfdhdb.dsknum: 1 ; 0x024: 0x0001
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL --磁碟組冗餘方式
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER --磁碟組狀態,3是可用狀態
kfdhdb.dskname: DATADG01_0001 ; 0x028: length=13
kfdhdb.grpname: DATADG01 ; 0x048: length=8 --磁碟組名字
kfdhdb.fgname: DATADG01_0001 ; 0x068: length=13
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 33026093 ; 0x0a8: HOUR=0xd DAYS=0x1 MNTH=0xc YEAR=0x7df
kfdhdb.crestmp.lo: 2356159488 ; 0x0ac: USEC=0x0 MSEC=0x9 SECS=0x7 MINS=0x23
kfdhdb.mntstmp.hi: 33032273 ; 0x0b0: HOUR=0x11 DAYS=0x2 MNTH=0x2 YEAR=0x7e0
kfdhdb.mntstmp.lo: 3209038848 ; 0x0b4: USEC=0x0 MSEC=0x183 SECS=0x34 MINS=0x2f
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000 --au的大小,單位是byte,大小是1M
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: 4008 ; 0x0c4: 0x00000fa8 --該disk的大小,單位是au,預設au是1m,所以大小為4008M
kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001
kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn: 0 ; 0x0d4: 0x00000000 --file directory所在的au位置
kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]: 0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]: 0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]: 0 ; 0x0de: 0x0000
kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi: 33024790 ; 0x0e4: HOUR=0x16 DAYS=0x18 MNTH=0xa YEAR=0x7df
kfdhdb.grpstmp.lo: 258378752 ; 0x0e8: USEC=0x0 MSEC=0x1a3 SECS=0x36 MINS=0x3
kfdhdb.vfstart: 0 ; 0x0ec: 0x00000000
kfdhdb.vfend: 0 ; 0x0f0: 0x00000000
kfdhdb.spfile: 0 ; 0x0f4: 0x00000000
kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[0]: 0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[1]: 0 ; 0x100: 0x00000000
kfdhdb.ub4spare[2]: 0 ; 0x104: 0x00000000
kfdhdb.ub4spare[3]: 0 ; 0x108: 0x00000000
kfdhdb.ub4spare[4]: 0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[5]: 0 ; 0x110: 0x00000000
kfdhdb.ub4spare[6]: 0 ; 0x114: 0x00000000
kfdhdb.ub4spare[7]: 0 ; 0x118: 0x00000000
kfdhdb.ub4spare[8]: 0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[9]: 0 ; 0x120: 0x00000000
kfdhdb.ub4spare[10]: 0 ; 0x124: 0x00000000
kfdhdb.ub4spare[11]: 0 ; 0x128: 0x00000000
kfdhdb.ub4spare[12]: 0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[13]: 0 ; 0x130: 0x00000000
kfdhdb.ub4spare[14]: 0 ; 0x134: 0x00000000
kfdhdb.ub4spare[15]: 0 ; 0x138: 0x00000000
kfdhdb.ub4spare[16]: 0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[17]: 0 ; 0x140: 0x00000000
kfdhdb.ub4spare[18]: 0 ; 0x144: 0x00000000
kfdhdb.ub4spare[19]: 0 ; 0x148: 0x00000000
kfdhdb.ub4spare[20]: 0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[21]: 0 ; 0x150: 0x00000000
kfdhdb.ub4spare[22]: 0 ; 0x154: 0x00000000
kfdhdb.ub4spare[23]: 0 ; 0x158: 0x00000000
kfdhdb.ub4spare[24]: 0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[25]: 0 ; 0x160: 0x00000000
kfdhdb.ub4spare[26]: 0 ; 0x164: 0x00000000
kfdhdb.ub4spare[27]: 0 ; 0x168: 0x00000000
kfdhdb.ub4spare[28]: 0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[29]: 0 ; 0x170: 0x00000000
kfdhdb.ub4spare[30]: 0 ; 0x174: 0x00000000
kfdhdb.ub4spare[31]: 0 ; 0x178: 0x00000000
kfdhdb.ub4spare[32]: 0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[33]: 0 ; 0x180: 0x00000000
kfdhdb.ub4spare[34]: 0 ; 0x184: 0x00000000
kfdhdb.ub4spare[35]: 0 ; 0x188: 0x00000000
kfdhdb.ub4spare[36]: 0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[37]: 0 ; 0x190: 0x00000000
kfdhdb.ub4spare[38]: 0 ; 0x194: 0x00000000
kfdhdb.ub4spare[39]: 0 ; 0x198: 0x00000000
kfdhdb.ub4spare[40]: 0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[41]: 0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[42]: 0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[43]: 0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[44]: 0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[45]: 0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[46]: 0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[47]: 0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[48]: 0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[49]: 0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[50]: 0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[51]: 0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[52]: 0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[53]: 0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000
3.破壞磁碟頭的後設資料,這裡我開始破壞了raw5,後來為達到效果又破壞了下面兩個
[root@axj-rac1 backup]# dd if=/dev/zero of=/dev/raw/raw5 bs=4096 count=1
[root@axj-rac1 backup]# dd if=/dev/zero of=/dev/raw/raw6 bs=4096 count=1
[root@axj-rac1 backup]# dd if=/dev/zero of=/dev/raw/raw7 bs=4096 count=1
4.檢視一下磁碟頭的狀態
col group_number format a30
col disk_number format a30
col name format a30
col header_status format a30
col path format a30
col group_number clear
col disk_number clear
set linesize 200 pagesize 2000
SQL> select group_number,disk_number,name,header_status,path from v$asm_disk;
GROUP_NUMBER DISK_NUMBER NAMEHEADER_STATU PATH
---------------------- ---------------------------
2 0 OCR_VOTE_0000MEMBER /dev/raw/raw1
1 1 DATADG01_0001MEMBER /dev/raw/raw6
2 1 OCR_VOTE_0001MEMBER /dev/raw/raw2
2 2 OCR_VOTE_0002MEMBER /dev/raw/raw3
1 0 DATADG01_0000MEMBER /dev/raw/raw5
1 2 DATADG01_0002MEMBER /dev/raw/raw7
上面是正常的狀態
SQL> select group_number,disk_number,name,header_status,path from v$asm_disk;
GROUP_NUMBER DISK_NUMBER NAMEHEADER_STATUS PATH
------------ ---------------------------------------
2 0 OCR_VOTE_0000MEMBER /dev/raw/raw1
1 1 DATADG01_0001MEMBER /dev/raw/raw6
2 1 OCR_VOTE_0001MEMBER /dev/raw/raw2
2 2 OCR_VOTE_0002MEMBER /dev/raw/raw3
1 0 DATADG01_0000CANDIDATE /dev/raw/raw5
1 2 DATADG01_0002MEMBER /dev/raw/raw7
這裡是破壞後的狀態,raw狀態為CANDIDATE
5.破壞後檢視用kfed檢視raw5的磁碟頭的資訊
[root@axj-rac1 oracle]# kfed read /dev/raw/raw5 aun=0 blkn=0
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 0 ; 0x001: 0x00
kfbh.type: 0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt: 0 ; 0x003: 0x00
kfbh.block.blk: 0 ; 0x004: blk=0
kfbh.block.obj: 0 ; 0x008: file=0
kfbh.check: 0 ; 0x00c: 0x00000000
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
7F5595918400 00000000 00000000 00000000 00000000 [................]
Repeat 255 times
KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]
可以看到已經報錯了,跟上面的不一樣了。
依次檢視raw6和raw7的磁碟頭資訊
kfed read /backup/raw6.bak aun=1 blkn=254
kfed read /backup/raw7.bak aun=1 blkn=254
[root@axj-rac1 backup]# kfed read /backup/raw5.bak aun=1 blkn=254|grep kfbh.type
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
從10.2.0.5開始之後的版本header資訊是有額外保護和備份的,那麼備份在哪個位置
也是在disk的特定位置,這對au=1MB的dg,備份資訊是在第510blkn的位置,我們可以看下位置510的資訊:
[root@axj-rac1 backup]# kfed read /dev/raw/raw5 aun=0 blkn=510 | grep kfbh.type
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
可以看到510確實也是HEAD資訊把它讀出來看看
[root@axj-rac1 backup]# kfed read /dev/raw/raw5 blkn=510
kfbh.endian: 1 ; 0x000: 0x01
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 254 ; 0x004: blk=254
kfbh.block.obj: 2147483648 ; 0x008: disk=0
kfbh.check: 323429756 ; 0x00c: 0x1347257c
kfbh.fcn.base: 16403 ; 0x010: 0x00004013
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000
kfdhdb.compat: 186646528 ; 0x020: 0x0b200000
kfdhdb.dsknum: 0 ; 0x024: 0x0000
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: DATADG01_0000 ; 0x028: length=13
kfdhdb.grpname: DATADG01 ; 0x048: length=8
kfdhdb.fgname: DATADG01_0000 ; 0x068: length=13
kfdhdb.capname: ; 0x088: length=0
kfdhdb.crestmp.hi: 33024790 ; 0x0a8: HOUR=0x16 DAYS=0x18 MNTH=0xa YEAR=0x7df
kfdhdb.crestmp.lo: 258502656 ; 0x0ac: USEC=0x0 MSEC=0x21c SECS=0x36 MINS=0x3
kfdhdb.mntstmp.hi: 33032273 ; 0x0b0: HOUR=0x11 DAYS=0x2 MNTH=0x2 YEAR=0x7e0
kfdhdb.mntstmp.lo: 3209038848 ; 0x0b4: USEC=0x0 MSEC=0x183 SECS=0x34 MINS=0x2f
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: 2008 ; 0x0c4: 0x000007d8
kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001
kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]: 65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]: 65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]: 65535 ; 0x0de: 0xffff
kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi: 33024790 ; 0x0e4: HOUR=0x16 DAYS=0x18 MNTH=0xa YEAR=0x7df
kfdhdb.grpstmp.lo: 258378752 ; 0x0e8: USEC=0x0 MSEC=0x1a3 SECS=0x36 MINS=0x3
kfdhdb.vfstart: 0 ; 0x0ec: 0x00000000
kfdhdb.vfend: 0 ; 0x0f0: 0x00000000
kfdhdb.spfile: 0 ; 0x0f4: 0x00000000
kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[0]: 0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[1]: 0 ; 0x100: 0x00000000
kfdhdb.ub4spare[2]: 0 ; 0x104: 0x00000000
kfdhdb.ub4spare[3]: 0 ; 0x108: 0x00000000
kfdhdb.ub4spare[4]: 0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[5]: 0 ; 0x110: 0x00000000
kfdhdb.ub4spare[6]: 0 ; 0x114: 0x00000000
kfdhdb.ub4spare[7]: 0 ; 0x118: 0x00000000
kfdhdb.ub4spare[8]: 0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[9]: 0 ; 0x120: 0x00000000
kfdhdb.ub4spare[10]: 0 ; 0x124: 0x00000000
kfdhdb.ub4spare[11]: 0 ; 0x128: 0x00000000
kfdhdb.ub4spare[12]: 0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[13]: 0 ; 0x130: 0x00000000
kfdhdb.ub4spare[14]: 0 ; 0x134: 0x00000000
kfdhdb.ub4spare[15]: 0 ; 0x138: 0x00000000
kfdhdb.ub4spare[16]: 0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[17]: 0 ; 0x140: 0x00000000
kfdhdb.ub4spare[18]: 0 ; 0x144: 0x00000000
kfdhdb.ub4spare[19]: 0 ; 0x148: 0x00000000
kfdhdb.ub4spare[20]: 0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[21]: 0 ; 0x150: 0x00000000
kfdhdb.ub4spare[22]: 0 ; 0x154: 0x00000000
kfdhdb.ub4spare[23]: 0 ; 0x158: 0x00000000
kfdhdb.ub4spare[24]: 0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[25]: 0 ; 0x160: 0x00000000
kfdhdb.ub4spare[26]: 0 ; 0x164: 0x00000000
kfdhdb.ub4spare[27]: 0 ; 0x168: 0x00000000
kfdhdb.ub4spare[28]: 0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[29]: 0 ; 0x170: 0x00000000
kfdhdb.ub4spare[30]: 0 ; 0x174: 0x00000000
kfdhdb.ub4spare[31]: 0 ; 0x178: 0x00000000
kfdhdb.ub4spare[32]: 0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[33]: 0 ; 0x180: 0x00000000
kfdhdb.ub4spare[34]: 0 ; 0x184: 0x00000000
kfdhdb.ub4spare[35]: 0 ; 0x188: 0x00000000
kfdhdb.ub4spare[36]: 0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[37]: 0 ; 0x190: 0x00000000
kfdhdb.ub4spare[38]: 0 ; 0x194: 0x00000000
kfdhdb.ub4spare[39]: 0 ; 0x198: 0x00000000
kfdhdb.ub4spare[40]: 0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[41]: 0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[42]: 0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[43]: 0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[44]: 0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[45]: 0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[46]: 0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[47]: 0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[48]: 0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[49]: 0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[50]: 0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[51]: 0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[52]: 0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[53]: 0 ; 0x1d0: 0x00000000
kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000
kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000
kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000
kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000
透過對比我們可以發現與之前的raw5磁碟頭的內容是一摸一樣的。
6.由於之前破壞掉了raw5磁碟頭資訊,看看有啥報錯
[oracle@axj-rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 9 15:09:17 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup --重啟資料庫發現報錯了
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DATADG01/rac11g/spfilerac11g.ora'
ORA-17503: ksfdopn:2 Failed to open file +DATADG01/rac11g/spfilerac11g.ora
ORA-15077: could not locate ASM instance serving a required diskgroup
看看asm日誌
SQL> ALTER DISKGROUP DATADG01 MOUNT /* asm agent *//* {2:10674:2} */
NOTE: cache registered group DATADG01 number=1 incarn=0xbec84ee5
NOTE: cache began mount (first) of group DATADG01 number=1 incarn=0xbec84ee5
Wed Mar 09 15:10:28 2016
ERROR: no read quorum in group: required 2, found 0 disks
NOTE: cache dismounting (clean) group 1/0xBEC84EE5 (DATADG01)
NOTE: messaging CKPT to quiesce pins Unix process pid: 3711, image: oracle@axj-rac1 (TNS V1-V3)
NOTE: dbwr not being msg'd to dismount
NOTE: lgwr not being msg'd to dismount
NOTE: cache dismounted group 1/0xBEC84EE5 (DATADG01)
NOTE: cache ending mount (fail) of group DATADG01 number=1 incarn=0xbec84ee5
NOTE: cache deleting context for group DATADG01 1/0xbec84ee5
GMON dismounting group 1 at 7 for pid 29, osid 3711
ERROR: diskgroup DATADG01 was not mounted
ORA-15032: not all alterations performed
ORA-15017: diskgroup "DATADG01" cannot be mounted
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATADG01"
可以看到的是datadg01無法mount
透過asmcmd檢視,datadg01磁碟組都沒了
[grid@axj-rac1 trace]$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 6024 5623 0 5623 0 Y OCR_VOTE/
三、修復磁碟頭
方法一:kfed修復磁碟頭
[grid@s1-11g dev]$
kfed repair /dev/raw/raw5
kfed repair /dev/raw/raw6
kfed repair /dev/raw/raw7
方法二: dd修復,用之前的備份
[grid@s1-11g dev]$
dd if=/backup/raw5 of=/dev/raw/raw5
dd if=/backup/raw6 of=/dev/raw/raw6
dd if=/backup/raw7 of=/dev/raw/raw7
方法三: 利用oracle的kfed工具來備份,格式是文字格式,恢復時使用kfed merge進去
備份:
kfed read /dev/raw/raw5 aunum=0 blknum=0 text=/home/oracle/raw5.txt
kfed read /dev/raw/raw6 aunum=0 blknum=0 text=/home/oracle/raw6.txt
kfed read /dev/raw/raw7 aunum=0 blknum=0 text=/home/oracle/raw7.txt
恢復:
kfed write /dev/raw/raw5 aunum=0 blknum=0 text=raw5.txt
kfed write /dev/raw/raw6 aunum=0 blknum=0 text=raw6.txt
kfed write /dev/raw/raw7 aunum=0 blknum=0 text=raw7.txt
這裡我用的是方法一修復的
1.恢復完成後檢視磁碟頭資訊:
[root@axj-rac1 oracle]# kfed read /dev/raw/raw5 aun=0 blkn=0|grep kfbh.type
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
2.然後成功mount磁碟組
3.檢視dg狀態可以看到是mounted狀態
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 10024 6581 0 6581 0 N DATADG01/
MOUNTED EXTERN N 512 4096 1048576 6024 5623 0 5623 0 Y OCR_VOTE/
可以看到datadg02已結mount了
3.重新查詢磁碟組以及磁碟資訊
col group_number format a30
col disk_number format a30
col name format a30
col header_status format a30
col path format a30
col group_number clear
col disk_number clear
set linesize 200 pagesize 2000
SQL>select group_number,disk_number,name,header_status,path from v$asm_disk;
GROUP_NUMBER DISK_NUMBER NAMEHEADER_STATUS PATH
------------ ----------- -----------------------------
1 1 DATADG01_0001MEMBER /dev/raw/raw6
1 0 DATADG01_0000MEMBER /dev/raw/raw5
2 1 OCR_VOTE_0001MEMBER /dev/raw/raw2
2 0 OCR_VOTE_0000MEMBER /dev/raw/raw1
1 2 DATADG01_0002MEMBER /dev/raw/raw7
2 2 OCR_VOTE_0002MEMBER /dev/raw/raw3
可以看到所有狀態已經正常,資料庫也正常啟動。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2155545/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【LINUX】Oracle資料庫 linux磁碟頭資料損壞修復LinuxOracle資料庫
- Oracle asm磁碟損壞異常恢復OracleASM
- linux下修復磁碟損壞Linux
- 【ASM】ASM磁碟頭被重寫,如何修復ASM
- system資料檔案頭損壞修復
- RAID10磁碟陣列損壞修復操作AI陣列
- 磁頭損壞的修復方法有哪些
- linux RAID10磁碟陣列損壞的修復LinuxAI陣列
- WPS文件損壞如何修復?WPS文件損壞的修復方法
- 圖片、視訊損壞了,如何修復?
- SQL Server 資料頁損壞修復SQLServer
- RAC磁碟頭損壞問題處理
- SQLite資料庫損壞及其修復探究SQLite資料庫
- 伺服器Oracle資料庫損壞修復伺服器Oracle資料庫
- SQL Anywhere db檔案損壞修復 DB檔案修復 DB資料庫修復SQL資料庫
- InterBase資料庫檔案損壞的修復方法資料庫
- 伺服器資料庫損壞能修復嘛伺服器資料庫
- redo損壞修復啟動資料庫辦法資料庫
- 資料恢復工具Recoverit使用教程:如何修復損壞的影片資料恢復
- 電腦硬碟分割槽表損壞怎麼修復?電腦硬碟分割槽表損壞的修復方法硬碟
- 伺服器資料損壞有辦法修復嗎?伺服器
- linux檔案系統損壞如何修復Linux
- SQL Server誤區30日談-Day16-資料的損壞和修復SQLServer
- 資料恢復記錄:硬碟分割槽損壞修復SqlServer資料庫過程資料恢復硬碟SQLServer資料庫
- MySQL資料庫INNODB表損壞修復處理過程分享MySql資料庫
- MongoDB 資料檔案損壞修復救命repair與致命危險MongoDBAI
- 伺服器硬碟磁頭損壞,碟片劃傷資料恢復伺服器硬碟資料恢復
- 不重灌也能修復損壞的 Ubuntu 系統Ubuntu
- 深入解析:段頭塊損壞bbed異常恢復
- redhat8 rhel8 啟動grub損壞修復Redhat
- u盤檔案損壞怎麼恢復資料 u盤恢復損壞資料的有效方法
- windows10應用商店損壞怎麼修復_win10應用商店損壞處理方法WindowsWin10
- 織夢資料庫配置檔案資料庫損壞:嘗試修復資料庫資料庫
- 修復損壞的gzip壓縮檔案之原理篇
- Ceph 磁碟損壞現象和解決方法
- RMAN修復壞塊
- win10提示損壞的眏像怎麼辦_win10提示損壞的眏像如何修復Win10
- Win7系統ISP損壞怎麼辦?Win7系統中lsp損壞的修復方法Win7