在11g中ASMCMD 已经拓展备份和恢复ASM 磁盘组的功能。这个功能允许你重建一个与先前存在的磁盘组一样路径,名称,属性,模版,别名结构。在10g中如果磁盘损坏了,只能通过使用RMAN来恢复丢失的数据,而且你必须人工的重建ASM 磁盘组和任何必须的目录,模版,在11g中我们可以使用md_backup命令备份磁盘组的元数据并且使用md_restore命令在应用备份恢复之前重建磁盘组。md_backup:命令创建一个包含一个或者多个磁盘组的元数据的文件,默认情况下如果不指定备份文件的路径,包含所有加载状态的磁盘组元数据的备份文件保存在当前路径。如果不指定备份文件的名字,在默认为AMBR_BACKUP_INTERMEDIATE_FILE.
例子:
ASMCMD [+data] > md_backup /tmp/asmDATA.bak -G DATA --备份指定磁盘组DATA的元数据
Disk group metadata to be backed up: DATA
Current alias directory path: rac/ASMPARAMETERFILE
Current alias directory path: rac/AUTOBACKUP/2011_05_26
Current alias directory path: rac/MREDO
Current alias directory path: rac/AUTOBACKUP/2010_10_21
Current alias directory path: rac/ARCHIVELOG/2011_07_07
Current alias directory path: rac/OCRFILE
Current alias directory path: tspitr
Current alias directory path: rac/ARCHIVELOG/2011_07_09
Current alias directory path: DUMMY
Current alias directory path: rac/ARCHIVELOG/2011_07_06
Current alias directory path: rac/AUTOBACKUP/2010_10_26
Current alias directory path: rac/AUTOBACKUP/2010_10_20
Current alias directory path: rac/AUTOBACKUP/2010_11_22
Current alias directory path: rac/AUTOBACKUP
Current alias directory path: rac/ARCHIVELOG/2010_09_05
Current alias directory path: rac/AUTOBACKUP/2010_10_19
Current alias directory path: rac/ARCHIVELOG/2011_06_25
Current alias directory path: DUMMY/PARAMETERFILE
Current alias directory path: rac/ARCHIVELOG/2011_06_27
Current alias directory path: rac/AUTOBACKUP/2011_06_02
Current alias directory path: rac
Current alias directory path: rac/AUTOBACKUP/2010_10_18
Current alias directory path: rac/ARCHIVELOG/2011_07_01
Current alias directory path: rac/AUTOBACKUP/2010_11_26
Current alias directory path: rac/TEMPFILE
Current alias directory path: rac/CONTROLFILE
Current alias directory path: rac/ARCHIVELOG/2011_06_24
Current alias directory path: rac/ARCHIVELOG/2011_06_29
Current alias directory path: rac/ARCHIVELOG/2011_07_05
Current alias directory path: rac/ARCHIVELOG
Current alias directory path: rac/DATAFILE
Current alias directory path: rac/ARCHIVELOG/2011_06_23
Current alias directory path: rac/ONLINELOG
ASMCMD> md_backup -b /tmp/asmDATA.bak -g DATA
Disk group to be backed up: DATA
在恢复模式,系统读取先前创建的备份文件来重建磁盘组和它的元数据。用户可以控制这个恢复的模式,以full,nodg,newdg三种方式来恢复。
1 full 模式恢复ASM磁盘组到它们备份时的状态。
恢复的时候执行命令:
srvctl stop diskgroup –g DATA
否则恢复时会报ORA-15030错误
ASMCMD> md_restore -b /tmp/asmDATA.bak -t full -g DATA
Current Diskgroup being restored: DATA
ASMCMD-09352: CREATE DISKGROUP failed
ORA-15018: diskgroup cannot be created
ORA-15030: diskgroup name "DATA" is in use by another diskgroup (DBD ERROR: OCIStmtExecute)
SQL> drop diskgroup DATA;
Diskgroup dropped.
ASMCMD> md_restore -b /tmp/asmDATA.bak -t full -g DATA
Current Diskgroup being restored: DATA
Diskgroup DATA created!
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template DATAGUARDCONFIG modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
SQL> select group_number,name,type from v$asm_diskgroup;
GROUP_NUMBER NAME TYPE
------------ -------------------- ------
1 DATA EXTERN
2 nodg 模式将备份文件中记录的属性,模版,别名结构恢复一个已经存在的ASM磁盘组中。
ASMCMD> md_restore -b /tmp/asmDATA.bak -t nodg -g DATA
Current Diskgroup being restored: DATA
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template DATAGUARDCONFIG modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
3 newdg模式允许用户重写磁盘组的名称,磁盘,和指定的故障磁盘组作为磁盘组重建的一部分,但保留部分属性,模板,别名目录结构。
ASMCMD> md_restore -b /tmp/asmDATA.bak -t newdg -o 'DATA:DG'--更改磁盘组的名称
Current Diskgroup being restored: DATA
Current Diskgroup name replace by: DG
Diskgroup DG created!
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template DATAGUARDCONFIG modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
SQL> select group_number,name,type from v$asm_diskgroup
GROUP_NUMBER NAME TYPE
------------ ---------------- ----------
1 DG EXTERN
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22664653/viewspace-701767/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22664653/viewspace-701767/