Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » ASM

如何计算ASM磁盘头自动备份的位置

从10.2.0.5开始Oracle增加了自动备份asm disk header的功能,Oracle ACED Kamus通过truss kfed repair,找出了ASM备份磁盘头的位置:第二个AU的倒数第二个block。通过这个算法,我们可以计算出不同AU,磁盘头的位置:
 1M AU:510
 2M AU:1022
 4M AU:2046
 8M AU:4094
16M AU:8190
32M AU:16382
64M AU:32766

通过下面的脚本可获取备份磁盘头的block number
SQL> col compatibility for a11
SQL> col database_compatibility for a11
col path for a30
SQL> SQL> set pages 156 lines 156
col header_backup_location for a70
SQL> SQL> select 'kfed read '||path||' ausz='||allocation_unit_size||' blknum='||((allocation_unit_size/block_size)*2-2) header_backup_location from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and a.group_number !=0;

HEADER_BACKUP_LOCATION
----------------------------------------------------------------------
kfed read /dev/oracleasm/disks/ASMDISK14 ausz=16777216 blknum=8190
kfed read /dev/oracleasm/disks/ASMDISK10 ausz=16777216 blknum=8190
kfed read /dev/oracleasm/disks/ASMDISK9 ausz=4194304 blknum=2046
kfed read /dev/oracleasm/disks/ASMDISK3 ausz=1048576 blknum=510
kfed read /dev/oracleasm/disks/ASMDISK2 ausz=1048576 blknum=510
kfed read /dev/oracleasm/disks/ASMDISK1 ausz=1048576 blknum=510

6 rows selected.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production

With the Real Application Clusters and Automatic Storage Management options


在AU大小为1M,4M,16M下查看,字段kfbh.type内容为KFBTYP_DISKHEAD,表示为磁盘头部

[oracle@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASMDISK14 ausz=16777216 blknum=8190|grep kfbh.type
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
[oracle@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASMDISK14 ausz=16777216 blknum=0|grep kfbh.type
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
[oracle@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASMDISK14 ausz=16777216 blknum=8190|grep kfbh.type
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
[oracle@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASMDISK9 ausz=4194304 blknum=0 |grep kfbh.type
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
[oracle@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASMDISK9 ausz=4194304 blknum=2046|grep kfbh.type
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
[oracle@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASMDISK1 ausz=1048576 blknum=0|grep kfbh.type
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
[oracle@ohs1 ~]$ kfed read /dev/oracleasm/disks/ASMDISK1 ausz=1048576 blknum=510|grep kfbh.type
kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD
[oracle@ohs1 ~]$


获取ASM磁盘头备份位置的脚本

col compatibility for a11
col database_compatibility for a11
col path for a30
set pages 156 lines 156
col header_backup_location for a70
select 'kfed read '||path||' ausz='||allocation_unit_size||' blknum='||((allocation_unit_size/block_size)*2-2) header_backup_location from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and a.group_number !=0;
     
      
col compatibility for a11
col database_compatibility for a11
col path for a30
set pages 156 lines 156
col header_backup_location for a70
select mount_status,header_status,mode_status,a.state,redundancy,b.sector_size,block_size,allocation_unit_size au_size,compatibility,database_compatibility,'kfed read '||path||' ausz='||allocation_unit_size||' blknum='||((allocation_unit_size/block_size)*2-2) header_backup_location from v$asm_disk a,v$asm_diskgroup b
where a.group_number=b.group_number
      and a.group_number !=0;
      
      
Reference

http://www.dbform.com/html/2012/1875.html



关键词:asm 

相关文章

Oracle ASM from 10g to 18c
在18c中通过ASM Flex DiskGroup克隆PDB
Exadata and ASM
Oracle ASM Storage Limits
12c 如何将Standard ASM转化为Flex ASM
How to use amdu(ASM Metadata Dump Utility)
How to use kfed(Kernel Files metadata Editor)
How to use kfod(Kernel Files OSM Disk)
如何计算ASM磁盘头自动备份的位置
What is disk_repair_time?
Find block in ASM
12c新特性ASMFD
Top