Read ASM DiskGroup metadata with AMAP v0.3

I’ve done a nice (i think it is) improvement over version 0.2 of my AMAP utility. This new improvement will allow you to see where diskgroup metadata (not disk itself) is located on your real disks. As soon as you can locate this metadata you can read it using dd, for example.

The diskgroup metadata that AMAP can actually locate is the following:

  • File Directory (files and extent)
  •  Disk Directory
  • Active Change Directory (ACD) The ACD is analogous to a redo log, where changes to the metadata are logged.
  • Continuing Operation Directory (COD).  It maintains the state of active ASM operations such as disk or datafile drop/add or even an rebalance operation. This log is committed or rolled back based on operation success.
  • Template directory
  •  Alias directory
  •  Attribute Directory (Only present in 11g)
  •  Staleness registry. It is created when a disk goes offline and ASM needs to maintained the tracking blocks in your offlined disks.  (Only present in 11g)
  • Unknow. Some metadata can be found but the content of it is unknow (at least for me).

This new feature usage is very simple, as the only thing you need to pass is your DiskGroup name.

1) @amap metadata <diskgroup>

DISKNUMBER FILENUMBER FILE EXTENT NUMBER	  METADATA DESC 	EXTENT MIRRORING RELATIVE AU POSITION
---------- ---------- ------------------ ------------------------------ ---------------- --------------------
	 0 1	      0 		 FILE DIRECTORY 		PRIMARY EXT	 2
	 1 1	      1 		 FILE DIRECTORY 		PRIMARY EXT	 31
	 1 2	      0 		 DISK DIRECTORY 		PRIMARY EXT	 2
	 0 3	      0 		 ACTIVE CHG DIRECTORY (ACD)	PRIMARY EXT	 3
	 0 3	      2 		 ACTIVE CHG DIRECTORY (ACD)	PRIMARY EXT	 4
	 0 3	      4 		 ACTIVE CHG DIRECTORY (ACD)	PRIMARY EXT	 5
...
	 1 4	      5 		 CONT OPERATION DIR (COD)	PRIMARY EXT	 28
	 1 4	      7 		 CONT OPERATION DIR (COD)	PRIMARY EXT	 29
	 1 5	      0 		 TEMPLATE DIRECTORY		PRIMARY EXT	 26
	 0 6	      0 		 ALIAS DIRECTORY		PRIMARY EXT	 25
	 0 8	      0 		 UNKNOW 			PRIMARY EXT	 26
	 1 9	      0 		 ATTRIBUTE DIRECTORY		PRIMARY EXT	 25
	 1 253	      0 		 UNKNOW 			PRIMARY EXT	 30

Or in picture mode:

amap_metadata

Examples:

As you can easily see “RELATIVE AU POSITION” will give you the exact location of the specified metadata on your disk and you can use dd to check it. The first dump will be “DISK DIRECTORY” that is on position 2 of disk 1. Please remember that AU size is 1MB (bs=1024k) and you only need to read 1 AU for this particular example.

[oracle@phoenix ~]$ dd if=/dev/oracleasm/disks/DATA2 bs=1024k count=1 skip=2|strings|more
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copiedDATA_0000
DATA_0000
DATA_0001
DATA_0001
, 0.263319 s, 4.0 MB/s

It shows you some DATA_0000 and DATA_0001 that are the disks in this system.

This time i will dump ATTRIBUTE DIRECTORY of DiskGroup +DATA that is on position 25 of Disk 1. This will list all the attributes present in your DiskGroup.

[oracle@phoenix ~]$ dd if=/dev/oracleasm/disks/DATA2 bs=1024k count=1 skip=25|strings|more
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.0508502 s, 20.6 MB/s
disk_repair_time
3.6h
_rebalance_compact
TRUE
_extent_sizes
1 4 16
_extent_counts
20000 20000 214748367
au_size

sector_size

compatible

cell
FALSE
access_control

You can dump whatever you want knowing the exact location of the file. AMAP v0.3 is available on the same location as usual: https://raw.github.com/lcmarques/amap/master/amap.sql

Enjoy 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s