oracle asm剖析系列(6)–template directory
本站文章除注明转载外,均为本站原创: 转载自love wife love life —Roger的Oracle/MySQL/PostgreSQL数据恢复博客
前面关于oracle asm 剖析系列已经进行了5篇,这将是第6篇。这篇的主要是内容是关于asm file 5,
也就是asm template,即asm 模板。asm中默认就存在众多模板,每种模板针对不同类似的文件。如下
来自oracle 10gR2和11gR2版本的查询结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
---10.2 SQL> select * from V$ASM_TEMPLATE; GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME ------------ ------------ ------ ------ - ------------------------------ 1 0 UNPROT COARSE Y PARAMETERFILE 1 1 UNPROT COARSE Y DUMPSET 1 2 UNPROT FINE Y CONTROLFILE 1 3 UNPROT COARSE Y ARCHIVELOG 1 4 UNPROT FINE Y ONLINELOG 1 5 UNPROT COARSE Y DATAFILE 1 6 UNPROT COARSE Y TEMPFILE 1 7 UNPROT COARSE Y BACKUPSET 1 8 UNPROT COARSE Y AUTOBACKUP 1 9 UNPROT COARSE Y XTRANSPORT 1 10 UNPROT COARSE Y CHANGETRACKING 1 11 UNPROT FINE Y FLASHBACK 1 12 UNPROT COARSE Y DATAGUARDCONFIG 13 rows selected. 你看到冗余的一列,显示的是unprot,即是不支持。 ---11.2 SQL> select * from V$ASM_TEMPLATE order by 2; GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME PRIM MIRR ------------ ------------ ------ ------ - ------------------------------ ---- ---- 2 0 UNPROT COARSE Y PARAMETERFILE COLD COLD 2 1 UNPROT COARSE Y ASMPARAMETERFILE COLD COLD 2 3 UNPROT COARSE Y DUMPSET COLD COLD 2 4 UNPROT FINE Y CONTROLFILE COLD COLD 2 5 UNPROT COARSE Y FLASHFILE COLD COLD 2 6 UNPROT COARSE Y ARCHIVELOG COLD COLD 2 7 UNPROT COARSE Y ONLINELOG COLD COLD 2 8 UNPROT COARSE Y DATAFILE COLD COLD 2 9 UNPROT COARSE Y TEMPFILE COLD COLD 2 10 UNPROT COARSE Y BACKUPSET COLD COLD 2 11 UNPROT COARSE Y AUTOBACKUP COLD COLD 2 12 UNPROT COARSE Y XTRANSPORT COLD COLD 2 13 UNPROT COARSE Y CHANGETRACKING COLD COLD 2 14 UNPROT COARSE Y FLASHBACK COLD COLD 2 15 UNPROT COARSE Y DATAGUARDCONFIG COLD COLD 2 16 UNPROT COARSE Y OCRFILE COLD COLD 1 60 UNPROT COARSE Y PARAMETERFILE COLD COLD 1 61 UNPROT COARSE Y ASMPARAMETERFILE COLD COLD 1 63 UNPROT COARSE Y DUMPSET COLD COLD 1 64 UNPROT FINE Y CONTROLFILE COLD COLD 1 65 UNPROT COARSE Y FLASHFILE COLD COLD 1 66 UNPROT COARSE Y ARCHIVELOG COLD COLD 1 67 UNPROT COARSE Y ONLINELOG COLD COLD 1 68 UNPROT COARSE Y DATAFILE COLD COLD 1 69 UNPROT COARSE Y TEMPFILE COLD COLD 1 170 UNPROT COARSE Y BACKUPSET COLD COLD 1 171 UNPROT COARSE Y AUTOBACKUP COLD COLD 1 172 UNPROT COARSE Y XTRANSPORT COLD COLD 1 173 UNPROT COARSE Y CHANGETRACKING COLD COLD 1 174 UNPROT COARSE Y FLASHBACK COLD COLD 1 175 UNPROT COARSE Y DATAGUARDCONFIG COLD COLD 1 176 UNPROT COARSE Y OCRFILE COLD COLD 32 rows selected. |
首先我们来看看关于template的相关操作,例如创建一个新的template 模板:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
SQL> alter diskgroup data1 drop disk DATA1_0003; Diskgroup altered. SQL> alter diskgroup data1 drop disk DATA1_0002; Diskgroup altered. SQL> create diskgroup data2 normal REDUNDANCY disk '/dev/sdb','/dev/sde'; Diskgroup created. SQL> SELECT 2 NVL(a.name, '[CANDIDATE]') disk_group_name 3 , b.path disk_file_path 4 , b.name disk_file_name 5 , b.failgroup disk_file_fail_group 6 , b.total_mb total_mb 7 , (b.total_mb - b.free_mb) used_mb 8 , ROUND((1- (b.free_mb / b.total_mb))*100, 2) pct_used 9 FROM 10 v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number) 11 ORDER BY 12 a.name 13 / Disk Group Name Path File Name Fail Group File Size (MB) Used Size (MB) Pct. Used -------------------- ----------------- -------------------- -------------------- -------------- -------------- --------- DATA1 /dev/sdd DATA1_0000 DATA1_0000 1,024 519 50.68 /dev/sdc DATA1_0001 DATA1_0001 1,024 519 50.68 ******************** -------------- -------------- 2,048 1,038 DATA2 /dev/sdb DATA2_0000 DATA2_0000 1,024 51 4.98 /dev/sde DATA2_0001 DATA2_0001 1,024 51 4.98 ******************** -------------- -------------- 2,048 102 -------------- -------------- Grand Total: 4,096 1,140 SQL> SELECT 2 name group_name 3 , sector_size sector_size 4 , block_size block_size 5 , allocation_unit_size allocation_unit_size 6 , state state 7 , type type 8 , total_mb total_mb 9 , (total_mb - free_mb) used_mb 10 , ROUND((1- (free_mb / total_mb))*100, 2) pct_used 11 FROM 12 v$asm_diskgroup 13 ORDER BY 14 name 15 / Disk Group Sector Block Allocation Name Size Size Unit Size State Type File Size (MB) Used Size (MB) Pct. Used -------------------- ------- ------- ------------ ----------- ------ -------------- -------------- --------- DATA1 512 4,096 1,048,576 MOUNTED EXTERN 2,048 1,038 50.68 DATA2 512 4,096 1,048,576 MOUNTED NORMAL 2,048 102 4.98 -------------- -------------- Grand Total: 4,096 1,140 +++++++++++++创建一个test表空间到data2 diskgroup上: ---asm instance SQL> show parameter type NAME Type VALUE ------------------------------------ ------ ------------------------------ instance_type string asm plsql_code_type string INTERPRETED SQL> alter diskgroup data2 add template test_template attributes (coarse); Diskgroup altered. SQL> SQL> select * from v$asm_template; GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME ------------ ------------ ------ ------ - ------------------------------ 1 0 UNPROT COARSE Y PARAMETERFILE 1 1 UNPROT COARSE Y DUMPSET 1 2 UNPROT FINE Y CONTROLFILE 1 3 UNPROT COARSE Y ARCHIVELOG 1 4 UNPROT FINE Y ONLINELOG 1 5 UNPROT COARSE Y DATAFILE 1 6 UNPROT COARSE Y TEMPFILE 1 7 UNPROT COARSE Y BACKUPSET 1 8 UNPROT COARSE Y AUTOBACKUP 1 9 UNPROT COARSE Y XTRANSPORT 1 10 UNPROT COARSE Y CHANGETRACKING 1 11 UNPROT FINE Y FLASHBACK 1 12 UNPROT COARSE Y DATAGUARDCONFIG 2 0 MIRROR COARSE Y PARAMETERFILE 2 1 MIRROR COARSE Y DUMPSET 2 2 HIGH FINE Y CONTROLFILE 2 3 MIRROR COARSE Y ARCHIVELOG 2 4 MIRROR FINE Y ONLINELOG 2 5 MIRROR COARSE Y DATAFILE 2 6 MIRROR COARSE Y TEMPFILE 2 7 MIRROR COARSE Y BACKUPSET 2 8 MIRROR COARSE Y AUTOBACKUP 2 9 MIRROR COARSE Y XTRANSPORT 2 10 MIRROR COARSE Y CHANGETRACKING 2 11 MIRROR FINE Y FLASHBACK 2 12 MIRROR COARSE Y DATAGUARDCONFIG 2 13 MIRROR COARSE N TEST_TEMPLATE 27 rows selected. ----database instance SQL> show parameter type NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ instance_type string RDBMS plsql_code_type string INTERPRETED SQL> create tablespace test datafile '+data2(test_template)' size 5m; Tablespace created. SQL> |
回到主题上来,我这里仍然以10gR2 版本为例,通过如下查询我们知道asm template directory信息在file 5中:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
SQL> select number_kffxp file#, disk_kffxp disk#, count(disk_kffxp) extents 2 from x$kffxp 3 where group_kffxp=1 4 and disk_kffxp <> 65534 5 group by number_kffxp, disk_kffxp; FILE# DISK# EXTENTS ---------- ---------- ---------- 1 0 1 1 1 1 2 1 1 3 0 21 3 1 21 4 0 1 4 1 1 5 0 1 ---这就是template directory 6 0 1 256 0 240 .......... |
既然我们知道template是file 5,那么其元数据也就在第file directory 的第5个block,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
[oracle@10gasm ~]$ kfed read /dev/sdb aun=2 blkn=5 |more kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 4 ; 0x002: KFBTYP_FILEDIR kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 5 ; 0x004: T=0 NUMB=0x5 kfbh.block.obj: 1 ; 0x008: TYPE=0x0 NUMB=0x1 kfbh.check: 3972293368 ; 0x00c: 0xecc462f8 kfbh.fcn.base: 0 ; 0x010: 0x00000000 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfffdb.node.incarn: 1 ; 0x000: A=1 NUMM=0x0 kfffdb.node.frlist.number: 4294967295 ; 0x004: 0xffffffff kfffdb.node.frlist.incarn: 0 ; 0x008: A=0 NUMM=0x0 kfffdb.hibytes: 0 ; 0x00c: 0x00000000 kfffdb.lobytes: 1048576 ; 0x010: 0x00100000 kfffdb.xtntcnt: 3 ; 0x014: 0x00000003 kfffdb.xtnteof: 3 ; 0x018: 0x00000003 kfffdb.blkSize: 4096 ; 0x01c: 0x00001000 kfffdb.flags: 1 ; 0x020: O=1 S=0 S=0 D=0 C=0 I=0 R=0 A=0 kfffdb.fileType: 15 ; 0x021: 0x0f kfffdb.dXrs: 19 ; 0x022: SCHE=0x1 NUMB=0x3 kfffdb.iXrs: 19 ; 0x023: SCHE=0x1 NUMB=0x3 kfffdb.dXsiz[0]: 4294967295 ; 0x024: 0xffffffff kfffdb.dXsiz[1]: 0 ; 0x028: 0x00000000 kfffdb.dXsiz[2]: 0 ; 0x02c: 0x00000000 kfffdb.iXsiz[0]: 4294967295 ; 0x030: 0xffffffff kfffdb.iXsiz[1]: 0 ; 0x034: 0x00000000 kfffdb.iXsiz[2]: 0 ; 0x038: 0x00000000 kfffdb.xtntblk: 3 ; 0x03c: 0x0003 kfffdb.break: 60 ; 0x03e: 0x003c kfffdb.priZn: 0 ; 0x040: 0x00 kfffdb.secZn: 0 ; 0x041: 0x00 kfffdb.ub2spare: 0 ; 0x042: 0x0000 kfffdb.alias[0]: 4294967295 ; 0x044: 0xffffffff kfffdb.alias[1]: 4294967295 ; 0x048: 0xffffffff kfffdb.strpwdth: 0 ; 0x04c: 0x00 kfffdb.strpsz: 0 ; 0x04d: 0x00 kfffdb.usmsz: 0 ; 0x04e: 0x0000 kfffdb.crets.hi: 32982470 ; 0x050: HOUR=0x6 DAYS=0xe MNTH=0x1 YEAR=0x7dd kfffdb.crets.lo: 330584064 ; 0x054: USEC=0x0 MSEC=0x114 SECS=0x3b MINS=0x4 kfffdb.modts.hi: 32982470 ; 0x058: HOUR=0x6 DAYS=0xe MNTH=0x1 YEAR=0x7dd kfffdb.modts.lo: 330584064 ; 0x05c: USEC=0x0 MSEC=0x114 SECS=0x3b MINS=0x4 kfffdb.spare[0]: 0 ; 0x060: 0x00000000 ........ kfffdb.spare[14]: 0 ; 0x098: 0x00000000 kfffdb.spare[15]: 0 ; 0x09c: 0x00000000 kfffdb.usm: ; 0x0a0: length=0 kfffde[0].xptr.au: 49 ; 0x4a0: 0x00000031 kfffde[0].xptr.disk: 0 ; 0x4a4: 0x0000 kfffde[0].xptr.flags: 0 ; 0x4a6: L=0 E=0 D=0 C=0 S=0 kfffde[0].xptr.chk: 27 ; 0x4a7: 0x1b kfffde[1].xptr.au: 49 ; 0x4a8: 0x00000031 kfffde[1].xptr.disk: 1 ; 0x4ac: 0x0001 kfffde[1].xptr.flags: 0 ; 0x4ae: L=0 E=0 D=0 C=0 S=0 kfffde[1].xptr.chk: 26 ; 0x4af: 0x1a kfffde[2].xptr.au: 4294967294 ; 0x4b0: 0xfffffffe ........ |
继续读取AU 49,得到如下结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
[oracle@10gasm ~]$ kfed read /dev/sdb aun=49 blkn=0 |more kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 10 ; 0x002: KFBTYP_TMPLTDIR kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0 kfbh.block.obj: 5 ; 0x008: TYPE=0x0 NUMB=0x5 kfbh.check: 1227264929 ; 0x00c: 0x492693a1 kfbh.fcn.base: 580 ; 0x010: 0x00000244 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kffdnd.bnode.incarn: 1 ; 0x000: A=1 NUMM=0x0 kffdnd.bnode.frlist.number: 4294967295 ; 0x004: 0xffffffff kffdnd.bnode.frlist.incarn: 0 ; 0x008: A=0 NUMM=0x0 kffdnd.overfl.number: 4294967295 ; 0x00c: 0xffffffff kffdnd.overfl.incarn: 0 ; 0x010: A=0 NUMM=0x0 kffdnd.parent.number: 0 ; 0x014: 0x00000000 kffdnd.parent.incarn: 1 ; 0x018: A=1 NUMM=0x0 kffdnd.fstblk.number: 0 ; 0x01c: 0x00000000 kffdnd.fstblk.incarn: 1 ; 0x020: A=1 NUMM=0x0 kftmde[0].entry.incarn: 1 ; 0x024: A=1 NUMM=0x0 kftmde[0].entry.hash: 616561 ; 0x028: 0x00096871 kftmde[0].entry.refer.number:4294967295 ; 0x02c: 0xffffffff kftmde[0].entry.refer.incarn: 0 ; 0x030: A=0 NUMM=0x0 kftmde[0].templ.name: PARAMETERFILE ; 0x034: length=13 kftmde[0].templ.flags: 4 ; 0x054: S=0 S=0 S=1 kftmde[0].templ.redun: 18 ; 0x058: SCHE=0x1 NUMB=0x2 kftmde[0].templ.strpwdth: 8 ; 0x059: 0x08 kftmde[0].templ.strpsz: 17 ; 0x05a: 0x11 kftmde[0].templ.priZn: 0 ; 0x05b: 0x00 kftmde[0].templ.secZn: 0 ; 0x05c: 0x00 kftmde[0].templ.ub1spare: 0 ; 0x05d: 0x00 kftmde[0].templ.ub2spare: 0 ; 0x05e: 0x0000 kftmde[0].templ.dXsiz[0]: 4294967295 ; 0x060: 0xffffffff kftmde[0].templ.dXsiz[1]: 0 ; 0x064: 0x00000000 kftmde[0].templ.dXsiz[2]: 0 ; 0x068: 0x00000000 kftmde[0].templ.iXsiz[0]: 4294967295 ; 0x06c: 0xffffffff kftmde[0].templ.iXsiz[1]: 0 ; 0x070: 0x00000000 kftmde[0].templ.iXsiz[2]: 0 ; 0x074: 0x00000000 kftmde[0].templ.entry: 0 ; 0x078: 0x00000000 kftmde[0].templ.idx: 0 ; 0x07c: 0x00000000 kftmde[0].templ.spare[0]: 0 ; 0x080: 0x00000000 ........ kftmde[0].templ.spare[10]: 0 ; 0x0a8: 0x00000000 kftmde[1].entry.incarn: 1 ; 0x0ac: A=1 NUMM=0x0 kftmde[1].entry.hash: 9498 ; 0x0b0: 0x0000251a kftmde[1].entry.refer.number:4294967295 ; 0x0b4: 0xffffffff kftmde[1].entry.refer.incarn: 0 ; 0x0b8: A=0 NUMM=0x0 kftmde[1].templ.name: DUMPSET ; 0x0bc: length=7 kftmde[1].templ.flags: 4 ; 0x0dc: S=0 S=0 S=1 kftmde[1].templ.redun: 18 ; 0x0e0: SCHE=0x1 NUMB=0x2 kftmde[1].templ.strpwdth: 8 ; 0x0e1: 0x08 kftmde[1].templ.strpsz: 17 ; 0x0e2: 0x11 kftmde[1].templ.priZn: 0 ; 0x0e3: 0x00 kftmde[1].templ.secZn: 0 ; 0x0e4: 0x00 kftmde[1].templ.ub1spare: 0 ; 0x0e5: 0x00 kftmde[1].templ.ub2spare: 0 ; 0x0e6: 0x0000 kftmde[1].templ.dXsiz[0]: 4294967295 ; 0x0e8: 0xffffffff kftmde[1].templ.dXsiz[1]: 0 ; 0x0ec: 0x00000000 kftmde[1].templ.dXsiz[2]: 0 ; 0x0f0: 0x00000000 kftmde[1].templ.iXsiz[0]: 4294967295 ; 0x0f4: 0xffffffff kftmde[1].templ.iXsiz[1]: 0 ; 0x0f8: 0x00000000 kftmde[1].templ.iXsiz[2]: 0 ; 0x0fc: 0x00000000 kftmde[1].templ.entry: 0 ; 0x100: 0x00000000 kftmde[1].templ.idx: 0 ; 0x104: 0x00000000 kftmde[1].templ.spare[0]: 0 ; 0x108: 0x00000000 ........ kftmde[1].templ.spare[10]: 0 ; 0x130: 0x00000000 kftmde[2].entry.incarn: 1 ; 0x134: A=1 NUMM=0x0 kftmde[2].entry.hash: 149841 ; 0x138: 0x00024951 kftmde[2].entry.refer.number:4294967295 ; 0x13c: 0xffffffff kftmde[2].entry.refer.incarn: 0 ; 0x140: A=0 NUMM=0x0 kftmde[2].templ.name: CONTROLFILE ; 0x144: length=11 kftmde[2].templ.flags: 5 ; 0x164: S=1 S=0 S=1 kftmde[2].templ.redun: 19 ; 0x168: SCHE=0x1 NUMB=0x3 kftmde[2].templ.strpwdth: 8 ; 0x169: 0x08 kftmde[2].templ.strpsz: 17 ; 0x16a: 0x11 kftmde[2].templ.priZn: 0 ; 0x16b: 0x00 kftmde[2].templ.secZn: 0 ; 0x16c: 0x00 kftmde[2].templ.ub1spare: 0 ; 0x16d: 0x00 kftmde[2].templ.ub2spare: 0 ; 0x16e: 0x0000 kftmde[2].templ.dXsiz[0]: 4294967295 ; 0x170: 0xffffffff kftmde[2].templ.dXsiz[1]: 0 ; 0x174: 0x00000000 kftmde[2].templ.dXsiz[2]: 0 ; 0x178: 0x00000000 kftmde[2].templ.iXsiz[0]: 4294967295 ; 0x17c: 0xffffffff kftmde[2].templ.iXsiz[1]: 0 ; 0x180: 0x00000000 kftmde[2].templ.iXsiz[2]: 0 ; 0x184: 0x00000000 kftmde[2].templ.entry: 0 ; 0x188: 0x00000000 kftmde[2].templ.idx: 0 ; 0x18c: 0x00000000 kftmde[2].templ.spare[0]: 0 ; 0x190: 0x00000000 ........... kftmde[2].templ.spare[10]: 0 ; 0x1b8: 0x00000000 kftmde[3].entry.incarn: 1 ; 0x1bc: A=1 NUMM=0x0 kftmde[3].entry.hash: 72253 ; 0x1c0: 0x00011a3d kftmde[3].entry.refer.number:4294967295 ; 0x1c4: 0xffffffff kftmde[3].entry.refer.incarn: 0 ; 0x1c8: A=0 NUMM=0x0 kftmde[3].templ.name: ARCHIVELOG ; 0x1cc: length=10 kftmde[3].templ.flags: 4 ; 0x1ec: S=0 S=0 S=1 kftmde[3].templ.redun: 18 ; 0x1f0: SCHE=0x1 NUMB=0x2 kftmde[3].templ.strpwdth: 8 ; 0x1f1: 0x08 kftmde[3].templ.strpsz: 17 ; 0x1f2: 0x11 kftmde[3].templ.priZn: 0 ; 0x1f3: 0x00 kftmde[3].templ.secZn: 0 ; 0x1f4: 0x00 kftmde[3].templ.ub1spare: 0 ; 0x1f5: 0x00 kftmde[3].templ.ub2spare: 0 ; 0x1f6: 0x0000 kftmde[3].templ.dXsiz[0]: 4294967295 ; 0x1f8: 0xffffffff kftmde[3].templ.dXsiz[1]: 0 ; 0x1fc: 0x00000000 kftmde[3].templ.dXsiz[2]: 0 ; 0x200: 0x00000000 kftmde[3].templ.iXsiz[0]: 4294967295 ; 0x204: 0xffffffff kftmde[3].templ.iXsiz[1]: 0 ; 0x208: 0x00000000 kftmde[3].templ.iXsiz[2]: 0 ; 0x20c: 0x00000000 kftmde[3].templ.entry: 0 ; 0x210: 0x00000000 kftmde[3].templ.idx: 0 ; 0x214: 0x00000000 kftmde[3].templ.spare[0]: 0 ; 0x218: 0x00000000 ......... kftmde[3].templ.spare[10]: 0 ; 0x240: 0x00000000 ......... ......... kftmde[13].entry.incarn: 1 ; 0x70c: A=1 NUMM=0x0 kftmde[13].entry.hash: 657713 ; 0x710: 0x000a0931 kftmde[13].entry.refer.number:4294967295 ; 0x714: 0xffffffff kftmde[13].entry.refer.incarn: 0 ; 0x718: A=0 NUMM=0x0 kftmde[13].templ.name: TEST_TEMPLATE ; 0x71c: length=13 kftmde[13].templ.flags: 0 ; 0x73c: S=0 S=0 S=0 kftmde[13].templ.redun: 18 ; 0x740: SCHE=0x1 NUMB=0x2 kftmde[13].templ.strpwdth: 8 ; 0x741: 0x08 kftmde[13].templ.strpsz: 17 ; 0x742: 0x11 kftmde[13].templ.priZn: 0 ; 0x743: 0x00 kftmde[13].templ.secZn: 0 ; 0x744: 0x00 kftmde[13].templ.ub1spare: 0 ; 0x745: 0x00 kftmde[13].templ.ub2spare: 0 ; 0x746: 0x0000 kftmde[13].templ.dXsiz[0]: 4294967295 ; 0x748: 0xffffffff kftmde[13].templ.dXsiz[1]: 0 ; 0x74c: 0x00000000 kftmde[13].templ.dXsiz[2]: 0 ; 0x750: 0x00000000 kftmde[13].templ.iXsiz[0]: 4294967295 ; 0x754: 0xffffffff kftmde[13].templ.iXsiz[1]: 0 ; 0x758: 0x00000000 kftmde[13].templ.iXsiz[2]: 0 ; 0x75c: 0x00000000 kftmde[13].templ.entry: 0 ; 0x760: 0x00000000 kftmde[13].templ.idx: 0 ; 0x764: 0x00000000 kftmde[13].templ.spare[0]: 0 ; 0x768: 0x00000000 kftmde[13].templ.spare[1]: 0 ; 0x76c: 0x00000000 ......... |
可见,其实template directory的结构也很简单,主要是如下几部分:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
1) kfbh,头部信息,跟前面其他的文章描述的一样,不累述; 2) kffdnd,kffdnd,从上面输出的信息,我们不难猜测,这部分信息其实就是用来定位和描述block在目录树中的具体位置的。 跟前面描述disk directory的kffdnd结构是一样的,所以这里也不多说。 3) kftmde,这部分结构主要是包括template模板的详细信息,如条带大小,宽度等信息. 下面详细描述该部分内容: kftmde[0].entry.incarn: 1 ; 0x024: A=1 NUMM=0x0 kftmde[0].entry.hash: 616561 ; 0x028: 0x00096871 --hash值,无太大实际意义 kftmde[0].entry.refer.number:4294967295 ; 0x02c: 0xffffffff ---指向下一层的block号 kftmde[0].entry.refer.incarn: 0 ; 0x030: A=0 NUMM=0x0 kftmde[0].templ.name: PARAMETERFILE ; 0x034: length=13 --template模板名称 kftmde[0].templ.flags: 4 ; 0x054: S=0 S=0 S=1 --标志信息 kftmde[0].templ.redun: 18 ; 0x058: SCHE=0x1 NUMB=0x2 --表示冗余级别,17表示unprot,18表示MIRROR,19表示high. kftmde[0].templ.strpwdth: 8 ; 0x059: 0x08 ---表示条带宽度 kftmde[0].templ.strpsz: 17 ; 0x05a: 0x11 ---表示条带大小 kftmde[0].templ.priZn: 0 ; 0x05b: 0x00 kftmde[0].templ.secZn: 0 ; 0x05c: 0x00 kftmde[0].templ.ub1spare: 0 ; 0x05d: 0x00 ---下面这部分内容都没有什么实际意义 kftmde[0].templ.ub2spare: 0 ; 0x05e: 0x0000 kftmde[0].templ.dXsiz[0]: 4294967295 ; 0x060: 0xffffffff kftmde[0].templ.dXsiz[1]: 0 ; 0x064: 0x00000000 kftmde[0].templ.dXsiz[2]: 0 ; 0x068: 0x00000000 kftmde[0].templ.iXsiz[0]: 4294967295 ; 0x06c: 0xffffffff kftmde[0].templ.iXsiz[1]: 0 ; 0x070: 0x00000000 kftmde[0].templ.iXsiz[2]: 0 ; 0x074: 0x00000000 kftmde[0].templ.entry: 0 ; 0x078: 0x00000000 kftmde[0].templ.idx: 0 ; 0x07c: 0x00000000 kftmde[0].templ.spare[0]: 0 ; 0x080: 0x00000000 |
到这里,基本上asm template directory的结构大概描述完了,比较简单,而且这部分内容通常也不需要去关注,大家了解下即可。
上面提到了asm 条带,我这里就补充一点关于asm条带方面的内容。
在10g中,关于asm条带宽度和大小主要是由如下两个参数在空中:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
SQL> select * from V$version where rownum < 3; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod PL/SQL Release 10.2.0.1.0 - Production SQL> show parameter asm_strip NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ _asm_stripesize integer 131072 --默认是128k _asm_stripewidth integer 8 --8个条带大小 SQL> |
你会发现stripsize * stripwidth 恰好是1m,这也正是我们的AU size大小,而1m通常也是大多数操作系统所能达到的单次最大io量。
asm 的条带分为两种COARSE和FINE,也被称为粗条带和细条带。
粗条带,默认就等于你的AU size,比如我这里au size为1m,那么粗条带大小就是1m,这种情况下的条带,通常实用于连续性的大IO操作,例如全表扫描。
细条带,默认是128k,8个条带组成一个AU,这种条带类型通常适用于对于读写延迟比较敏感的文件,比如redo logfile,controlfile。
从我前面10gR2的查询结果可以看出,其中也就redo和controlfile以及flashback是fine类型的,其他的均为粗条带,下面我进行一个简单的分类:
1 2 3 4 5 6 7 8 9 10 11 |
---默认是粗条带模板 ---默认是细条带模板 PARAMETERFILE CONTROLFILE DUMPSET ONLINELOG ARCHIVELOG FLASHBACK DATAFILE TEMPFILE BACKUPSET AUTOBACKUP XTRANSPORT CHANGETRACKING DATAGUARDCONFIG |
关于asm的条带大小,其实跟我们平常说讲的存储条带是一样的,比如aix中对lv进行条带。oracle官方文档的推荐值是要求你设置条带大小
最少为2*DB_FILE_MULTIBLOCK_READ_COUNT. 然而,通常来讲,我们都推荐设置为128k甚至更高的值。
在11gR2中,我发现asm相关的参数多了很多,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
SQL> select * from v$version where rownum < 3; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production PL/SQL Release 11.2.0.2.0 - Production SQL> show parameter _asm NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ _asm_acd_chunks integer 1 _asm_admin_with_sysdba boolean FALSE _asm_allow_lvm_resilvering boolean TRUE _asm_allow_only_raw_disks boolean TRUE _asm_ausize integer 1048576 _asm_automatic_rezone boolean TRUE _asm_avoid_pst_scans boolean TRUE _asm_blksize integer 4096 _asm_check_for_misbehaving_cf_clients boolean FALSE _asm_compatibility string 10.1 _asm_dba_threshold integer 0 _asm_dbmsdg_nohdrchk boolean FALSE _asm_diag_dead_clients boolean FALSE _asm_direct_con_expire_time integer 120 _asm_disable_amdu_dump boolean FALSE _asm_disable_async_msgs boolean FALSE _asm_disable_multiple_instance_check boolean FALSE _asm_disable_profilediscovery boolean FALSE _asm_disable_smr_creation boolean FALSE _asm_disk_repair_time integer 14400 _asm_emulate_nfs_disk boolean FALSE _asm_emulmax integer 10000 _asm_emultimeout integer 0 _asm_evenread integer 0 _asm_evenread_alpha integer 0 _asm_evenread_alpha2 integer 0 _asm_evenread_faststart integer 0 _asm_fail_random_rx boolean FALSE _asm_fob_tac_frequency integer 9 _asm_force_quiesce boolean FALSE _asm_hbeatwaitquantum integer 2 _asm_imbalance_tolerance integer 3 _asm_instlock_quota integer 0 _asm_iostat_latch_count integer 31 _asm_kfdpevent integer 0 _asm_kfioevent integer 0 _asm_kill_unresponsive_clients boolean TRUE _asm_libraries string ufs _asm_log_scale_rebalance boolean FALSE _asm_lsod_bucket_size integer 13 _asm_max_cod_strides integer 5 _asm_max_redo_buffer_size integer 2097152 _asm_maxio integer 1048576 _asm_partner_target_disk_part integer 8 _asm_partner_target_fg_rel integer 4 _asm_primary_load integer 1 _asm_primary_load_cycles boolean TRUE _asm_random_zone boolean FALSE _asm_rebalance_plan_size integer 120 _asm_rebalance_space_errors integer 4 _asm_repairquantum integer 60 _asm_reserve_slaves boolean TRUE _asm_root_directory string ASM _asm_runtime_capability_volume_support boolean FALSE _asm_secondary_load integer 10000 _asm_secondary_load_cycles boolean FALSE _asm_serialize_volume_rebalance boolean FALSE _asm_shadow_cycle integer 3 _asm_skip_rename_check boolean FALSE _asm_skip_resize_check boolean FALSE _asm_storagemaysplit boolean FALSE _asm_stripesize integer 131072 _asm_stripewidth integer 8 _asm_sync_rebalance boolean FALSE _asm_usd_batch integer 64 _asm_wait_time integer 18 _asmlib_test integer 0 _asmsid string asm _ges_diagnostics_asm_dump_level integer 11 _lm_asm_enq_hashing boolean TRUE |
关于asm template directory,个人认为没有太大的实际意义,了解即可,所以这篇文章内容就到此为止,后面会继续。
One Response to “oracle asm剖析系列(6)–template directory”
紧跟大师的脚步
Leave a Reply
You must be logged in to post a comment.