Oracle 11g asm中不同au size下datafile的au分布初探

今天有朋友问11g中asm 的au size不为1m的情况下,datafile的au 分布是怎么样的?通过10g的方式去kfed read,
发现不对了,原帖地址:~~【高手请进】在oracle11g中通过kfed找到ASM AU空间分布信息?

下午花了一点时间研究了一下,其中还有些没有明白,不过基本上搞清楚了,下面是简单的实验过程:

开始我也没明白其中的关系,首先尝试用strace 去跟踪amdu的过程,我们知道amdu是可以直接抽取datafile的,开始
我是这样想的:既然amdu在读取asm disk的时候,可以直接将文件读取出来,那么也就比如需要现在知道该datafile的
au 分布情况,于是我使用strace 进行跟踪,完全没有搞明白,如下:
命令如下:strace -o amdu.log amdu -dis ‘/dev/sdb’ -extract data2.256
其中产生的部分log信息如下:

stat64("/dev/sdb", {st_mode=S_IFBLK|0777, st_rdev=makedev(8, 16), ...}) = 0
access("/dev/sdb", F_OK)                = 0
statfs("/dev/sdb", {f_type=0x1021994, f_bsize=4096, f_blocks=129388, f_bfree=129358, f_bavail=129358, f_files=129388, f_ffree=128781, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
open("/dev/sdb", O_RDWR|O_LARGEFILE)    = 7
mmap2(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb759d000     --257   
_llseek(7, 0, [0], SEEK_SET)            = 0
read(7, "\1\202\1\1\0\0\0\0\0\0\0\200\2519\325\222\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
_llseek(7, 1048576, [1048576], SEEK_SET) = 0               --256
read(7, "\1\202\3\1\0\1\0\0\0\0\0\200\241?\303\257\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
_llseek(7, 2097152, [2097152], SEEK_SET) = 0                --512
read(7, "\1\202\3\1\0\2\0\0\0\0\0\200\241\374\301\257\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
_llseek(7, 3145728, [3145728], SEEK_SET) = 0                --768
read(7, "\1\202\3\1\0\3\0\0\0\0\0\200\241\275\307\257\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576
stat64("/dev/sdb", {st_mode=S_IFBLK|0777, st_rdev=makedev(8, 16), ...}) = 0
access("/dev/sdb", F_OK)                = 0
statfs("/dev/sdb", {f_type=0x1021994, f_bsize=4096, f_blocks=129388, f_bfree=129358, f_bavail=129358, f_files=129388, f_ffree=128781, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
open("/dev/sdb", O_RDWR|O_LARGEFILE)    = 8
_llseek(8, 8384512, [8384512], SEEK_SET) = 0             ---2047
read(8, "\1\202\23\1\377\7\0\0\0\0\0\200_\204\324\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
open("/home/ora11g/11.2/grid/rdbms/mesg/amduus.msb", O_RDONLY) = 9
fcntl64(9, F_SETFD, FD_CLOEXEC)         = 0
lseek(9, 0, SEEK_SET)                   = 0
read(9, "\25\23\"\1\23\3\t\t\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 256) = 256
lseek(9, 512, SEEK_SET)                 = 512
read(9, "Z\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(9, 1024, SEEK_SET)                = 1024
read(9, "\311\0\323\0/\1\223\1Z\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(9, 2048, SEEK_SET)                = 2048
read(9, "\n\0\312\0\1\0D\0\313\0\1\0\\\0\314\0\1\0\200\0\315\0\1\0\257\0\316\0\2\0\333\0"..., 512) = 512
lseek(9, 512, SEEK_SET)                 = 512
read(9, "Z\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(9, 1024, SEEK_SET)                = 1024
read(9, "\311\0\323\0/\1\223\1Z\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(9, 1536, SEEK_SET)                = 1536
read(9, "\f\0d\0\0\0P\0e\0\1\0q\0f\0\1\0\244\0g\0\1\0\315\0h\0\2\0\334\0"..., 512) = 512
write(2, "AMDU-00204: Disk N0001 is in cur"..., 63) = 63
write(2, "AMDU-00201: Disk N0001: '/dev/sd"..., 35) = 35
write(4, "AMDU-00204: Disk N0001 is in cur"..., 63) = 63
write(4, "AMDU-00201: Disk N0001: '/dev/sd"..., 35) = 35
write(4, "** HEARTBEAT DETECTED **\n", 25) = 25
munmap(0xb759d000, 1052672)             = 0
close(7)                                = 0
close(8)                                = 0
write(4, "           Allocated AU's: 24\n", 30) = 30   ---这里其实是比较关键的,到这里为止,amdu起码就知道了au的分布情况了。
write(4, "                Free AU's: 488\n", 31) = 31
write(4, "       AU's read for dump: 0\n", 29) = 29
write(4, "       Block images saved: 0\n", 29) = 29
write(4, "        Map lines written: 0\n", 29) = 29
write(4, "          Heartbeats seen: 1\n", 29) = 29
write(4, "  Corrupt metadata blocks: 0\n", 29) = 29
write(4, "        Corrupt AT blocks: 0\n", 29) = 29
write(4, "\n", 1)                       = 1
write(4, "\n", 1)                       = 1
write(4, "------------------------ SUMMARY"..., 79) = 79
write(4, "           Allocated AU's: 24\n", 30) = 30
write(4, "                Free AU's: 488\n", 31) = 31
write(4, "       AU's read for dump: 0\n", 29) = 29
write(4, "       Block images saved: 0\n", 29) = 29
write(4, "        Map lines written: 0\n", 29) = 29
write(4, "          Heartbeats seen: 1\n", 29) = 29
write(4, "  Corrupt metadata blocks: 0\n", 29) = 29
write(4, "        Corrupt AT blocks: 0\n", 29) = 29
write(4, "\n", 1)                       = 1

首先来看看statfs部分:

statfs("/dev/sdb", {f_type=0x1021994, f_bsize=4096, f_blocks=129388, f_bfree=129358, f_bavail=129358, f_files=129388,
 f_ffree=128781, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
 
该函数的结构:
 
int statfs(const char *path, struct statfs *buf);
 
该函数的详细参数解析:
struct statfs {
 long f_type; /* 文件系统类型 */
 long f_bsize; /* 经过优化的传输块大小 */
 long f_blocks; /* 文件系统数据块总数 */
 long f_bfree; /* 可用块数 */
 long f_bavail; /* 非超级用户可获取的块数 */
 long f_files; /* 文件结点总数 */
 long f_ffree; /* 可用文件结点数 */
 fsid_t f_fsid; /* 文件系统标识 */
 long f_namelen; /* 文件名的最大长度 */
 };
 
从上面可以得出整个/dev/sdb的情况如下:
 
block大小为4096;
总的block为:129388个
可用的block为:129358  ---所以用掉的block也就是30个。
 
关于llseek函数:
_llseek(8, 8384512, [8384512], SEEK_SET) = 0    
 
关于该函数的描述为:_llseek - reposition read/write file offset
 
8384512 指的是offset,由于block大小为4096,所以8384512/4096=2047

全文请参见原地址: Oracle 11g asm中不同au size下datafile的au分布初探

  

你可能感兴趣的:(oracle 11g)