^_^小麦苗^_^

小麦苗博客,实用经典,简单易懂,接地气!---技术应用型博客,主打实用性,只讲实用的,不讲没用的,多做实验,多思考!

  • 博客访问: 6164605
  • 博文数量: 966
  • 用 户 组: 普通用户
  • 注册时间: 2012-09-23 17:46
  • 认证徽章:
个人简介

QQ:646634621| 网名:小麦苗| 微信公众号:xiaomaimiaolhr| 11g OCM| QQ群:618766405 微信群:私聊| 《数据库笔试面试宝典》作者

ITPUB论坛APP

ITPUB论坛APP



APP发帖 享双倍积分

文章分类

全部博文(966)

文章存档

2017年(413)

2016年(312)

2015年(167)

2014年(73)

微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

订阅
热词专题

分类: Linux

原文地址:【ASM】ASMCMD 之md_backup,md_restore介绍 作者:杨奇龙

在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

 

阅读(285) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册