测试结论
1,基于redhat 6.5,v$asm_alias可以获取ASM FILE的GROUP NUMBER以及FILE NUMBER
2,AMDU工具可以在ASM实例关闭抽取ASM 磁盘文件,即可以藜取ASM的元数据配置信息
3,抽取的结果会新创建一个文件夹,形式如下:
grid@zxy ~]$ amdu -diskstring '/dev/asm*' -extract dg_mount.280
amdu_2017_06_02_21_09_45/
[grid@zxy amdu_2017_06_02_21_09_45]$ ls -l
total 5136
-rw-r--r--. 1 grid oinstall 5251072 Jun 2 21:09 DG_MOUNT_280.f
-rw-r--r--. 1 grid oinstall 5877 Jun 2 21:09 report.txt
4,report.txt用于存储ASM配置元数据信息
5,另一个文件不可读
6,amdu -help可以获取具体的语法信息
7,续 上述 第 3,其参数 -extract asm磁盘组.file_number,为固定格式,否则会报错
AMDU-00210: No disks found in diskgroup ASM类似的错误,具体信息见测试明细相关
8,amdu必须先要DISMOUNT磁盘组,否则也会报错
AMDU-00204: Disk N0001 is in currently mounted diskgroup DG_MOUNT
9,一定要先梳理AMDU的概念及使用场景,也就是说不要先去用,必须先把基础功作好了,不然永远就是头痛医头,脚痛医脚的普通水平
10,数据库版本为oracle 11.2.0.4
测试明细
1,查看ASM FILE的ASM磁盘组及ASM FILE映射关系
SQL> select name,group_number,file_number from v$asm_alias where name like '%USER%' order by 2,3,name;
NAME GROUP_NUMBER FILE_NUMBER
---------------------------------------------------------------------- ------------ -----------
USERS.264.943993235 2 264
USERS.280.944915681 2 280
2,查看ASM磁盘组配置文件
[grid@zxy ~]$ more etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sdb",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdb",RESULT=="1ATA_VBOX_HARDDISK_VB064152c0-89688a5f",NAME="asm_ocrvote",OWNER="g
rid",GROUP="asmadmin",MODE="0660"
KERNEL=="sdc",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc",RESULT=="1ATA_VBOX_HARDDISK_VBfa2191a6-5377b087",NAME="asm_mount",OWNER="gri
d",GROUP="asmadmin",MODE="0660"
KERNEL=="sdd",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdd",RESULT=="1ATA_VBOX_HARDDISK_VB6eb45221-d71c1c4a",NAME="asm_base",OWNER="grid
",GROUP="asmadmin",MODE="0660"
3,使用amdu抽取ASM磁盘文件到另一个文件中
[grid@zxy ~]$ amdu -diskstring '/dev/sdc' -extract 'asm.test'
amdu_2017_06_02_20_47_18/
AMDU-00210: No disks found in diskgroup ASM
AMDU-00210: No disks found in diskgroup ASM
4,获取ASM磁盘文件中的ASM磁盘组名称
[grid@zxy ~]$ kfed read /dev/asm_mount|grep -i --color grpname
kfdhdb.grpname: DG_MOUNT ; 0x048: length=8
5,提示ASM磁盘组正在MOUNT
[grid@zxy ~]$ amdu -diskstring '/dev/asm_mount' -extract 'dg_mount.dbf'
amdu_2017_06_02_20_55_22/
AMDU-00204: Disk N0001 is in currently mounted diskgroup DG_MOUNT
AMDU-00201: Disk N0001: '/dev/asm_mount'
AMDU-00209: Corrupt block found: Disk N0001 AU [2] block [0] type [4]
AMDU-00201: Disk N0001: '/dev/asm_mount'
AMDU-00208: File directory block not found. Cannot extract file DG_MOUNT.DBF
6,DISMOUNT ASM磁盘组及数据库实例
[root@zxy ~]# su - oracle
mount: only root can do that
[oracle@zxy ~]$ export ORACLE_SID=god
[oracle@zxy ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 2 20:56:20 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
[root@zxy ~]# su - grid
mount: only root can do that
[grid@zxy ~]$ export ORACLE_SID=+ASM
[grid@zxy ~]$ amdu -diskstring '/dev/asm_mount' -extract 'dg_mount.dbf'
amdu_2017_06_02_20_58_11/
AMDU-00204: Disk N0001 is in currently mounted diskgroup DG_MOUNT
AMDU-00201: Disk N0001: '/dev/asm_mount'
AMDU-00209: Corrupt block found: Disk N0001 AU [2] block [0] type [4]
AMDU-00201: Disk N0001: '/dev/asm_mount'
AMDU-00208: File directory block not found. Cannot extract file DG_MOUNT.DBF
[grid@zxy ~]$
[grid@zxy ~]$
[grid@zxy ~]$
SQL> select group_number,name,state from v$asm_diskgroup;
GROUP_NUMBER NAME STATE
------------ ------------------------------ -----------
1 ASM_OCRVOTE MOUNTED
2 DG_MOUNT MOUNTED
SQL> alter diskgroup dg_mount dismount;
Diskgroup altered.
7,AMDU的选项-EXTRACT的参数值提示报错
[grid@zxy ~]$ amdu -diskstring '/dev/asm_mount' -extract 'dg_mount.dbf'
amdu_2017_06_02_21_00_06/
AMDU-00209: Corrupt block found: Disk N0001 AU [2] block [0] type [4]
AMDU-00201: Disk N0001: '/dev/asm_mount'
AMDU-00208: File directory block not found. Cannot extract file DG_MOUNT.DBF
[grid@zxy ~]$
SQL> show parameter asm_diskstring
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string /dev/asm*
8,根据AMDU命令的语法含义重新执行AMDU
[grid@zxy ~]$ amdu -diskstring '/dev/asm*' -extract 'dg_mount.dbf'
amdu_2017_06_02_21_02_44/
AMDU-00209: Corrupt block found: Disk N0002 AU [2] block [0] type [4]
AMDU-00201: Disk N0002: '/dev/asm_mount'
AMDU-00208: File directory block not found. Cannot extract file DG_MOUNT.DBF
[grid@zxy ~]$ amdu -help > amdu.log
-extract <diskgroup>.<file_number>: This extracts the numbered file
from the named diskgroup, case insensitive. This option may be
specified multiple times to extract multiple files. The extracted
file is placed in the dump directory under the name
<diskgroup>_<number>.f where <diskgroup> is the diskgroup name
in uppercase, and <number> is the file number. The -output option
may be used to write the file to any location. The extracted file
will appear to have the same contents it would have if accessed
through the database. If some portion of the file is unavailable
then that portion of the output file will be filled with
0xBADFDA7A, and a message will appear on stderr.
SQL> select name,group_number from v$asm_diskgroup;
NAME GROUP_NUMBER
------------------------------ ------------
ASM_OCRVOTE 1
DG_MOUNT 2
鉴于篇幅原因,续文请见链接:
http://blog.itpub.net/9240380/viewspace-2140234/




