了解更多关于Oracle ASM md_backup md_restore

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.

 

Synopsis
md_backup <backup_file> [-G <diskgroups,...>]
Description
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.
Examples
The first example shows the use of the backup command when run
without the disk group option. This example backs up all of the mounted
disk groups and creates the backup image in the /scratch/backup/alldgs20100422 file. The second
example creates a backup of DATA disk group. The backup that this example creates is saved in the
/tmp/dgbackup20090716 file.
ASMCMD [+] > md_backup /scratch/backup/alldgs20100422
Disk group metadata to be backed up: DATA
Disk group metadata to be backed up: FRA
Current alias directory path: ORCL/ONLINELOG
Current alias directory path: ORCL/PARAMETERFILE
Current alias directory path: ORCL
Current alias directory path: ASM
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/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
ASMCMD [+] > md_backup /scratch/backup/data20100422 -G DATA
Disk group metadata to be backed up: DATA
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
Current alias directory path: ORCL/CONTROLFILE
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

 

Backing Up ASM Disk Group Metadata

Use the ASMCMD md_backup command to create a backup file containing metadata for one or more disk groups
In the event of a loss of the ASM disk group, the backup file is used to reconstruct the disk group and its metadata.
Without the metadata backup file, the disk group must be manually re-created in the event of a loss.
Backing up all mounted disk groups

ASMCMD> md_backup /backup/asm_metadata

Backing up the DATA disk group:

ASMCMD> md_backup /backup/asm_metadata –G data

You can use the ASMCMD md_backup command to create a backup file of ASM disk group metadata. This backup file can be used to reconstruct the ASM disk group and its metadata if the disk group is lost. Without this metadata backup file, you must manually re-create the ASM disk group in the event of a loss of the disk group.
As shown in the first example in the slide, you can use the md_backup command to back up the metadata for all mounted groups. By using the –G option, you can name specific disk groups to be backed up.
If you do not specify a full path for the backup file, it is saved in the current working directory.

 

ASMCMD 扩展

  • ASMCMD 已经过扩展,包括了 ASM 元数据备份,并具备了还原功能。这样一来,就可以使用完全对应的模板和别名目录结构重新创建先前存在的 ASM 磁盘组。目前,如果丢失了 ASM 磁盘组,则可以使用 RMAN 来还原丢失的文件,但必须手动重新创建 ASM 磁盘组以及任何必需的用户目录或模板。
    ASM 元数据备份和还原 (AMBR) 有两种运行模式:

-在备份模式下,AMBR 会分析 ASM 固定表和视图来收集有关现有磁盘和故障组配置、模板以及别名目录结构的信息;然后,将此元数据信息转储至某个文本
文件。

-在还原模式下,AMBR 会读取以前生成的文件来重建磁盘组及其元数据。可以在还原模式下控制 AMBR 行为以完成 full、nodg 或 newdg 还原。这三种子模式间的差别在于是否需要包括磁盘组创建并更改其特性。

  • lsdsk 命令可列出 ASM 磁盘信息。此命令可在两种模式下运行:

-在连接模式下,ASMCMD 使用 V$ 视图和 GV$ 视图来检索磁盘信息。

-在非连接模式下,ASMCMD 使用 ASM 磁盘字符串来限制搜索集,对磁盘头进行扫描以检索磁盘信息。连接模式始终为首选操作。

 

 

ASMCMD 扩展(续)

  • 使用 cp 命令可以在本地实例和远程实例上的 ASM 磁盘组之间复制文件。以下是一个可能的用法示例:
    cp +DATA/ORCL/DATAFILE/TBSJFV.256.629730771 +DATA/ORCL/tbsjfv.bak
    在上例中,在本地复制了一个现有文件。但是,可以指定一个连接字符串将文件复制到远程 ASM 磁盘组。被复制的文件的格式在 Little-Endian 系统和 Big-Endian 系统之间是可移植的。也可以使用 cp 命令将 ASM 文件复制到您的操作系统。例如:
    cp +DATA/ORCL/DATAFILE/TBSJFV.256.629730771 /home/oracle/tbsjfv.dbf
    同样,也可以使用 cp 命令将文件从您的操作系统复制到某个 ASM 目录。例如:
    cp /home/oracle/tbsjfv.dbf +data/jfv
    如果要将某个 ASM 文件从本地 ASM 实例复制到远程 ASM 实例,可使用以下语法:
    cp +DATA/orcl/datafile/tbsjfv.256.629989893 \sys@edcdr12p1.+ASM2:+D2/jfv/tbsjfv.dbf

注:有关上述每个命令的语法的详细信息,请参阅《Oracle Database Storage Administrator’s Guide》。

了解更多关于Oracle ASM md_backup md_restore_第1张图片

ASMCMD> md_backup –b jfv_backup_file -g data

Disk group to be backed up: DATA#

Current alias directory path: jfv

ASMCMD>

 

意外删除磁盘组

 

ASMCMD> md_restore -b jfv_backup_file -t full -g data

Disk group to be restored: DATA#

ASMCMDAMBR-09358, Option -t newdg specified without any override options.

Current Diskgroup being restored: DATA

Diskgroup DATA created!

User Alias directory +DATA/jfv

                 created!

ASMCMD>

 

使用 RMAN 还原磁盘组文件

 

ASMCMD 扩展:示例

此示例说明了如何使用 md_backup 命令备份 ASM 元数据,以及如何使用 md_restore 命令还原数据。

第一个语句指定了命令的 –b 选项和 –g 选项。这定义生成的包含备份信息的文件的名称,以及需要备份的磁盘组(在幻灯片中分别是 jfv_backup_file 和 data)。

在第 2 步中,假定 DATA 磁盘组中存在问题。因此,该磁盘组被删除了。在还原该磁盘组包含的数据库文件之前,必须先还原该磁盘组本身。

在第 3 步中,使用 md_restore 命令启动磁盘组重新创建操作及其元数据的还原操作。在这一步中,需要指定第 1 步中生成的备份文件的名称以及要还原的磁盘组的名称,还要指定所需的还原类型。在此示例中,因为磁盘组已不再存在,所以进行了完全还原。

重新创建了磁盘组之后,可以使用 RMAN 之类的功能还原其数据库文件。

你可能感兴趣的:(了解更多关于Oracle ASM md_backup md_restore)