12C-OCP升级1z-060-005

时间:2022-11-22 21:30:45
You are administering a database stored in Automatic Storage Management (ASM). You
use RMAN to back up the database and the MD_BACKUP command to back up the ASM
metadata regularly. You lost an ASM disk group DG1 due to hardware failure.
In which three ways can you re-create the lost disk group and restore the data?
A. Use the MD_RESTORE command to restore metadata for an existing disk group by
passing the existing disk group name as an input parameter and use RMAN to restore the
data.
B. Use the MKDG command to restore the disk group with the same configuration as the
backed-up disk group and data on the disk group.
C. Use the MD_RESTORE command to restore the disk group with the changed disk group
specification, failure group specification, name, and other attributes and use RMAN to
restore the data.
D. Use the MKDG command to restore the disk group with the same configuration as the
backed-up disk group name and same set of disks and failure group configuration, and use
RMAN to restore the data.
E. Use the MD_RESTORE command to restore both the metadata and data for the failed
disk group.
F. Use the MKDG command to add a new disk group DG1 with the same or different
specifications for failure group and other attributes and use RMAN to restore the data.

正确答案解析:
Answer: C,D,F

我们来看下asmcmd的三个命令:
md_backup            创建已挂载的磁盘组元数据备份
md_restore        恢复磁盘组元数据备份
mkdg                    创建磁盘组,基于XML配置文件创建。注意:mkdg创建的磁盘组只挂载在本地节点

A 错误    md_restore只能回复备份出来的diskgroup
B 错误  mkdg是重新创建disk group,并不能够恢复数据
E 错误  同样的道理mk_restore并不能够用来恢复数据,只能够恢复元数据


附使用mk_backup mk_restore 恢复diskgroup的例子
ASMCMD> md_backup /home/oracle/test2016 -G DATA
Disk group metadata to be backed up: DATA
Current alias directory path: KIWI/ONLINELOG
Current alias directory path: KIWI
Current alias directory path: KIWI/TEMPFILE
Current alias directory path: ASM/PASSWORD
Current alias directory path: KIWI/DATAFILE
Current alias directory path: ASM/ASMPARAMETERFILE
Current alias directory path: KIWI/PARAMETERFILE
Current alias directory path: ASM
Current alias directory path: KIWI/CONTROLFILE

通过-S参数可以仅生成恢复脚本,不执行恢复动作:
md_restore -S create_data.sql /home/oracle/test2016
我们来看一下脚本里面的内容:
[04:52:40 oracle(grid)@kiwi ~]$ cat create_data.sql
create diskgroup DATA EXTERNAL redundancy  disk 'ORCL:ASMDISK01' name ASMDISK01 size 20473M attribute 'compatible.asm' = '12.1.0.0.0', 'compatible.rdbms' = '10.1.0.0.0';
alter diskgroup /*ASMCMD AMBR*/DATA set attribute '_._DIRVERSION' = '12.1.0.0.0';
alter diskgroup /*ASMCMD AMBR*/DATA alter template "XTRANSPORT BACKUPSET" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "ASMPARAMETERFILE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "ONLINELOG" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "KEY_STORE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "VOTINGFILE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "OCRFILE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "AUTOLOGIN_KEY_STORE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "PARAMETERFILE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "FLASHBACK" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "AUTOBACKUP" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "ARCHIVELOG" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "DUMPSET" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "TEMPFILE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "INCR XTRANSPORT BACKUPSET" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "XTRANSPORT" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "CHANGETRACKING" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "DATAGUARDCONFIG" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "DATAFILE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "CONTROLFILE" attributes (UNPROTECTED FINE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "AUDIT_SPILLFILES" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "BACKUPSET" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR*/DATA alter template "FLASHFILE" attributes (UNPROTECTED COARSE);
alter diskgroup /*ASMCMD AMBR */ DATA add directory '+DATA/ASM';
alter diskgroup /*ASMCMD AMBR */ DATA add directory '+DATA/KIWI';


我们直接把磁盘dd掉
dd if=/dev/zero of=/dev/sdb1 bs=1024k count=2000

还原asm磁盘组元数据
md_restore --full -G DATA /home/oracle/test2016

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     20473    20420                0           20420              0             N  DATA/
ASMCMD>