日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ASM元数据备份与恢复:md_backup和md_restore

發布時間:2024/8/26 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ASM元数据备份与恢复:md_backup和md_restore 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在Oracle Database 11gR2 中,asmcmd有了大量的改進和增強,即使11.2.0.2和11.2.0.1比較,也有很多不同。

在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 /*ASMCMD AMBR*/ORADG set attribute '_._DIRVERSION' = '11.2.0.0.0';
alter diskgroup /*ASMCMD AMBR*/ORADG alter template ONLINELOG attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template AUTOBACKUP attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template CONTROLFILE attributes (UNPROTECTED FINE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template DATAGUARDCONFIG attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template CHANGETRACKING attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template DUMPSET attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template BACKUPSET attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template ASMPARAMETERFILE attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template DATAFILE attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template FLASHBACK attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template OCRFILE attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template FLASHFILE attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template PARAMETERFILE attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template TEMPFILE attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template XTRANSPORT attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/ORADG alter template ARCHIVELOG attributes (UNPROTECTED COARSE);

ASMCMD的新增命令極多,以下是命令列表:
ASMCMD> help

??????????? asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege <sysasm|sysdba>] [-p] [command]
asmcmd_no_conn_str

??????? Starts asmcmd or executes the command

??????? asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege <sysasm|sysdba>] [-p] [command]

??????? The environment variables ORACLE_HOME and ORACLE_SID determine the
??????? instance to which the program connects, and ASMCMD establishes a
??????? bequeath connection to it, in the same manner as a SQLPLUS / AS
??????? SYSASM.? The user must be a member of the OSASM group.

??????? Specifying the -V option prints the asmcmd version number and
??????? exits immediately.

??????? Specifying the -v option prints extra information that can help
??????? advanced users diagnose problems.

??????? Specify the --privilege option to choose the type of connection. There are
??????? only two possibilities: connecting as SYSASM or as SYSDBA.
??????? The default value if this option is unspecified is SYSASM.

??????? Specifying the -p option allows the current directory to be displayed
??????? in the command prompt, like so:

??????? ASMCMD [+DATA/ORCL/CONTROLFILE] >

??????? [command] specifies one of the following commands, along with its
??????? parameters.

??????? Type "help [command]" to get help on a specific ASMCMD command.';

??????? commands:
??????? --------

??????? md_backup, md_restore

??????? lsattr, setattr

??????? cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
??????? mkdir, pwd, rm, rmalias

??????? chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
??????? offline, online, rebal, remap, umount

??????? dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
??????? spmove, spset, startup

??????? chtmpl, lstmpl, mktmpl, rmtmpl

??????? chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
??????? mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr

??????? volcreate, voldelete, voldisable, volenable, volinfo
??????? volresize, volset, volstat

總結

以上是生活随笔為你收集整理的ASM元数据备份与恢复:md_backup和md_restore的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。