ITPub博客

首页 > Linux操作系统 > Linux操作系统 > amdu

amdu

原创 Linux操作系统 作者:orayly 时间:2013-01-12 21:50:55 0 删除 编辑
800x600

1.调用amdu

直接调用amdu后会在当前目录下生成个以amdu+日期格式的文件夹, 该目录下生成的报告文件会记录磁盘组的相关信息在这个文件夹下,生成名为report.txt的报告文件,report.txt文件格式如下:

[oracle@rac1 ~]$ amdu

[oracle@rac1 ~]$ cd amdu_2012_08_07_16_31_06/

[oracle@rac1 amdu_2012_08_07_16_31_06]$ ls

report.txt

[oracle@rac1 amdu_2012_08_07_16_31_06]$ cat report.txt

-*-amdu-*-

******************************* AMDU Settings ********************************

ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1

System name:    Linux

Node name:      rac1

Release:        2.6.18-194.el5

Version:        #1 SMP Tue Mar 16 21:52:43 EDT 2010

Machine:        i686

amdu run:       07-AUG-12 16:31:06

Endianess:      1

--------------------------------- Operations ---------------------------------

------------------------------- Disk Selection -------------------------------

 -diskstring ''

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

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

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

----------------------------- DISK REPORT N0001 ------------------------------

                Disk Path: /dev/raw/raw1

           Unique Disk ID:

               Disk Label:

     Physical Sector Size: 512 bytes

                Disk Size: 977 megabytes

               Group Name: CRSDG

                Disk Name: CRSDG_0000

       Failure Group Name: CRSDG_0000

              Disk Number: 0

            Header Status: 3

       Disk Creation Time: 2012/08/06 12:52:20.194000

          Last Mount Time: 2012/08/07 13:39:14.532000

    Compatibility Version: 0x0b200000(11020000)

         Disk Sector Size: 512 bytes

         Disk size in AUs: 977 AUs

         Group Redundancy: 1

      Metadata Block Size: 4096 bytes

                  AU Size: 1048576 bytes

                   Stride: 113792 AUs

      Group Creation Time: 2012/08/06 12:52:20.067000

  File 1 Block 1 location: AU 2

              OCR Present: YES

……                                  

******************************* END OF REPORT ********************************

 

查看ASM磁盘组任意磁盘信息

amdu查看任意asm磁盘的相关信息:

--查看ASM磁盘组下的所有磁盘                                                                                                              

SQL> select b.name group_name, a.name disk_name, a.path                                                                           

  from v$asm_disk a, v$asm_diskgroup b                                                                                                    

 WHERE A.GROUP_NUMBER = B.GROUP_NUMBER                                                                              

 ORDER BY group_name                                                                                                                           

/                                                                                                                                                               

                                                                                                                                                                

GROUP_NAME                     DISK_NAME                      PATH                                 

------------------------------       ------------------------------         ------------------------------                                  

CRSDG                          CRSDG_0000                     /dev/raw/raw1                          

CRSDG                          CRSDG_0001                     /dev/raw/raw2                          

DATADG                         DATADG_0000                    /dev/raw/raw3                         

DATADG                         DATADG_0002                    /dev/raw/raw5                         

DATADG                         DATADG_0001                    /dev/raw/raw4                         

FRADG                          FRADG_0000                     /dev/raw/raw6                         

FRADG                          FRADG_0001                     /dev/raw/raw7                         

                                                                                                                                                                

--使用amdu查看/dev/raw/raw7信息                                                                                                          

                                                                                                                                                                

[oracle@rac1 ~]$ amdu -diskstring /dev/raw/raw7                                                                                         

                                                                                                                                                                

使用上面命令同样会生成一个以amdu+日期格式的文件夹,/dev/raw/raw7磁盘相关信息存放在report.txt文件中。如下所示:                                                                                                                                           

******************************* AMDU Settings ********************************                         

ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1                                                                               

System name:    Linux                                                                                                                             

Node name:      rac1                                                                                                                               

Release:        2.6.18-194.el5                                                                                                                  

Version:        #1 SMP Tue Mar 16 21:52:43 EDT 2010                                                                             

Machine:        i686                                                                                                                               

amdu run:       07-AUG-12 17:10:11                                                                                                       

Endianess:      1                                                                                                                                     

--------------------------------- Operations ---------------------------------                                                                   

------------------------------- Disk Selection -------------------------------                                                                   

 -diskstring '/dev/raw/raw7'                                                                                                                         

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

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

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

----------------------------- DISK REPORT N0001 ------------------------------                                                           

                Disk Path: /dev/raw/raw7

           Unique Disk ID:

               Disk Label:

     Physical Sector Size: 512 bytes

                Disk Size: 5795 megabytes

               Group Name: FRADG

                Disk Name: FRADG_0001

       Failure Group Name: FRADG_0001

              Disk Number: 1

            Header Status: 3

       Disk Creation Time: 2012/08/06 14:14:22.396000

          Last Mount Time: 2012/08/07 13:39:15.853000

    Compatibility Version: 0x0b200000(11020000)

         Disk Sector Size: 512 bytes

         Disk size in AUs: 5795 AUs

         Group Redundancy: 1

      Metadata Block Size: 4096 bytes

                  AU Size: 1048576 bytes

                   Stride: 113792 AUs

      Group Creation Time: 2012/08/06 14:14:22.102000

  File 1 Block 1 location: AU 0

              OCR Present: NO

******************************* END OF REPORT ********************************                     

转储ASM磁盘组信息

在磁盘组不能mount时转储ASM磁盘组信息用于数据库诊断,这里以转诸CRSDG磁盘组信息为例:

--以下命令进行磁盘组信息转储(这里用*号模糊匹配)                                                                           

[oracle@rac1 ~]$amdu  –diskstring  '/dev/raw/raw*'  -dump  'CRSDG'                                                         

[oracle@rac1 ~]$ cd amdu_2012_08_08_10_47_05/                                                                                      

[oracle@rac1 amdu_2012_08_08_10_47_05]$ ls                                                                                           

CRSDG_0001.img  CRSDG.map  report.txt                                                                                               

 

转储CRSDG的磁盘组信息后可以看到,除了报告文件外,还生成了map和img信息文件。IMG文件则是元数据块的镜像转储,为二进制文件,这些文件在ASM出现故障时,可以用于收集信息,分析故障。MAP文件其内容描述了ASM元数据在磁盘组中的位置。

MAP文件的信息如下:

[oracle@rac1 amdu_2012_08_08_10_47_05]$ less CRSDG.map                                                                            

N0001 D0000 R00 A00000000 F00000000 I0 E00000000 U00 C00256 S0001 B0000000000                           

N0001 D0000 R00 A00000001 F00000000 I0 E00000000 U00 C00256 S0001 B0001048576                           

N0001 D0000 R00 A00000002 F00000001 I0 E00000000 U00 C00256 S0001 B0002097152                           

N0001 D0000 R00 A00000003 F00000002 I0 E00000000 U00 C00256 S0001 B0003145728                           

N0001 D0000 R00 A00000004 F00000003 I0 E00000001 U00 C00256 S0001 B0004194304                           

N0001 D0000 R00 A00000005 F00000003 I0 E00000003 U00 C00256 S0001 B0005242880                           

N0001 D0000 R00 A00000006 F00000003 I0 E00000005 U00 C00256 S0001 B0006291456                           

N0001 D0000 R00 A00000007 F00000003 I0 E00000007 U00 C00256 S0001 B0007340032                           

…………

提取数据文件

通过磁盘组名和文件号提取数据库文件。

3.1提取数据文件

利用AMDU从不能mount的ASM磁盘组中往外提取REDO文件。

--在磁盘组不能mount来抽取redo文件group_3.256.790784465                                   

--在磁盘组mount状态下我们可以看到如下REDO文件信息                                                                

[grid@rac2 ~]$ asmcmd                                                                                                                                    

ASMCMD> cd datadg/racdb/ onlinelog                                                                                                         

ASMCMD> ls                                                                                                                                            

group_1.264.790784029                                                                                                                                    

group_2.265.790784039                                                                                                                                    

group_3.256.790784465                                                                                                                                    

group_4.261.790784473                                                                                                                                    

 

停止数据库与ASM实例

[root@rac1 ~]# su – grid                                                                                                                                   

[grid@rac1 ~]$ srvctl stop database -d racdb                                                                                                        

[grid@rac1 ~]$ srvctl stop asm -n rac1 –f                                                                                                     

[grid@rac1 ~]$ srvctl stop asm -n rac2 –f                                                                                                     

[grid@rac1 ~]$ crs_stat –t                                                                                                                           

Name             Type           Target        State      Host                                                  

--------------      ------------------    --------------    --------      ------                                                         

ora.CRSDG.dg    ora....up.type         OFFLINE   OFFLINE                                                           

ora.DATADG.dg   ora....up.type              OFFLINE   OFFLINE                                                           

ora.FRADG.dg    ora....up.type        OFFLINE   OFFLINE                                                           

ora....ER.lsnr       ora....er.type         ONLINE    ONLINE    rac1                                                    

ora....N1.lsnr        ora....er.type          ONLINE    ONLINE    rac2                                                    

ora.asm             ora.asm.type        OFFLINE   OFFLINE                                                           

ora.cvu                    ora.cvu.type        ONLINE    ONLINE    rac2                                                    

ora.gsd             ora.gsd.type         OFFLINE   OFFLINE                                                           

ora....network     ora....rk.type               ONLINE    ONLINE    rac1                                                    

ora.oc4j           ora.oc4j.type        ONLINE    ONLINE    rac2                                                    

ora.ons             ora.ons.type         ONLINE    ONLINE    rac1                                                    

ora....SM1.asm    application          OFFLINE   OFFLINE                                                           

ora....C1.lsnr      application          ONLINE    ONLINE    rac1                                                    

ora.rac1.gsd       application          OFFLINE   OFFLINE                                                           

ora.rac1.ons             application          ONLINE    ONLINE    rac1                                                    

ora.rac1.vip         ora....t1.type         ONLINE    ONLINE    rac1                                                    

ora....SM2.asm      application          OFFLINE   OFFLINE                                                           

ora....C2.lsnr         application          ONLINE    ONLINE    rac2                                                    

ora.rac2.gsd         application          OFFLINE   OFFLINE                                                           

ora.rac2.ons         application          ONLINE    ONLINE    rac2                                                    

ora.rac2.vip         ora....t1.type         ONLINE    ONLINE    rac2                                                     

ora.racdb.db        ora....se.type         OFFLINE   OFFLINE                                                           

ora....ry.acfs          ora....fs.type         OFFLINE   OFFLINE                                                           

ora.scan1.vip        ora....ip.type         ONLINE    ONLINE    rac2                                                         

 

如下显示ASM实例已停掉。

[grid@rac1 ~]$ asmcmd                                                                                                                                    

Connected to an idle instance.                                                                                                                      

ASMCMD> ls                                                                                                                                            

ASMCMD-8102: no connection to ASM; command requires ASM to run                                                         

 

在磁盘组unmount状态下抽取group_3.256.790784465文件为例

-- ‘DATADG.256’ 由磁盘组名称和文件号组成                                                                                           

oracle@rac1 ~]$ amdu -diskstring '/dev/raw/raw*' -extract 'DATADG.256'                                                        

amdu_2012_08_08_11_36_22/                                                                                                                     

[oracle@rac1 ~]$ ls                                                                                                                                           

amdu_2012_08_08_11_36_22                                                                                                                      

[oracle@rac1 ~]$ cd amdu_2012_08_08_11_36_22/                                                                                      

[oracle@rac1 amdu_2012_08_08_11_36_22]$ ls                                                                                           

DATADG_256.f  report.txt                                                                                                                        

 

以看到group_3.256.790784465文件已经被抽取出来,名为DATADG_256.f(命名格式 磁盘组名_文件号.f),同时还会生成一个报告文件。控制文件和其它数据文件提取方法与上面相同。

获取文件号

下面是描述OMF和非OMF方式下获取文件号

我们可以通过查看告警日志来获取控制文件信息,通过提取控制文件来获得数据文件信息。

Using parameter settings in server-side pfile /u01/app/oracle/product/11.2.0/db_1/dbs/initracdb1.ora                   

System parameters with non-default values:

  processes                = 150

  spfile                   = "+DATADG/racdb/spfileracdb.ora"

  memory_target            = 656M

  control_files            = "+DATADG/racdb/controlfile/current.264.790769641"

   db_block_size            = 8192

  compatible               = "11.2.0.0.0"

  cluster_database         = TRUE

  db_create_file_dest      = "+DATADG"

  db_recovery_file_dest    = "+FRADG"

  db_recovery_file_dest_size= 4435M

  thread                   = 1

  undo_tablespace          = "UNDOTBS1"

  instance_number          = 1

  remote_login_passwordfile= "EXCLUSIVE"

  db_domain                = ""

  dispatchers              = "(PROTOCOL=TCP) (SERVICE=racdbXDB)"

  remote_listener          = "scan-ip:1521"

  audit_file_dest          = "/u01/app/oracle/admin/racdb/adump"

  audit_trail              = "DB"

  db_name                  = "racdb"

  open_cursors             = 300

  diagnostic_dest          = "/u01/app/oracle"

 

可以看到在DATADG磁盘组中控制文件号为264,下面抽取控制文件,方法与3.1相同。这里不在举例说明。

 

从提取的控制文件中获取数据文件信息:

[oracle@rac1 amdu_2012_08_08_13_17_56]$ strings DATADG_264.f | grep racdb                                          

racdb1

racdb2

racdb1

racdb2

+DATADG/racdb/onlinelog/group_2.263.790769649

+ FRADG/racdb/onlinelog/group_2.258.790769653

+DATADG/racdb/onlinelog/group_1.256.790769643

+ FRADG/racdb/onlinelog/group_1.257.790769647

+DATADG/racdb/datafile/users.259.790769487

+DATADG/racdb/datafile/undotbs1.258.790769487

+DATADG/racdb/datafile/sysaux.257.790769485

+DATADG/racdb/datafile/system.262.790769485

+DATADG/racdb/tempfile/temp.261.790769677

+DATADG/racdb/datafile/undotbs2.266.790769861

+DATADG/racdb/onlinelog/group_3.260.790769977

+FRADG/racdb/onlinelog/group_3.259.790769981

+DATADG/racdb/onlinelog/group_4.265.790769983

+FRADG/racdb/onlinelog/group_4.260.790769987

racdb

racdb

racdb1

racdb2

racdb1

racdb2

 

 

可以看到蓝色标记的为数据文件信息,我们可以根据这些数据文件信息来进行数据文件提取。方法与3.1相同。

获取帮助

使用 amdu –help 命令可以­

[oracle@rac1 ~]$ amdu -help

a/usize         AU size for corrupt disks

-ausize : This option must be set when -baddisks is set. It

    must be a power of 2. This size is required to scan a disk looking

    for metadata, and it is normally read from the disk header. The

    value applies to all disks that do not have a valid header. The

    value from the disk header will be used if a valid header is

    found.

 

ba/ddisks               Include disks with bad headers

-baddisks :  Normally disks with bad disk headers, or that

    look like they were never part of a disk group, will not be

    scanned. This option forces them to be scanned anyway and to be

    considered part of the given diskgroup. This is most useful when

    a disk header has been damaged. The disk will still need to have

    a valid allocation table to drive the scan unless -fullscan is

    used. In any case at least one block in the first two AUs must be

    valid so that the disk number can be determined. The options

    -ausize and -blksize are required since these values are normally

    fetched from the disk header. If the diskgroup uses external

    redundancy then -external should be specified. These values will

    be compared against any valid disks found in the diskgroup and

    they must be the same.

…………

Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

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

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2013-01-12

  • 博文量
    4
  • 访问量
    16775