文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

在Oracle Database 11gR2中如何使用md_backup命令

2024-04-02 19:55

关注

小编给大家分享一下在Oracle Database 11gR2中如何使用md_backup命令,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

在Oracle Database 11gR2 中,在ASM元数据的备份与恢复方面,Oracle增加了两个命令:md_backup 和 md_restore。
md 是 metadata的缩写,这一工具极大的简化了ASM的元数据维护。

在asmcmd中,通过help md_backup可以看到详细的命令提示:

ASMCMD> help md_backup
        md_backup

        The md_backup command creates a backup file containing metadata
        for one or more disk groups.
        Volume and Oracle Automatic Storage Management Cluster File System
        (Oracle ACFS) file system information is not backed up.

        md_backup backup_file [-G diskgroup [,diskgroup,...]]

        The options for the md_backup command are described below.

        backup_file     - Specifies the backup file in which you want to
                          store the metadata.
        -G diskgroup    - Specifies the disk group name of the disk group
                          that must be backed up

        By default all the mounted disk groups are included in the backup file,
        which is saved in the current working directory.

        The first example shows the use of the backup command when you run it
        without options. This example backs up all of the mounted disk groups
        and creates the backup image in the current working directory. The
        second example creates a backup of disk group DATA and FRA. The backup
        that this example creates is saved in the /tmp/dgbackup20090714 file.

        ASMCMD [+] > md_backup /tmp/dgbackup20090716
        ASMCMD [+] > md_backup /tmp/dgbackup20090716 -G DATA,FRA
        Disk group metadata to be backed up: DATA
        Disk group metadata to be backed up: FRA
        Current alias directory path: ASM/ASMPARAMETERFILE
        Current alias directory path: ORCL/DATAFILE
        Current alias directory path: ORCL/TEMPFILE
        Current alias directory path: ORCL/CONTROLFILE
        Current alias directory path: ORCL/PARAMETERFILE
        Current alias directory path: ASM
        Current alias directory path: ORCL/ONLINELOG
        Current alias directory path: ORCL
        Current alias directory path: ORCL/CONTROLFILE
        Current alias directory path: ORCL/ARCHIVELOG/2009_07_13
        Current alias directory path: ORCL/BACKUPSET/2009_07_14
        Current alias directory path: ORCL/ARCHIVELOG/2009_07_14
        Current alias directory path: ORCL
        Current alias directory path: ORCL/DATAFILE
        Current alias directory path: ORCL/ARCHIVELOG
        Current alias directory path: ORCL/BACKUPSET
        Current alias directory path: ORCL/ONLINELOG

现在backup_file是一个需要强制制定的参数,以下命令备份了ASM中所有的磁盘组元数据:

ASMCMD> md_backup /tmp/oradgbackup20110322
Disk group metadata to be backed up: ACFSG
Disk group metadata to be backed up: CRSDG
Disk group metadata to be backed up: ORADG
Current alias directory path: EYGLE/ONLINELOG
Current alias directory path: EYGLE
Current alias directory path: EYGLE/CONTROLFILE
Current alias directory path: ASM
Current alias directory path: EYGLE/PARAMETERFILE
Current alias directory path: EYGLE/CONTROLFILE
Current alias directory path: EYGLE/TEMPFILE
Current alias directory path: EYGLE/DATAFILE
Current alias directory path: EYGLE
Current alias directory path: EYGLE/ONLINELOG
Current alias directory path: ASM/ASMPARAMETERFILE


也可以制定备份特定的磁盘组信息:

ASMCMD> md_backup /tmp/oradgbackup20110323 -G ORADG
Disk group metadata to be backed up: ORADG


备份以文本格式记录了磁盘组的参数信息:

[grid@enmou1 ~]$ more /tmp/oradgbackup20110323
@diskgroup_set = (
                   {
                     'ATTRINFO' => {
                                     '_._DIRVERSION' => '11.2.0.0.0',
                                     'COMPATIBLE.ASM' => '11.2.0.0.0',
                                     'COMPATIBLE.RDBMS' => '10.1.0.0.0'
                                   },
                     'DISKSINFO' => {
                                      'VOL3' => {
                                                  'VOL3' => {
                                                              'TOTAL_MB' => '9687',
                                                              'FAILGROUP' => 'VOL3',
                                                              'NAME' => 'VOL3',
                                                              'DGNAME' => 'ORADG',
                                                              'PATH' => 'ORCL:VOL3'
                                                            }
                                                }
                                    },
                     'DGINFO' => {
                                   'DGTORESTORE' => 0,
                                   'DGCOMPAT' => '11.2.0.0.0',
                                   'DGNAME' => 'ORADG',
                                   'DGDBCOMPAT' => '10.1.0.0.0',
                                   'DGTYPE' => 'EXTERN',
                                   'DGAUSZ' => '1048576'
                                 },
                     'ALIASINFO' => {},
                     'TEMPLATEINFO' => {
                                         '6' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'ONLINELOG',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '11' => {
                                                   'DGNAME' => 'ORADG',
                                                   'STRIPE' => 'COARSE',
                                                   'TEMPNAME' => 'AUTOBACKUP',
                                                   'REDUNDANCY' => 'UNPROT',
                                                   'SYSTEM' => 'Y'
                                                 },
                                         '3' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'FINE',
                                                  'TEMPNAME' => 'CONTROLFILE',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '7' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'DATAGUARDCONFIG',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '9' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'CHANGETRACKING',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '12' => {
                                                   'DGNAME' => 'ORADG',
                                                   'STRIPE' => 'COARSE',
                                                   'TEMPNAME' => 'BACKUPSET',
                                                   'REDUNDANCY' => 'UNPROT',
                                                   'SYSTEM' => 'Y'
                                                 },
                                         '2' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'DUMPSET',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '14' => {
                                                   'DGNAME' => 'ORADG',
                                                   'STRIPE' => 'COARSE',
                                                   'TEMPNAME' => 'DATAFILE',
                                                   'REDUNDANCY' => 'UNPROT',
                                                   'SYSTEM' => 'Y'
                                                 },
                                         '15' => {
                                                   'DGNAME' => 'ORADG',
                                                   'STRIPE' => 'COARSE',
                                                   'TEMPNAME' => 'ASMPARAMETERFILE',
                                                   'REDUNDANCY' => 'UNPROT',
                                                   'SYSTEM' => 'Y'
                                                 },
                                         '8' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'FLASHBACK',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '4' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'FLASHFILE',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '1' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'OCRFILE',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '0' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'PARAMETERFILE',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                },
                                         '10' => {
                                                   'DGNAME' => 'ORADG',
                                                   'STRIPE' => 'COARSE',
                                                   'TEMPNAME' => 'XTRANSPORT',
                                                   'REDUNDANCY' => 'UNPROT',
                                                   'SYSTEM' => 'Y'
                                                 },
                                         '13' => {
                                                   'DGNAME' => 'ORADG',
                                                   'STRIPE' => 'COARSE',
                                                   'TEMPNAME' => 'TEMPFILE',
                                                   'REDUNDANCY' => 'UNPROT',
                                                   'SYSTEM' => 'Y'
                                                 },
                                         '5' => {
                                                  'DGNAME' => 'ORADG',
                                                  'STRIPE' => 'COARSE',
                                                  'TEMPNAME' => 'ARCHIVELOG',
                                                  'REDUNDANCY' => 'UNPROT',
                                                  'SYSTEM' => 'Y'
                                                }
                                       }
                   }
                 );


通过这些信息,就可以在磁盘组损坏时,快速恢复ASM的元数据。
恢复在磁盘组可用状态下不允许执行:

ASMCMD> md_restore --full -G oradg /tmp/oradgbackup20110323
Current Diskgroup metadata being restored: ORADG
ASMCMD-09352: CREATE DISKGROUP failed
ORA-15018: diskgroup cannot be created
ORA-15030: diskgroup name "ORADG" is in use by another diskgroup (DBD ERROR: OCIStmtExecute)

以下是在DROP了ORADG之后,执行恢复的全过程,恢复完成以后,磁盘组被创建,模板信息被还原:

ASMCMD> md_restore --full -G oradg /tmp/oradgbackup20110323
Current Diskgroup metadata being restored: ORADG
Diskgroup ORADG created!
System template ONLINELOG modified!
System template AUTOBACKUP modified!
System template CONTROLFILE modified!
System template DATAGUARDCONFIG modified!
System template CHANGETRACKING modified!
System template DUMPSET modified!
System template BACKUPSET modified!
System template ASMPARAMETERFILE modified!
System template DATAFILE modified!
System template FLASHBACK modified!
System template OCRFILE modified!
System template FLASHFILE modified!
System template PARAMETERFILE modified!
System template TEMPFILE modified!
System template XTRANSPORT modified!
System template ARCHIVELOG modified!


通过-S参数可以仅生成恢复脚本,不执行恢复动作:

ASMCMD> md_restore -S create_oradg.sql /tmp/oradgbackup20110323
Current Diskgroup metadata being restored: ORADG

以下是ORADG磁盘组恢复时执行的命令:

[grid@enmou1 ~]$ more create_oradg.sql
create diskgroup ORADG EXTERNAL redundancy  disk 'ORCL:VOL3' name VOL3 size 9687M attribute 'compatible.asm' = '11.2.0.0.0', 'compatible.r
dbms' = '10.1.0.0.0';
alter diskgroup ORADG set attribute '_._DIRVERSION' = '11.2.0.0.0';
alter diskgroup ORADG alter template ONLINELOG attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template AUTOBACKUP attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template CONTROLFILE attributes (UNPROTECTED FINE);
alter diskgroup ORADG alter template DATAGUARDCONFIG attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template CHANGETRACKING attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template DUMPSET attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template BACKUPSET attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template ASMPARAMETERFILE attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template DATAFILE attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template FLASHBACK attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template OCRFILE attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template FLASHFILE attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template PARAMETERFILE attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template TEMPFILE attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template XTRANSPORT attributes (UNPROTECTED COARSE);
alter diskgroup ORADG alter template ARCHIVELOG attributes (UNPROTECTED COARSE);

以上是“在Oracle Database 11gR2中如何使用md_backup命令”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯