An Internal Look Into ASM Metadata, Processes and Tools
An Internal Look Into ASM Metadata, Processes and Tools
• ASM Architecture
• ASM Metadata
• ASM is a file system and volume manager built into the database kernel
that allows the practical management of disk drives with high
availability.
• First portion of ASM code allows for the startup of a special instance
called “ASM Instance”
• Second portion of ASM code run in the database instance, in the I/O
path.
Segment <- Extent <- File
MARK marks AUs as stale following a missed write to an offline disk. This
essentially tracks which extents require resync for offline disks.
• On Disk structures
• physically addressed metadata
• virtually addressed metadata
• In Memory structures
Disk Metadata Structures
• Two types of On disk Metadata structures
• Physically addressed metadata –only relevant to a single disk and
thus is addressed directly by physical block number relative to the disk
number.
AU 0
... E X T 2
AU 86
AU 84 E X T 0 AU 85 E X T 1
AU 87 E X T 3
Physically Addressed
Virtually Addressed
Files
Block 0 1 2 3 ............ 255
LH FD FD
AU2
AU3 DD DD DD
COD
...
50MB
AU50 D A T A F I L E S
...
On Disk Metadata Structures
• All ASM metadata is broken down into blocks
Oracle Confidential
Disk header (AU0,Block 0)
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 130 ; 0x001: 0x82
kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD
kfbh.datfmt: 1 ; 0x003: 0x01
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname: ASMDISK1_0000 ; 0x028: length=13
kfdhdb.secsize: 512 ; 0x0b8: 0x0200
kfdhdb.blksize: 4096 ; 0x0ba: 0x1000
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize: 2000 ; 0x0c4: 0x000007d0
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
Binary dump of ASM Disk header
BYTE 0 1 2 3 4 5 6 7 8 9 A B C D E F
00000000 01 82 01 01 00 00 00 00 00 00 00 80 8A 8B D0 AE 01: Little/Big Endian
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 82: Metadata blocksize
00000020 4F 52 43 4C 44 49 53 4B 00 00 00 00 00 00 00 00 Driver being used
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000040 00 00 10 0A 00 00 01 03 41 53 4D 30 31 5F 30 30 Disk Name (32 bytes)
00000050 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000060 00 00 00 00 00 00 00 00 41 53 4D 30 31 00 00 00 Diskgroup name (32 bytes)
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000080 00 00 00 00 00 00 00 00 41 53 4D 30 31 5F 30 30 Failgroup name
00000090 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000C0 00 00 00 00 00 00 00 00 8E 10 F5 01 00 70 BA 5C Creation timestamp
000000D0 8E 10 F5 01 00 AC 36 5D 00 02 00 10 00 00 10 00 AU size
000000E0 80 BC 01 00 73 23 00 00 02 00 00 00 01 00 00 00 Disk size(# of AU units)
000000F0 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00
00000100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Oracle Confidential
Allocation and Space Tables
0 1 2
AU0 FST AT .... AT
255
• Free Space Table list blocks that in allocation table that contain free
allocation unit
Partner Status Table (PST)
0 1 2
AU1 PST PST ... .... HBEAT
255
• ACD is file # 3
Continous Operations Directory
• Used for ASM instance recovery
• Logs long/large changes to the ASM structure that cannot be done
atomically.
• Changes can be initiated by database instance or ASM instance
• Two types of operations – background & rollback
• background operations are invoked by the ASM instance to perform
diskgroup maintenance; such as rebalance
• Rollback operations are instigated by the database instance; examples
include adding or deleting files, templates, or aliases.
• In rollback operations the RBAL (db instance) actually performs the
operations.
• COD is file # 4
Template and Alias Directory
• kfed
• dbverify
• examine corrupt diskheader (kfed)
• OS blockdump (dd)
• amdu
kfed – kernel files editor
COMMAND:
kfed read /dev/rdsk/c0t0d0s7
this will dump out ASM disk header block
note:
you have to link kfed tool in 10g before starting (it‘s not available
with normal installation)
Note 284646.1 - Creating and using the kfed utility to view ASM
disk header
Note 284757.1 - ASM Disk Header Block Dump Analysis
kfed, kfod – quick reference
• operations
read, write, merge
Command:
kfed read /dev/rdsk/c0t0d0s7
this will dump out ASM disk header block
Oracle Support may ask you to provide AMDU output, especially when facing internal errors related to
the ASM metadata
NOTE:
AMDU executable comes with installation from 11.1 onwards. Although this tool
was released with 11g, it can be used with ASM 10g as well.
UDMA (Internal) is the opposite utility
The usual syntax used for dumping metadata related to a diskgroup is: of AMDU. It can be used to recreate a
diskgroup's disk(s) using AMDU's
amdu -diskstring '<your_path_to_ASM_disks' -dump '<diskgroup>'
previously extracted metadata. Since the
recreated disks will be sparse files
containing only ASM metadata, UDMA can
be used to replicate a customer's
diskgroup in Oracle without having any
$ amdu -diskstring 'o/*/DATA*' -dump 'DATA' -noimage compromisable data, and thereby help to
diagnose issues.
CreateASMInstanceEveryWhere
1. Create pfile init+MYA.ora
Oracle Confidential
CreateASMInstanceEveryWhere
1. Create pfile init+MYA.ora
3. Start ASM
Oracle Confidential
CreateASMInstanceEveryWhere
1. Create pfile init+MYA.ora
ps -ef|grep MYA
oracle 5012 17024 0 14:23 pts/8 00:00:00 grep MYA
oracle 7213 1 0 13:48 ? 00:00:00 asm_pmon_+MYA
oracle 7268 1 0 13:48 ? 00:00:00 asm_psp0_+MYA
oracle 7914 1 0 13:48 ? 00:00:00 asm_vktm_+MYA
oracle 7972 1 0 13:48 ? 00:00:00 asm_gen0_+MYA
oracle 8017 1 0 13:48 ? 00:00:00 asm_diag_+MYA
oracle 8068 1 0 13:48 ? 00:00:00 asm_dia0_+MYA
Oracle Confidential
CreateASMInstanceEveryWhere
1. Create pfile init+MYA.ora
3. Start ASM SQL> select path from v$asm_disk where path like '%lyavuz%';
PATH
4. Create ASM Diskgroup --------------------------------------------------------------------------------
/export/home/oracle/lyavuz/disks/disk2
/export/home/oracle/lyavuz/disks/disk3
/export/home/oracle/lyavuz/disks/disk1
Diskgroup created.
SQL>
Oracle Confidential
CreateASMInstanceEveryWhere
1. Create pfile init+MYA.ora
SQL> select name,state,type,total_mb,free_mb from v$asm_diskgroup;
2. Create ASM disks and set file permissions
NAME STATE TYPE TOTAL_MB FREE_MB
------------------------------ ----------- ------ ---------- ----------
3. Start ASM DATA1 MOUNTED EXTERN 600 546
/export/home/oracle/lyavuz/disks/disk3
DATA1_0000 200 182 200 MEMBER
/export/home/oracle/lyavuz/disks/disk1
DATA1_0001 200 182 200 MEMBER
/export/home/oracle/lyavuz/disks/disk2
DATA1_0002 200 182 200 MEMBER
Oracle Confidential