redhat 6.5之oracle 11.2.0.4 asm例項異常抽取asm配置資訊之amdu初識之一

wisdomone1發表於2017-06-02
測試結論
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部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-2140234/,如需轉載,請註明出處,否則將追究法律責任。

相關文章