1>. 编译产生kfed
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk ikfed
Linking KFED utility (kfed)
rm -f /oracle/app/oracle/product/10.2.0/db_1/rdbms/lib/kfed
gcc -o /oracle/app/oracle/product/10.2.0/db_1/rdbms/lib/kfed -L/oracle/app/oracle/product/10.2.0/db_1/rdbms/lib/ -L/oracle/app/oracle/product/10.2.0/db_1/lib/ -L/oracle/app/oracle/product/10.2.0/db_1/lib/stubs/ -L/usr/lib -lirc /oracle/app/oracle/product/10.2.0/db_1/lib/s0main.o /oracle/app/oracle/product/10.2.0/db_1/rdbms/lib/sskfeded.o /oracle/app/oracle/product/10.2.0/db_1/rdbms/lib/skfedpt.o /oracle/app/oracle/product/10.2.0/db_1/rdbms/lib/defopt.o -ldbtools10 -lclntsh `cat /oracle/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /oracle/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /oracle/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /oracle/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /oracle/app/oracle/product/10.2.0/db_1/lib/sysliblist` -Wl,-rpath,/oracle/app/oracle/product/10.2.0/db_1/lib -lm `cat /oracle/app/oracle/product/10.2.0/db_1/lib/sysliblist` -ldl -lm -L/oracle/app/oracle/product/10.2.0/db_1/lib
mv -f /oracle/app/oracle/product/10.2.0/db_1/bin/kfed /oracle/app/oracle/product/10.2.0/db_1/bin/kfedO
mv: cannot stat `/oracle/app/oracle/product/10.2.0/db_1/bin/kfed': No such file or directory
make: [ikfed] Error 1 (ignored)
mv /oracle/app/oracle/product/10.2.0/db_1/rdbms/lib/kfed /oracle/app/oracle/product/10.2.0/db_1/bin/kfed
chmod 751 /oracle/app/oracle/product/10.2.0/db_1/bin/kfed
2>. 查看磁盘组信息
select name,path,total_mb,free_mb,failgroup from v$asm_disk order by name
ALTER DISKGROUP DSKGRP2 ADD DISK '/oracle/oradata/asmdisk04';
set lines 200 pages 80
col name for a20
col path for a40
select name,path,STATE,total_mb,free_mb,failgroup from v$asm_disk order by name;
NAME PATH TOTAL_MB FREE_MB FAILGROUP
-------------------- ---------------------------- --------- ---------- ----------------
ARCHGROUP_0000 /oracle/oradata/asmdisk09 1024 927 ARCHGROUP_0000
ARCHGROUP_0001 /oracle/oradata/asmdisk10 1024 927 ARCHGROUP_0001
DSKGRP1_0000 /oracle/oradata/asmdisk01 1024 566 CONTROLLER1
DSKGRP1_0001 /oracle/oradata/asmdisk02 1024 568 CONTROLLER1
DSKGRP1_0002 /oracle/oradata/asmdisk05 1024 567 CONTROLLER2
DSKGRP1_0003 /oracle/oradata/asmdisk06 1024 567 CONTROLLER2
DSKGRP2_0000 /oracle/oradata/asmdisk03 1024 998 DSKGRP2_0000
DSKGRP2_0001 /oracle/oradata/asmdisk07 1024 999 DSKGRP2_0001
DSKGRP2_0002 /oracle/oradata/asmdisk04 1024 1020 DSKGRP2_0002
/oracle/oradata/asmdisk08 1024 0
select name,state from v$asm_diskgroup;
NAME STATE
------------------------------------------------------------ ----------------------
ARCHGROUP MOUNTED
DSKGRP1 MOUNTED
DSKGRP2 MOUNTED
3>. 备份相关信息
关闭所有数据库及实例
dd if='/oracle/oradata/asmdisk04' of='/tmp/asmdisk04.head' bs=4096 count=1
kfed read /oracle/oradata/asmdisk03 > asmdisk03.old.txt
kfed read /oracle/oradata/asmdisk07 > asmdisk07.old.txt
kfed read /oracle/oradata/asmdisk04 > asmdisk04.old.txt
4>. 破坏asmdisk04
dd if=/dev/zero of=/oracle/oradata/asmdisk04 bs=4096 count=1
启动ASM
SQL> alter diskgroup all mount;
alter diskgroup all mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15040: diskgroup is incomplete
ORA-15042: ASM disk "2" is missing
同时检查ASM警告日志
NOTE: cache dismounting group 3/0x9492CD17 (DSKGRP2)
NOTE: dbwr not being msg'd to dismount
ERROR: diskgroup DSKGRP2 was not mounted
select name,state from v$asm_diskgroup;
NAME STATE
------------------------------------------------------------ ----------------------
ARCHGROUP MOUNTED
DSKGRP1 MOUNTED
DSKGRP2 DISMOUNTED
5>. 修复磁盘组
查找那块盘上有File Directory信息
kfdhdb.f1b1locn
kf3.h /* File Directory blk 1 AU num */
Beginging for file directory
kfed read /oracle/oradata/asmdisk03 | grep f1b1
kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002
kfed read /oracle/oradata/asmdisk07 | grep f1b1
kfdhdb.f1b1locn: 0 ; 0x0d4: 0x00000000
kfed read /oracle/oradata/asmdisk04 | grep f1b1
kfdhdb.f1b1locn不为0表示该块记录有file direcotry信息
kfed read /oracle/oradata/asmdisk03 aunum=2 | grep kfbh.type
kfbh.type: 5 ; 0x002: KFBTYP_LISTHEAD
kfed read /oracle/oradata/asmdisk07 aunum=2 blknum=0 > asmdisk07_crestmp.txt
find :
kfddde[2].crestmp.hi: 32920276 ; 0x3f8: HOUR=0x14 DAYS=0x16 MNTH=0x4 YEAR=0x7d9
kfddde[2].crestmp.lo: 2349526016 ; 0x3fc: USEC=0x0 MSEC=0x2bb SECS=0x0 MINS=0x23
kfed read /oracle/oradata/asmdisk07 > asmdisk04.new.txt
modify
kfdhdb.dsknum: 1 ; 0x024: 0x0001
kfdhdb.dskname: DSKGRP2_0001 ; 0x028: length=12
kfdhdb.fgname: DSKGRP2_0001 ; 0x068: length=12
to
kfdhdb.dsknum: 2 ; 0x024: 0x0001
kfdhdb.dskname: DSKGRP2_0002 ; 0x028: length=12
kfdhdb.fgname: DSKGRP2_0002 ; 0x068: length=12
modify
kfbh.block.obj: 2147483649 ; 0x008: TYPE=0x8 NUMB=0x1
to
kfbh.block.obj: 2147483650 ; 0x008: TYPE=0x8 NUMB=0x1
modify
kfdhdb.crestmp.hi: 32920270 ; 0x0a8: HOUR=0xe DAYS=0x16 MNTH=0x4 YEAR=0x7d9
kfdhdb.crestmp.lo: 3624518656 ; 0x0ac: USEC=0x0 MSEC=0x271 SECS=0x0 MINS=0x36
to
kfdhdb.crestmp.hi: 32920276 ; 0x3f8: HOUR=0x14 DAYS=0x16 MNTH=0x4 YEAR=0x7d9
kfdhdb.crestmp.lo: 2349526016 ; 0x3fc: USEC=0x0 MSEC=0x2bb SECS=0x0 MINS=0x23
kfed merge /oracle/oradata/asmdisk04 text=asmdisk04.new.txt
SQL> alter diskgroup DSKGRP2 mount;
Diskgroup altered.
ref:
http://blueocean926.itpub.net/post/38439/484030