我们知道asm是以au为分配单元,默认一个au为1m,那么disk header位于第一个au的第一个数据块上,而asm block编号是从0开始
下面通过kfed工具来了解asm diskheader内容
[root@localhost ~]# kfed read /dev/asm-diskb kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD --disk header kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0 kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0 kfbh.check: 2625524850 ; 0x00c: 0x9c7e5472 kfbh.fcn.base: 2795 ; 0x010: 0x00000aeb kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8 kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000 kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000 kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000 kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000 kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000 kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000 kfdhdb.compat: 186646528 ; 0x020: 0x0b200000 kfdhdb.dsknum: 0 ; 0x024: 0x0000 kfdhdb.grptyp: 2 ; 0x026: KFDGTP_NORMAL --磁盘组冗余方式 kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER --磁盘herder状态,3为可用 kfdhdb.dskname: DATA_0000 ; 0x028: length=9 --磁盘名称 kfdhdb.grpname: DATA ; 0x048: length=4 --磁盘组名称 kfdhdb.fgname: DATA_0000 ; 0x068: length=9 --fail group name kfdhdb.capname: ; 0x088: length=0 kfdhdb.crestmp.hi: 33006007 ; 0x0a8: HOUR=0x17 DAYS=0xd MNTH=0x8 YEAR=0x7de kfdhdb.crestmp.lo: 811750400 ; 0x0ac: USEC=0x0 MSEC=0x95 SECS=0x6 MINS=0xc kfdhdb.mntstmp.hi: 33006676 ; 0x0b0: HOUR=0x14 DAYS=0x2 MNTH=0x9 YEAR=0x7de kfdhdb.mntstmp.lo: 1221844992 ; 0x0b4: USEC=0x0 MSEC=0xf8 SECS=0xd MINS=0x12 kfdhdb.secsize: 512 ; 0x0b8: 0x0200 kfdhdb.blksize: 4096 ; 0x0ba: 0x1000 --块大小 kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000 --au单位,这是是byte,1M kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80 kfdhdb.dsksize: 10240 ; 0x0c4: 0x00002800 --磁盘大小这里为10G kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002 kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001 kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002 kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002 -- file directory 所在au位置后面会有对单独详细解释 kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000 kfdhdb.redomirrors[1]: 0 ; 0x0da: 0x0000 kfdhdb.redomirrors[2]: 0 ; 0x0dc: 0x0000 kfdhdb.redomirrors[3]: 0 ; 0x0de: 0x0000 kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000 kfdhdb.grpstmp.hi: 33006007 ; 0x0e4: HOUR=0x17 DAYS=0xd MNTH=0x8 YEAR=0x7de kfdhdb.grpstmp.lo: 811466752 ; 0x0e8: USEC=0x0 MSEC=0x380 SECS=0x5 MINS=0xc kfdhdb.vfstart: 0 ; 0x0ec: 0x00000000 kfdhdb.vfend: 0 ; 0x0f0: 0x00000000 kfdhdb.spfile: 0 ; 0x0f4: 0x00000000 kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000 kfdhdb.ub4spare[0]: 0 ; 0x0fc: 0x00000000 kfdhdb.ub4spare[1]: 0 ; 0x100: 0x00000000 .... kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000 kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000 kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000 kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000
上面对disk header 关键部分作了解释,关于这个命令不指定参数是默认是aun=0 blkn=0 因此 kfed read /dev/asm-diskb aun=0 blkn=0 也可以得到同样的结果
disk header的内容非常重要,如果disk header损坏,asm磁盘组将无法mount,下面通过3种方法描述disk header 备份恢复
一,使用linux dd命令
1)创建磁盘组
SQL> CREATE DISKGROUP diter2 EXTERNAL REDUNDANCY DISK '/dev/asm-diskj' ATTRIBUTE 'compatible.asm' = '11.2.0.0.0'; Diskgroup created.
2)备份,注意前面看到disk heard 块大小是4096
[root@localhost ~]# dd if=/dev/asm-diskj of=/tmp/disk_header.bak bs=4096 count=1 1+0 records in 1+0 records out 4096 bytes (4.1 kB) copied, 0.000115 seconds, 35.6 MB/s
3)同样使用dd命令破坏 disk header
[root@localhost ~]# dd if=/dev/zero of=/dev/asm-diskj bs=4096 count=1 1+0 records in 1+0 records out 4096 bytes (4.1 kB) copied, 2.2e-05 seconds, 186 MB/s
4) 重启后发现diter2无法mount
SQL> startup; ASM instance started Total System Global Area 283930624 bytes Fixed Size 2212656 bytes Variable Size 256552144 bytes ASM Cache 25165824 bytes ORA-15032: not all alterations performed ORA-15017: diskgroup "DITER2" cannot be mounted ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DITER2" ORA-15080: synchronous I/O operation to a disk failed
5)通过kfed工具
[root@localhost ~]# kfed read /dev/asm-diskj kfbh.endian: 0 ; 0x000: 0x00 kfbh.hard: 0 ; 0x001: 0x00 kfbh.type: 0 ; 0x002: KFBTYP_INVALID kfbh.datfmt: 0 ; 0x003: 0x00 kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0 kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0 kfbh.check: 0 ; 0x00c: 0x00000000 kfbh.fcn.base: 0 ; 0x010: 0x00000000 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 ERROR!!!, failed to get the oracore error message
6)恢复
[root@localhost ~]# dd if=/tmp/disk_header.bak of=/dev/asm-diskj bs=4096 count=1 1+0 records in 1+0 records out 4096 bytes (4.1 kB) copied, 0.008171 seconds, 501 kB/s -- 恢复后发现可以成功mount SQL> alter diskgroup diter2 mount; Diskgroup altered.
二,通过kfed 备份恢复
1) 备份
[root@localhost ~]# kfed read /dev/asm-diskj text=/tmp/disk_header2.bak [root@localhost ~]# cat /tmp/disk_header2.bak kfbh.endian: 1 ; 0x000: 0x01 kfbh.hard: 130 ; 0x001: 0x82 kfbh.type: 1 ; 0x002: KFBTYP_DISKHEAD kfbh.datfmt: 1 ; 0x003: 0x01 kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0 kfbh.block.obj: 2147483648 ; 0x008: TYPE=0x8 NUMB=0x0 kfbh.check: 247870715 ; 0x00c: 0x0ec634fb kfbh.fcn.base: 0 ; 0x010: 0x00000000 kfbh.fcn.wrap: 0 ; 0x014: 0x00000000 kfbh.spare1: 0 ; 0x018: 0x00000000 kfbh.spare2: 0 ; 0x01c: 0x00000000 kfdhdb.driver.provstr: ORCLDISK ; 0x000: length=8 kfdhdb.driver.reserved[0]: 0 ; 0x008: 0x00000000 kfdhdb.driver.reserved[1]: 0 ; 0x00c: 0x00000000 kfdhdb.driver.reserved[2]: 0 ; 0x010: 0x00000000 kfdhdb.driver.reserved[3]: 0 ; 0x014: 0x00000000 kfdhdb.driver.reserved[4]: 0 ; 0x018: 0x00000000 kfdhdb.driver.reserved[5]: 0 ; 0x01c: 0x00000000 kfdhdb.compat: 186646528 ; 0x020: 0x0b200000 kfdhdb.dsknum: 0 ; 0x024: 0x0000 kfdhdb.grptyp: 1 ; 0x026: KFDGTP_EXTERNAL kfdhdb.hdrsts: 3 ; 0x027: KFDHDR_MEMBER kfdhdb.dskname: DITER2_0000 ; 0x028: length=11 kfdhdb.grpname: DITER2 ; 0x048: length=6 kfdhdb.fgname: DITER2_0000 ; 0x068: length=11 kfdhdb.capname: ; 0x088: length=0 kfdhdb.crestmp.hi: 33006692 ; 0x0a8: HOUR=0x4 DAYS=0x3 MNTH=0x9 YEAR=0x7de kfdhdb.crestmp.lo: 3585968128 ; 0x0ac: USEC=0x0 MSEC=0x362 SECS=0x1b MINS=0x35 kfdhdb.mntstmp.hi: 33006692 ; 0x0b0: HOUR=0x4 DAYS=0x3 MNTH=0x9 YEAR=0x7de kfdhdb.mntstmp.lo: 3730122752 ; 0x0b4: USEC=0x0 MSEC=0x14a SECS=0x25 MINS=0x37 kfdhdb.secsize: 512 ; 0x0b8: 0x0200 kfdhdb.blksize: 4096 ; 0x0ba: 0x1000 kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000 kfdhdb.mfact: 113792 ; 0x0c0: 0x0001bc80 kfdhdb.dsksize: 3072 ; 0x0c4: 0x00000c00 kfdhdb.pmcnt: 2 ; 0x0c8: 0x00000002 kfdhdb.fstlocn: 1 ; 0x0cc: 0x00000001 kfdhdb.altlocn: 2 ; 0x0d0: 0x00000002 kfdhdb.f1b1locn: 2 ; 0x0d4: 0x00000002 kfdhdb.redomirrors[0]: 0 ; 0x0d8: 0x0000 kfdhdb.redomirrors[1]: 0 ; 0x0da: 0x0000 kfdhdb.redomirrors[2]: 0 ; 0x0dc: 0x0000 kfdhdb.redomirrors[3]: 0 ; 0x0de: 0x0000 kfdhdb.dbcompat: 168820736 ; 0x0e0: 0x0a100000 kfdhdb.grpstmp.hi: 33006692 ; 0x0e4: HOUR=0x4 DAYS=0x3 MNTH=0x9 YEAR=0x7de kfdhdb.grpstmp.lo: 3585892352 ; 0x0e8: USEC=0x0 MSEC=0x318 SECS=0x1b MINS=0x35 kfdhdb.vfstart: 0 ; 0x0ec: 0x00000000 kfdhdb.vfend: 0 ; 0x0f0: 0x00000000 kfdhdb.spfile: 0 ; 0x0f4: 0x00000000 kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000 kfdhdb.ub4spare[0]: 0 ; 0x0fc: 0x00000000 kfdhdb.ub4spare[1]: 0 ; 0x100: 0x00000000 .. kfdhdb.ub4spare[53]: 0 ; 0x1d0: 0x00000000 kfdhdb.acdb.aba.seq: 0 ; 0x1d4: 0x00000000 kfdhdb.acdb.aba.blk: 0 ; 0x1d8: 0x00000000 kfdhdb.acdb.ents: 0 ; 0x1dc: 0x0000 kfdhdb.acdb.ub2spare: 0 ; 0x1de: 0x0000
2) 破坏
[root@localhost ~]# dd if=/dev/zero of=/dev/asm-diskj bs=4096 count=1 1+0 records in 1+0 records out 4096 bytes (4.1 kB) copied, 1.8e-05 seconds, 228 MB/s
3)恢复
[root@localhost ~]# kfed merge /dev/asm-diskj text=/tmp/disk_header2.bak [root@localhost ~]# SQL> startup; ASM instance started Total System Global Area 283930624 bytes Fixed Size 2212656 bytes Variable Size 256552144 bytes ASM Cache 25165824 bytes ORA-15032: not all alterations performed ORA-15017: diskgroup "DITER2" cannot be mounted ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DITER2" ORA-15080: synchronous I/O operation to a disk failed SQL> alter diskgroup diter2 mount; Diskgroup altered.
三 使用asmcmd的md_backup和md_restore命令备份恢复
1) 备份
ASMCMD> md_backup /tmp/diter2.bak -G DITER2 Disk group metadata to be backed up: DITER2
2)破坏
[root@localhost ~]# dd if=/dev/zero of=/dev/asm-diskj bs=4096 count=1 1+0 records in 1+0 records out 4096 bytes (4.1 kB) copied, 1.8e-05 seconds, 228 MB/s
3)恢复
ASMCMD> md_restore /tmp/diter2.bak --full -G diter2 ORA-03135: connection lost contact Process ID: 27387 Session ID: 17 Serial number: 14 (DBD ERROR: OCIStmtExecute/Describe) [grid@localhost ~]$ asmcmd ASMCMD> md_restore /tmp/diter2.bak --full -G diter2 Current Diskgroup metadata being restored: DITER2 Diskgroup DITER2 created! System template AUTOBACKUP modified! System template ONLINELOG modified! System template OCRBACKUP modified! System template ASMPARAMETERBAKFILE modified! System template ASMPARAMETERFILE modified! System template ASM_STALE modified! System template PARAMETERFILE modified! System template OCRFILE modified! System template CHANGETRACKING modified! System template ARCHIVELOG modified! System template DUMPSET modified! System template TEMPFILE modified! System template XTRANSPORT modified! System template FLASHBACK modified! System template DATAGUARDCONFIG modified! System template DATAFILE modified! System template CONTROLFILE modified! System template BACKUPSET modified! System template FLASHFILE modified! 注意这里恢复后磁盘组会自动mount, 如果在恢复过程中报下面错误 ASMCMD> md_restore /tmp/diter2.bak --full -G diter2 Current Diskgroup metadata being restored: DITER2 ASMCMD-09352: CREATE DISKGROUP failed ORA-15018: diskgroup cannot be created ORA-15283: ASM operation requires compatible.rdbms of 11.1.0.7.0 or higher (DBD ERROR: OCIStmtExecu 将compatible.rdbms更改为11.2就可以了 alter diskgroup FRA set attribute 'compatible.rdbms'='11.2';
下面是通过md_bakcup 备份的文件内容,可以看到是备份了整个asm disk 的 metadata,所以asm元数据全部破坏,我们也可以恢复它
[root@localhost ~]# cat /tmp/diter2.bak @diskgroup_set = ( { 'ATTRINFO' => { 'TEMPLATE.OCRBACKUP.REDUNDANCY' => '17', 'TEMPLATE.PARAMETERFILE.MIRROR_REGION' => '0', 'TEMPLATE.TEMPFILE.REDUNDANCY' => '17', 'TEMPLATE.TEMPFILE.MIRROR_REGION' => '0', 'TEMPLATE.PARAMETERFILE.REDUNDANCY' => '17', 'SECTOR_SIZE' => '512', 'TEMPLATE.DATAGUARDCONFIG.REDUNDANCY' => '17', 'ACCESS_CONTROL.UMASK' => '066', 'TEMPLATE.ASM_STALE.STRIPE' => '0', 'TEMPLATE.ARCHIVELOG.STRIPE' => '0', 'TEMPLATE.DATAGUARDCONFIG.PRIMARY_REGION' => '0', 'TEMPLATE.OCRBACKUP.STRIPE' => '0', 'TEMPLATE.DATAFILE.STRIPE' => '0', 'AU_SIZE' => '1048576', 'TEMPLATE.ASMPARAMETERFILE.STRIPE' => '0', 'TEMPLATE.CHANGETRACKING.PRIMARY_REGION' => '0', 'TEMPLATE.CONTROLFILE.REDUNDANCY' => '17', 'TEMPLATE.FLASHFILE.STRIPE' => '0', 'TEMPLATE.BACKUPSET.PRIMARY_REGION' => '0', 'TEMPLATE.ARCHIVELOG.PRIMARY_REGION' => '0', 'TEMPLATE.CHANGETRACKING.STRIPE' => '0', 'TEMPLATE.ONLINELOG.PRIMARY_REGION' => '0', 'TEMPLATE.CHANGETRACKING.REDUNDANCY' => '17', 'TEMPLATE.BACKUPSET.STRIPE' => '0', 'TEMPLATE.OCRFILE.MIRROR_REGION' => '0', 'DISK_REPAIR_TIME' => '3.6h', 'TEMPLATE.AUTOBACKUP.REDUNDANCY' => '17', 'TEMPLATE.DUMPSET.REDUNDANCY' => '17', 'TEMPLATE.FLASHBACK.MIRROR_REGION' => '0', 'TEMPLATE.DUMPSET.MIRROR_REGION' => '0', 'TEMPLATE.DUMPSET.PRIMARY_REGION' => '0', 'TEMPLATE.ASM_STALE.REDUNDANCY' => '17', 'TEMPLATE.FLASHBACK.PRIMARY_REGION' => '0', 'TEMPLATE.CONTROLFILE.STRIPE' => '1', 'TEMPLATE.DATAFILE.REDUNDANCY' => '17', 'TEMPLATE.XTRANSPORT.REDUNDANCY' => '17', 'TEMPLATE.AUTOBACKUP.PRIMARY_REGION' => '0', 'TEMPLATE.CONTROLFILE.MIRROR_REGION' => '0', 'TEMPLATE.DATAFILE.PRIMARY_REGION' => '0', 'TEMPLATE.ASMPARAMETERFILE.REDUNDANCY' => '17', 'TEMPLATE.FLASHFILE.MIRROR_REGION' => '0', 'TEMPLATE.ASM_STALE.MIRROR_REGION' => '0', 'TEMPLATE.FLASHBACK.REDUNDANCY' => '17', 'TEMPLATE.DATAGUARDCONFIG.STRIPE' => '0', 'CELL.SMART_SCAN_CAPABLE' => 'FALSE', 'TEMPLATE_VERSION' => '186646528', 'TEMPLATE.PARAMETERFILE.STRIPE' => '0', 'TEMPLATE.DATAFILE.MIRROR_REGION' => '0', 'TEMPLATE.PARAMETERFILE.PRIMARY_REGION' => '0', 'TEMPLATE.BACKUPSET.MIRROR_REGION' => '0', 'TEMPLATE.OCRBACKUP.MIRROR_REGION' => '0', 'TEMPLATE.ONLINELOG.REDUNDANCY' => '17', 'TEMPLATE.ASMPARAMETERBAKFILE.STRIPE' => '0', 'ACCESS_CONTROL.ENABLED' => 'FALSE', 'TEMPLATE.DATAGUARDCONFIG.MIRROR_REGION' => '0', 'TEMPLATE.TEMPFILE.PRIMARY_REGION' => '0', 'COMPATIBLE.RDBMS' => '11.2', 'TEMPLATE.FLASHFILE.PRIMARY_REGION' => '0', 'TEMPLATE.ONLINELOG.MIRROR_REGION' => '0', 'TEMPLATE.FLASHFILE.REDUNDANCY' => '17', 'TEMPLATE.OCRBACKUP.PRIMARY_REGION' => '0', 'TEMPLATE.OCRFILE.STRIPE' => '0', 'TEMPLATE.AUTOBACKUP.MIRROR_REGION' => '0', 'TEMPLATE.ASM_STALE.PRIMARY_REGION' => '0', 'TEMPLATE.ASMPARAMETERBAKFILE.PRIMARY_REGION' => '0', 'TEMPLATE.XTRANSPORT.PRIMARY_REGION' => '0', 'TEMPLATE.DUMPSET.STRIPE' => '0', 'TEMPLATE.TEMPFILE.STRIPE' => '0', 'TEMPLATE.OCRFILE.PRIMARY_REGION' => '0', 'TEMPLATE.ONLINELOG.STRIPE' => '0', 'TEMPLATE.ARCHIVELOG.REDUNDANCY' => '17', 'TEMPLATE.OCRFILE.REDUNDANCY' => '17', 'TEMPLATE.ARCHIVELOG.MIRROR_REGION' => '0', 'TEMPLATE.ASMPARAMETERFILE.MIRROR_REGION' => '0', 'TEMPLATE.FLASHBACK.STRIPE' => '0', 'TEMPLATE.CONTROLFILE.PRIMARY_REGION' => '0', 'TEMPLATE.XTRANSPORT.MIRROR_REGION' => '0', 'TEMPLATE.BACKUPSET.REDUNDANCY' => '17', 'TEMPLATE.ASMPARAMETERBAKFILE.REDUNDANCY' => '17', 'TEMPLATE.XTRANSPORT.STRIPE' => '0', 'TEMPLATE.CHANGETRACKING.MIRROR_REGION' => '0', 'COMPATIBLE.ASM' => '11.2.0.0.0', 'TEMPLATE.ASMPARAMETERBAKFILE.MIRROR_REGION' => '0', 'TEMPLATE.ASMPARAMETERFILE.PRIMARY_REGION' => '0', 'TEMPLATE.AUTOBACKUP.STRIPE' => '0' }, 'DISKSINFO' => { 'DITER2_0000' => { 'DITER2_0000' => { 'TOTAL_MB' => '3072', 'FAILGROUP' => 'DITER2_0000', 'NAME' => 'DITER2_0000', 'DGNAME' => 'DITER2', 'PATH' => '/dev/asm-diskj' } } }, 'DGINFO' => { 'DGTORESTORE' => 0, 'DGCOMPAT' => '11.2.0.0.0', 'DGNAME' => 'DITER2', 'DGDBCOMPAT' => '11.2.0.0.0', 'DGTYPE' => 'EXTERN', 'DGAUSZ' => '1048576' }, 'ALIASINFO' => {}, 'TEMPLATEINFO' => { '11' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'AUTOBACKUP', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '7' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'ONLINELOG', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '2' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'ASMPARAMETERBAKFILE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '17' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'OCRBACKUP', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '1' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'ASMPARAMETERFILE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '18' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'ASM_STALE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '0' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'PARAMETERFILE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '16' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'OCRFILE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '13' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'CHANGETRACKING', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '6' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'ARCHIVELOG', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '3' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'DUMPSET', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '9' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'TEMPFILE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '12' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'XTRANSPORT', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '14' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'FLASHBACK', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '15' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'DATAGUARDCONFIG', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '8' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'DATAFILE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '4' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'FINE', 'TEMPNAME' => 'CONTROLFILE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '10' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'BACKUPSET', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' }, '5' => { 'DGNAME' => 'DITER2', 'STRIPE' => 'COARSE', 'TEMPNAME' => 'FLASHFILE', 'REDUNDANCY' => 'UNPROT', 'SYSTEM' => 'Y' } } } ); 关于md_resotre 命令我们也可以生成sql脚本恢复 ASMCMD> md_restore -h Unknown option: h usage: md_restore <backup_file> [--silent] [--full|--nodg|--newdg] [-S <sql_script_file>] [-G '<diskgroup_name>,<diskgroup_name>,...'] [-o '<old_diskgroup_name>:<new_diskgroup_name>,...'] help: help md_restore ASMCMD> md_restore -S /tmp/diter2.sql /tmp/diter2.bak Current Diskgroup metadata being restored: DITER2 ASMCMD> quit [grid@localhost ~]$ cat /tmp/diter2.sql create diskgroup DITER2 EXTERNAL redundancy disk '/dev/asm-diskj' name DITER2_0000 size 3072M attribute 'compatible.asm' = '11.2.0.0.0' , 'compatible.rdbms' = '11.2' , 'au_size' = '1048576', 'sector_size' = '512', 'cell.smart_scan_capable' = 'FALSE'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.TEMPFILE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.PARAMETERFILE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.OCRBACKUP.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.TEMPFILE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.PARAMETERFILE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DATAGUARDCONFIG.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'ACCESS_CONTROL.UMASK' = '066'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASM_STALE.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ARCHIVELOG.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DATAGUARDCONFIG.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.OCRBACKUP.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DATAFILE.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.CONTROLFILE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASMPARAMETERFILE.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.CHANGETRACKING.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.BACKUPSET.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.FLASHFILE.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ARCHIVELOG.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.CHANGETRACKING.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ONLINELOG.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.CHANGETRACKING.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.BACKUPSET.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.OCRFILE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'DISK_REPAIR_TIME' = '3.6h'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.AUTOBACKUP.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DUMPSET.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.FLASHBACK.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DUMPSET.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DUMPSET.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASM_STALE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.FLASHBACK.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.XTRANSPORT.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DATAFILE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.CONTROLFILE.STRIPE' = '1'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.AUTOBACKUP.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.CONTROLFILE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DATAFILE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.FLASHFILE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASMPARAMETERFILE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASM_STALE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.FLASHBACK.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DATAGUARDCONFIG.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE_VERSION' = '186646528'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.PARAMETERFILE.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DATAFILE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.PARAMETERFILE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.BACKUPSET.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.OCRBACKUP.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ONLINELOG.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASMPARAMETERBAKFILE.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'ACCESS_CONTROL.ENABLED' = 'FALSE'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DATAGUARDCONFIG.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.TEMPFILE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.FLASHFILE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ONLINELOG.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.FLASHFILE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.OCRBACKUP.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.OCRFILE.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.AUTOBACKUP.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASM_STALE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.XTRANSPORT.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASMPARAMETERBAKFILE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.DUMPSET.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.TEMPFILE.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.OCRFILE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.OCRFILE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ARCHIVELOG.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ONLINELOG.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ARCHIVELOG.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.FLASHBACK.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASMPARAMETERFILE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.XTRANSPORT.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.CONTROLFILE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.BACKUPSET.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.XTRANSPORT.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASMPARAMETERBAKFILE.REDUNDANCY' = '17'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.CHANGETRACKING.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASMPARAMETERFILE.PRIMARY_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.ASMPARAMETERBAKFILE.MIRROR_REGION' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 set attribute 'TEMPLATE.AUTOBACKUP.STRIPE' = '0'; alter diskgroup /*ASMCMD AMBR*/DITER2 alter template AUTOBACKUP attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template ONLINELOG attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template OCRBACKUP attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template ASMPARAMETERBAKFILE attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template ASMPARAMETERFILE attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template ASM_STALE attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template PARAMETERFILE attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template OCRFILE attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template CHANGETRACKING attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template ARCHIVELOG attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template DUMPSET attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template TEMPFILE attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template XTRANSPORT attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template FLASHBACK attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template DATAGUARDCONFIG attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template DATAFILE attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template CONTROLFILE attributes (UNPROTECTED FINE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template BACKUPSET attributes (UNPROTECTED COARSE); alter diskgroup /*ASMCMD AMBR*/DITER2 alter template FLASHFILE attributes (UNPROTECTED COARSE);
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。