Oracle ASM Header Backup
A situation popped up recently for one team where a drive went into predictive failure, and a controller hung, corrupting the ASM headers upon reboot. This resulted them having to completely rebuild the disk groups and restore the database from tape. If the team would have had a backup of their ASM headers, all of that wouldn’t have been necessary.
ASM metadata corruption is a clear and present danger that we as DBAs have to recognize and prepare for. It is nothing to be embarrassed about, and nothing to fear, as long as you are ready for it.
md_backup is ran from the ASMCMD> prompt. It very simply creates a file that is a backup of your metadata, for all of your disk groups, or just a few if you want to specify. By default, it writes to the current directory and backs up all of the mounted disk groups header files.
Arguments: -b and –g
-b Specifies a location to store the backup file
-g Specifies the disk group to back up
Example: ASMCMD> md_backup –b /mydir/somebackupfile –g DG1 –g DG3
This will backup disk groups DG1 and DG3 to the file /mydir/somebackupfile.
ASMCMD> md_backup -b /tmp/backup.txt -g DG1_DDI_DATA
WARNING:option 'g' is deprecated for 'md_backup'
please use 'G'
WARNING:option 'b' is deprecated for 'md_backup'
Disk group metadata to be backed up: DG1_DDI_DATA
Current alias directory path: AMXDDIP1_1A/CONTROLFILE
Current alias directory path: AMXDDIP1_1A
Current alias directory path: AMXDDIP1_1A/DATAFILE
md_restore is a bit more involved than md_backup. As you may have guessed, it restores previously backed up metadata to disk groups you specifiy.
Arguments: -b –i –t –f –g –o
-b Specifies the backup file to read
-i Ignores errors. (Normally, if md_restore hits an error, it stops. This argument suppressed that.
-t Specifies the type of disk group to be created/restored. “full” creates a disk group and restores the metadata. “nodg” restores metadata only, and “newdg” creates a new disk group with a different name using in conjunction with the –o argument.
-o Renames the disk group
-f writes the SQL commands to be performed in the restore to a file instead of executing them (sql_script_file).
-g selects the disk groups to be restored. If none are specified, it restores all of them.
Example: ASMCMD> md_restore –t full –g DG1 –i backup_file
This will restore disk group DG1 using the specified file.
Example: ASMCMD> md_restore –t nodg –g DG1 –i backup_file
This will restore an existing disk group’s metadata.