日期:2014-05-16  浏览次数:20591 次

oracle asm 磁盘头数据以及备份与恢复基础篇(二)

  今天是2014-03-11,对于Oracle asm的元数据分为固定源数据和逻辑源数据,固定源数据一般占用磁盘的前两个au,其中内容包括disk header 、allocation table(AT)、free space table(FST)、(partnership status table(PST),逻辑源数据是存在asm 文件中包括的一些信息:

一:工具使用:

查看磁盘元数据通常考虑使用kfed工具,但是该工具和bbed类似,需要自动编译才可使用:

编译生成工具:

[root@oracle-one ~]# su - grid
-bash-4.1$ cd /ginf/grid/product/11.2.0/grid_1/rdbms/
-bash-4.1$ cd lib
-bash-4.1$ make -f ins_rdbms.mk ikfed

Linking KFED utility (kfed)
rm -f /ginf/grid/product/11.2.0/grid_1/rdbms/lib/kfed
gcc -o /ginf/grid/product/11.2.0/grid_1/rdbms/lib/kfed -m64 -z noexecstack -L/ginf/grid/product/11.2.0/grid_1/rdbms/lib/ -L/ginf/grid/product/11.2.0/grid_1/lib/ -L/ginf/grid/product/11.2.0/grid_1/lib/stubs/  /ginf/grid/product/11.2.0/grid_1/lib/s0main.o /ginf/grid/product/11.2.0/grid_1/rdbms/lib/sskfeded.o /ginf/grid/product/11.2.0/grid_1/rdbms/lib/skfedpt.o -ldbtools11 -lcommon11 -lcell11 -lskgxp11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -locr11 -locrb11 -locrutl11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11  -lasmclnt11 -lclntsh  `cat /ginf/grid/product/11.2.0/grid_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /ginf/grid/product/11.2.0/grid_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lclient11 -lnnetd11  -lvsn11 -lcommon11 -lgeneric11 -lmm -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /ginf/grid/product/11.2.0/grid_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /ginf/grid/product/11.2.0/grid_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lclient11 -lnnetd11  -lvsn11 -lcommon11 -lgeneric11   -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lnnetd11  -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11   `cat /ginf/grid/product/11.2.0/grid_1/lib/sysliblist` -Wl,-rpath,/ginf/grid/product/11.2.0/grid_1/lib -lm    `cat /ginf/grid/product/11.2.0/grid_1/lib/sysliblist` -ldl -lm   -L/ginf/grid/product/11.2.0/grid_1/lib
test ! -f /ginf/grid/product/11.2.0/grid_1/bin/kfed ||\
           mv -f /ginf/grid/product/11.2.0/grid_1/bin/kfed /ginf/grid/product/11.2.0/grid_1/bin/kfedO
mv /ginf/grid/product/11.2.0/grid_1/rdbms/lib/kfed /ginf/grid/product/11.2.0/grid_1/bin/kfed
chmod 751 /ginf/grid/product/11.2.0/grid_1/bin/kfed
-bash-4.1$ 
-bash-4.1$ kfed -help
as/mlib         ASM Library [asmlib='lib']
aun/um          AU number to examine or update [AUNUM=number]
aus/z           Allocation Unit size in bytes [AUSZ=number]
blkn/um         Block number to examine or update [BLKNUM=number]
blks/z          Metadata block size in bytes [BLKSZ=number]
ch/ksum         Update checksum before each write [CHKSUM=YES/NO]
cn/t            Count of AUs to process [CNT=number]
de/v            ASM device to examine or update [DEV=string]
dm/pall         Don'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/rovnm         Name for provisioning purposes [PROVNM=string]
s/eek           AU number to seek to [SEEK=number]
te/xt           File name for translated block text [TEXT=string]
ty/pe           ASM metadata block type number [TYPE=number]
-bash-4.1$ which kfed
/ginf/grid/product/11.2.0/grid_1/bin/kfed


通过help可以看出,kfed工具operation type有 read,write,dumping ,repare,new,from ,find,struct功能。

二、查看源数据:

asm 磁盘有个磁盘头(disk header)占用磁盘的第一个au的第一个block。查看如下:

eg:

-bash-4.1$ kfed read /dev/oracleasm/disks/ASMDISK2 a