ITPub博客

首页 > 数据库 > Oracle > redhat 6.5之oracle 11.2.0.4 asm实例异常抽取asm配置信息之amdu初识之一

redhat 6.5之oracle 11.2.0.4 asm实例异常抽取asm配置信息之amdu初识之一

原创 Oracle 作者:wisdomone1 时间:2017-06-02 21:11:52 0 删除 编辑
测试结论
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 .: 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
    _.f  where is the diskgroup name
    in uppercase, and 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




SQL> r
  1* select group_number,file_number,name from v$asm_alias where group_number=2 and name like '%USER%'


GROUP_NUMBER FILE_NUMBER NAME
------------ ----------- ----------------------------------------------------------------------
           2         264 USERS.264.943993235
           2         280 USERS.280.944915681




[grid@zxy ~]$ amdu -diskstring '/dev/asm*' -extract dg_mount.280
amdu_2017_06_02_21_08_51/
AMDU-00204: Disk N0002 is in currently mounted diskgroup DG_MOUNT
AMDU-00201: Disk N0002: '/dev/asm_mount'




SQL> alter diskgroup dg_mount dismount;


Diskgroup altered.




9,可见-EXTRACT的参数值为    ASM磁盘组名称.file_number
(注:取自于v$asm_alias
[grid@zxy ~]$ amdu -diskstring '/dev/asm*' -extract dg_mount.280
amdu_2017_06_02_21_09_45/




10,AMDU会产生一个如下提示的文件夹,且包括2个文件
[grid@zxy ~]$ pwd
/home/grid
[grid@zxy ~]$ ls -l amdu_2017_06_02_21_09_45
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
[grid@zxy ~]$ 




11,一个文件无法读取,另一个文件即为ASM的元数据配置即REPORT.TXT
[grid@zxy ~]$ cd amdu_2017_06_02_21_09_45
[grid@zxy 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
[grid@zxy amdu_2017_06_02_21_09_45]$ 




[grid@zxy amdu_2017_06_02_21_09_45]$ more report.txt 
-*-amdu-*-


******************************* AMDU Settings ********************************
ORACLE_HOME = /u01/app/11.2.0.4/grid
System name:    Linux
Node name:      zxy
Release:        2.6.32-431.el6.x86_64
Version:        #1 SMP Sun Nov 10 22:19:54 EST 2013
Machine:        x86_64
amdu run:       02-JUN-17 21:09:45
Endianess:      1


--------------------------------- Operations ---------------------------------
    -extract DG_MOUNT.280


------------------------------- Disk Selection -------------------------------
 -diskstring '/dev/asm*'


------------------------------ Reading Control -------------------------------


------------------------------- Output Control -------------------------------


********************************* DISCOVERY **********************************


----------------------------- DISK REPORT N0001 ------------------------------
                Disk Path: /dev/asm_base
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 10240 megabytes
               Group Name: DG_MOUNT
                Disk Name: DG_MOUNT_0001
       Failure Group Name: DG_MOUNT_0001
              Disk Number: 1
            Header Status: 3
       Disk Creation Time: 2017/05/25 12:27:09.072000
          Last Mount Time: 2017/06/02 21:06:08.296000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 10240 AUs
         Group Redundancy: 1
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2017/05/14 17:08:52.411000
  File 1 Block 1 location: AU 0
              OCR Present: NO


----------------------------- DISK REPORT N0002 ------------------------------
                Disk Path: /dev/asm_mount
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 10240 megabytes
               Group Name: DG_MOUNT
                Disk Name: DG_MOUNT_0000
       Failure Group Name: DG_MOUNT_0000
              Disk Number: 0
            Header Status: 3
       Disk Creation Time: 2017/05/14 17:08:52.593000
          Last Mount Time: 2017/06/02 21:06:08.296000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 10240 AUs
         Group Redundancy: 1
      Metadata Block Size: 4096 bytes
                  AU Size: 1048576 bytes
                   Stride: 113792 AUs
      Group Creation Time: 2017/05/14 17:08:52.411000
  File 1 Block 1 location: AU 2
              OCR Present: NO


----------------------------- DISK REPORT N0003 ------------------------------
                Disk Path: /dev/asm_ocrvote
           Unique Disk ID: 
               Disk Label: 
     Physical Sector Size: 512 bytes
                Disk Size: 5120 megabytes
               Group Name: ASM_OCRVOTE
                Disk Name: ASM_OCRVOTE_0000
       Failure Group Name: ASM_OCRVOTE_0000
              Disk Number: 0
            Header Status: 3
       Disk Creation Time: 2017/05/14 03:10:37.298000
          Last Mount Time: 2017/06/02 19:24:34.499000
    Compatibility Version: 0x0b200000(11020000)
         Disk Sector Size: 512 bytes
         Disk size in AUs: 2560 AUs
         Group Redundancy: 1
      Metadata Block Size: 4096 bytes
                  AU Size: 2097152 bytes
                   Stride: 228480 AUs
      Group Creation Time: 2017/05/14 03:10:37.213000
  File 1 Block 1 location: AU 2
              OCR Present: NO


***************** Slept for 6 seconds waiting for heartbeats *****************


************************ SCANNING DISKGROUP DG_MOUNT *************************
            Creation Time: 2017/05/14 17:08:52.411000
         Disks Discovered: 2
               Redundancy: 1
                  AU Size: 1048576 bytes
      Metadata Block Size: 4096 bytes
     Physical Sector Size: 512 bytes
          Metadata Stride: 113792 AU
   Duplicate Disk Numbers: 0




---------------------------- SCANNING DISK N0002 -----------------------------
Disk N0002: '/dev/asm_mount'
           Allocated AU's: 2659
                Free AU's: 7581
       AU's read for dump: 0
       Block images saved: 0
        Map lines written: 0
          Heartbeats seen: 0
  Corrupt metadata blocks: 0
        Corrupt AT blocks: 0






[grid@zxy amdu_2017_06_02_21_09_45]$ strings DG_MOUNT_280.f 
}|{z
0]8Z
USERS
{F]8


           
12,上述是ASM实例在启动时抽取ASM磁盘文件,现在关闭ASM实例


[grid@zxy ~]$ sqlplus '/as sysasm'


SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 2 21:38:36 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 Automatic Storage Management option


SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown


13,抽取ASM 磁盘文件,可见以当前日期时间命名创建的文件夹
[grid@zxy ~]$ amdu -diskstring '/dev/asm*' -extract dg_mount.280
amdu_2017_06_02_21_39_57/




[grid@zxy ~]$ date
Fri Jun  2 21:40:30 CST 2017




13




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-2140234/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12689897