ASM管理命令列三工具:KFOD、KFED和AMDU

luashin發表於2016-02-01

ASM管理命令列三工具:KFOD、KFED和AMDU




ASMAutomatic Storage Management)是Oracle目前主推的軟叢集儲存策略。一般而言,管理ASM的工具包括使用sqlplus命令列、ASMCA圖形化介面。此外,ASM Disk的配置和建立,可以通過oracleasm程式命令列進行配置。進入11g之後,叢集件GIcrsctlsrvctl也可以提供ASM例項InstanceDisk Group級別的修改。

一般情況下,ASM安裝管理藉助上述工具就夠了,況且Oracle RestateCluster ware可以確保ASM組建的HA架構。

一些特殊場景,如磁碟資料損壞、底層修復和ASM盤發現,需要額外的一些命令列工具。ASM工具包括:kfodkfedAMDU。在早期的ASM版本(10gR2)中,一部分工具還需要額外的重新編譯和連結才能使用。在11g,這部分工具已經成為預設設定,可以直接使用。

本篇主要介紹三個工具的基本使用和功能介紹。

 

1kfod工具

 

與圖形化介面不同,kfod屬於底層的功能命令列工具。最常用的場景是從作業系統層面刺激磁碟的掃描動作,用於輔助ASM發現可用的ASM DISKOracle官方門戶中,對於kfod的描述包括如下幾個方面:

ü  Oracle ASMDatabase安裝過程中,kfod是會自動被呼叫,用於進行磁碟發現過程(Disk Discovery);

ü  如果在安裝Grid過程沒有成功,kfod也會在安裝stage資料夾中被找到。目錄地址為:/grid/stage/ext/bin/。如果有這樣的情況,Oracle就要求我們設定環境變數LD_LIBRARY_PATH/grid/stage/ext/bin/

簡單的說,kfod檢視檢索的意義更大,並不像其他有破壞性工具那樣存在很大風險。使用幫助命令引數,可以看到kfod的功能說明。

 

 

[grid@NCR-Standby-Asm ~]$ kfod help

KFOD-00101: LRM error [107] while parsing command line arguments

_asm_a/llow_only_raw_disks              KFOD allow only raw devices [_asm_allow_only_raw_disks=TRUE/(FALSE)]

_asm_l/ibraries         ASM Libraries[_asm_libraries=lib1,lib2,...]

_asms/id                ASM Instance[_asmsid=sid]

a/sm_diskstring         ASM Diskstring [asm_diskstring=discoverystring, discoverystring ...]

c/luster                KFOD cluster [cluster=TRUE/(FALSE)]

db/_unique_name         db_unique_name for ASM instance[db_unique_name=dbname]

di/sks          Disks to discover [disks=raw,asm,badsize,all]

ds/cvgroup              Include group name [dscvgroup=TRUE/(FALSE)]

g/roup          Disks in diskgroup [group=diskgroup]

h/ostlist               hostlist[hostlist=host1,host2,...]

metadata_a/usize                AU Size for Metadata Size Calculation

metadata_c/lients               Client Count for Metadata Size Calculation

metadata_d/isks         Disk Count for Metadata Size Calculation

metadata_n/odes         Node Count for Metadata Size Calculation

metadata_r/edundancy            Redundancy for Metadata Size Calculation

n/ohdr          KFOD header suppression [nohdr=TRUE/(FALSE)]

o/p             KFOD options type [OP=DISKS/CANDIDATES/MISSING/GROUPS/INSTS/VERSION/CLIENTS/RM/RMVERS/DFLTDSTR/GPNPDSTR/METADATA/ALL]

p/file          ASM parameter file [pfile=parameterfile]

s/tatus         Include disk header status [status=TRUE/(FALSE)]

v/erbose                KFOD verbose errors [verbose=TRUE/(FALSE)]

 

 

幾個常見的操作方法:

 

 

--檢視ASM配置基本情況

[grid@NCR-Standby-Asm ~]$ kfod

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

ORACLE_SID ORACLE_HOME                                                          

================================================================

      +ASM /u01/app/grid/product/11.2.0/grid       

 

--檢視ASM Disk情況

[grid@NCR-Standby-Asm ~]$ kfod di=all

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

 Disk          Size Path                                     User     Group  

================================================================================

   1:      20489 Mb ORCL:DATA1                              

   2:      20489 Mb ORCL:DATA2                              

   3:      20489 Mb ORCL:DATA3                              

   4:      20489 Mb ORCL:DATA5                              

   5:      20442 Mb ORCL:DATA6                              

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

ORACLE_SID ORACLE_HOME                                                          

================================================================================

      +ASM /u01/app/grid/product/11.2.0/grid           

 

--特定diskgroup情況

[grid@NCR-Standby-Asm ~]$ kfod status=true g=data

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

 Disk          Size Path                                             

================================================================================

   0       20489 Mb ORCL:DATA1                                         

   1       20489 Mb ORCL:DATA2                                        

   2       20489 Mb ORCL:DATA3                                        

[grid@NCR-Standby-Asm ~]$ kfod status=true g=reco

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

 Disk          Size Path                                             

================================================================================

   0       20489 Mb ORCL:DATA5                                        

   1       20442 Mb ORCL:DATA6                                        

 

 

2KFED

 

KFED的全稱為Kernel File Metadata EditorKFED的使用場景比較嚴峻,就是當ASM Diskgroup不能成功mount的時候,通過KFED來分析ASM磁碟頭資訊,來診斷問題。

Oracle 11.1開始,KFED就已經正式成為安裝元件的一部分。一些舊的版本中,就需要手工進行build構建。與Kfod的區別是,KFED只有在完全安裝完之後,才能使用,在stage階段無法使用。

KFED幫助資訊如下:

 

 

[grid@NCR-Standby-Asm ~]$ kfed

as/mlib         ASM Library [asmlib='lib']

aun/um          AU number to examine or update [AUNUM=number]

aus/z           Allocation Unit size in bytes [AUSZ=number]

blkn/um         Block number to examine or update [BLKNUM=number]

blks/z          Metadata block size in bytes [BLKSZ=number]

ch/ksum         Update checksum before each write [CHKSUM=YES/NO]

cn/t            Count of AUs to process [CNT=number]

de/v            ASM device to examine or update [DEV=string]

dm/pall         Don't suppress repeated lines when dumping corrupt blocks [DMPALL=YES/NO]

o/p             KFED operation type [OP=READ/WRITE/MERGE/REPAIR/NEW/FORM/FIND/STRUCT]

p/rovnm         Name for provisioning purposes [PROVNM=string]

s/eek           AU number to seek to [SEEK=number]

te/xt           File name for translated block text [TEXT=string]

ty/pe           ASM metadata block type number [TYPE=number]

 

 

最常用的場景,是藉助kfed去讀ASM Disk的磁碟頭資訊。

 

[grid@NCR-Standby-Asm ~]$ kfed read /dev/sdb1

KFED-00303: unable to open file '/dev/sdb1'

 

[grid@NCR-Standby-Asm ~]$ env | grep ORACLE_HOME

ORACLE_HOME=/u01/app/grid/product/11.2.0/grid

 

[root@NCR-Standby-Asm ~]# cd /u01/app/grid/product/11.2.0/grid

[root@NCR-Standby-Asm grid]# cd bin/

[root@NCR-Standby-Asm bin]# ls -l | grep kfed

-rwxr-x--x 1 grid oinstall   2403791 May 25 15:28 kfed

-rwxr-x--x 1 grid oinstall   2403783 May  5 09:21 kfedO

 

[root@NCR-Standby-Asm bin]# ./kfed read /dev/sdb1

kfbh.endian:                          1 ; 0x000: 0x01

kfbh.hard:                          130 ; 0x001: 0x82

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD

kfbh.datfmt:                          1 ; 0x003: 0x01

kfbh.block.blk:                       0 ; 0x004: blk=0

kfbh.block.obj:              2147483648 ; 0x008: disk=0

kfbh.check:                   586307481 ; 0x00c: 0x22f25799

kfbh.fcn.base:                        0 ; 0x010: 0x00000000

kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000

kfbh.spare1:                          0 ; 0x018: 0x00000000

(篇幅原因,有省略……

kfdhdb.acdb.aba.seq:                  0 ; 0x1d4: 0x00000000

kfdhdb.acdb.aba.blk:                  0 ; 0x1d8: 0x00000000

kfdhdb.acdb.ents:                     0 ; 0x1dc: 0x0000

kfdhdb.acdb.ub2spare:                 0 ; 0x1de: 0x0000

 

 

針對ASM Disk頭塊損壞的問題,Oracle推出了自動backup策略,備份塊就在510位置上。

 

 

[root@NCR-Standby-Asm bin]# ./kfed read /dev/sdb1 blkn=510

kfbh.endian:                          1 ; 0x000: 0x01

kfbh.hard:                          130 ; 0x001: 0x82

kfbh.type:                            1 ; 0x002: KFBTYP_DISKHEAD

kfbh.datfmt:                          1 ; 0x003: 0x01

kfbh.block.blk:                     254 ; 0x004: blk=254

kfbh.block.obj:              2147483648 ; 0x008: disk=0

kfbh.check:                   586307431 ; 0x00c: 0x22f25767

kfbh.fcn.base:                        0 ; 0x010: 0x00000000

kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000

kfbh.spare1:                          0 ; 0x018: 0x00000000

kfbh.spare2:                          0 ; 0x01c: 0x00000000

kfdhdb.driver.provstr:    ORCLDISKDATA1 ; 0x000: length=13

 

 

自動命令repair,也就是將這個塊的資訊寫回到頭塊位置上。


3AMDU

 

AMDU是筆者個人覺得最像是官方工具的一個,全稱為:ASM Metadata Dump UtilityAMDU最大的作用在於可以將ASM Disk GroupDISK所有可用後設資料資訊匯出,並且整理為可讀的格式內容。

AMDU最大的一個好處,在於其工作不受到Disk Group是否mount訪問的影響。這個工具之所以被正式公佈,主要在於Oracle Support在進行遠端支援的時候,需要客戶提供上載檔案。

工具幫助引數資訊如下:

 

 

[grid@NCR-Standby-Asm ~]$ amdu help=y

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.

 

bl/ksize                ASM block size for corrupt disks

-blksize : 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.

 

c/ompare                Compare file mirrors

-compare: This option only applies to file extraction from a normal or

    high redundancy disk group. Every extent that is mirrored on more

    than one discovered disk will have all sides of its mirror

    compared. If they are not identical a message will be reported

    on standard error and the report file. The message will indicate

    which copy was extracted. A count of the blocks that are not

    identical will be in the report file.

 

dir/ectory              Directory from previous dump

-directory : This option completely eliminates the discovery

    phase of operation. It specifies the name of a dump directory from

    a previous run of AMDU. The report file and map files are read

    instead of doing a discovery and scan. The parsing of these ASCII

    files is very dependent on them being exactly as written by AMDU.

    AMDU is unlikely to work properly if they have been modified by

    a text editor, or if some of the files are missing or truncated.

    Note that the directory may be a copy FTPed from another

    machine. The other machine may even be a different platform

    with a different endianess.

 

dis/kstring             Diskstring for discovery

 -diskstring : By default the null string is used for

    discovery. The null string should discover all disks the user has

    access to. Many installations specify an asm_diskstring parameter

    for their ASM instance. If so that parameter value should be given

    here. Multiple discovery strings can be specified by multiple

    occurrences of -diskstring . Beware of shell syntax

    conflicts with discovery strings. Diskstrings are usually the same

    syntax the shell uses for expanding path names on command lines so

    they will most likely need to be enclosed in single quotes.

 

du/mp           Diskgroups to dump

-dump : This option specifies the name of a diskgroup to

    have its metadata dumped. This option may be specified multiple

    times to dump multiple diskgroups. If the diskgroup name is ALL

    then all diskgroups encountered will be dumped. The diskgroup name

    is not case sensitive, but will be converted to uppercase for all

    reports. If this option is not specified then no map or image

    files will be created, but -extract and -print may still work.

 

exc/lude                Disks to exclude

-exclude : Multiple exclude options may be specified. These

    strings are used for discovery just like the values for diskstring.

    Only shallow discovery is done on these diskstrings. Any disks

    found in the exclude discovery will not be accessed. If they are

    also discovered using the -diskstring strings, then the report will

    include the information from shallow discovery along with a message

    indicating the disk was excluded.

 

exte/rnal               Assume external redundancy

-external: Normally AMDU determines the diskgroup redundancy from the

    disk headers. However this is not possible with the -baddisks

    option. It is assumed that the redundancy of the -baddisks

    diskgroup is normal or high unless this option is given to specify

    external redundancy.

 

extr/act                Files to extract

-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.

 

fi/ledump               Dump files rather than extract

-filedump: This option causes the file objects in the command line to

    have their blocks dumped to the image files rather than extracted.

    This can be combined with the -novirtual option to selectively

    dump only some of the metadata files. It may also be used to dump

    user files (number >= 256) so that all mirrored copies can be

    examined.

 

fo/rmer         Include dropped disks

-former: Normally disks marked as former are not scanned, but this

    option will scan them and include their contents in the output.

    This is useful when it is necessary to look at the contents of a

    disk that was dropped. Note that dropped normal disks will not have

    any entries in their allocation tables and thus only the physically

    addressed extents will be dumped. Force dropped disks will not have

    status former in their disk headers and are not affected by this

    option. However if DROP DISKGROUP is used, the disks will have the

    contents as of the time of the drop, and will be in status former.

    Thus this option is useful for extracting files from a dropped

    diskgroup.

 

fu/llscan               Scan entire disk

-fullscan: This option reads every AU on the disk and looks at the

    contents of the AU rather than limiting the AU's read based on the

    allocation table. This is useful when the allocation table is

    corrupt or needs recovery. An AU will be written to the image file

    if it starts with a block that contains a valid ASM block header.

    The file and extent information for the map will be extracted from

    the block header. Physically addressed metadata will be dumped

    regardless of its contents. This option is incompatible with

    extracting a file. It is an error to specify -extract with this

    option. Note that this option is likely to find old garbage

    metadata in unallocated AU's since there is no means of

    determining what is allocated. Thus there may be many different

    copies of the same block, possibly of different versions.

 

h/ex            Always print block contents in hex

-hex: This prints the block contents in hex without attempting to print

    them as ASM metadata. This is useful when the block is known to not

    be ASM metadata. It avoids the ASM block header dump and ensures

    the block is not accidentally interpreted as ASM metadata. This

    option requires at least one -print option.

 

noa/cd          Do not dump ACD

-noacd: This option limits the dumping of the Active Change Directory

    to just the control blocks that contain the checkpoint. There is

    126 MB of ACD per ASM instance (42 MB for external redundancy). It

    is normally of no interest if there has been a clean shutdown or

    no updates for a while. This option avoids dumping a lot of

    unimportant data. The blocks will still be read and checked for

    corruption. The map file will still contain entries for the ACD

    extents, but the block counts will be zero.

 

nod/ir          Do not create a dump directory

-nodir: No dump directory is created, and no files are created in it.

    The directory name is not written to standard out. The report file

    is written to standard out before any block printouts from any

    -print options.  This option conflicts with -filedump. It is an

    error to specify this and extract a file to the dump directory.

 

noe/xtract              Do not create extracted file

-noextract: This prevents files from being extracted to an output

    file, but the file will be read and any errors in selecting the

    correct output will be reported. This is most useful in

    combination with the -compare option.

 

noh/eart                Do not check for heartbeat

-noheart: Normally the heartbeat block will be saved at discovery time

    and checked when the disk is scanned. A sleep is added between

    discovery and scanning to ensure there is time for the heartbeat

    to be written. If the heartbeat block changes then it is most

    likely that the diskgroup containing this disk is mounted by an

    active ASM instance. An error and warning is generated but

    operation proceeds normally. This option suppresses this check

    and avoids the sleep.

 

noi/mage                Do not create image files

-noimage: No image files will be created n the dump directory. All

    the reads specified by the read options will still be done. The

    map files may be used to find blocks on the disks themselves. In

    the map file, the count of blocks dumped, the image file sequence

    number, and the byte offset in the image file will all always be

    zero (C00000 S0000 B0000000000)

 

nom/ap          Do not create map or image files

-nomap: No map file is created and no image file is created. The only

    output is the report file. The -noimage option is assumed if this

    is set since an image file without a map is useless. The options

    -noscan and -noread also result in no map or image files, but

    -nomap still reads the metadata to check for I/O errors and corrupt

    blocks.

 

nop/rint                Do no print block contents

-noprint: This suppresses the printout of the block contents for

    blocks printed with the -print option. It is useful for getting

    just the block reports without a lot of data. This option requires

    at least one -print option.

 

norea/d         Shallow discovery only

-noread: This eliminates any reading of any disks at all. Only shallow

    discovery will be done. The report will end after the discovery

    section. It is an error to specify this option and specify a file

    to extract or blocks to print. It is an error to specify this

    and -fullscan.

 

norep/ort               Do not generate a report

-noreport: This suppresses the generation of the report file. It is

    most useful in combination with -nodir and -print to get block

    printouts without a lot of clutter. It is unnecessary to include

    this with -directory since no report is generated then anyway.

 

nosc/an         Deep discovery only

-noscan: This eliminates any reading of any disks after deep

    discovery. This results in just doing a deep discovery using the

    disksting parameter. The report will end after the discovery

    section. It is an error to specify this option and specify a file

    to extract. It is an error to specify this and -fullscan.

 

nosu/bdir               Do not create a dump directory

-nosubdir: No dump directory is created, but files are still created.

    The directory name is not written to standard out. The report file

    and any other dump or extract  files are written to the current

    directory or to the directory indicated by -parentdir. This means

    that if multiple AMDU dumps are requested using this option, the

    report file will always correspond to the last dump requested.

 

nov/irtual              Do not dump virtual metadata

-novirtual: This option eliminates reading of any virtual metadata.

    Only the physically addressed metadata will be read. This

    implicitly eliminates the ACD and extent maps so -noacd and

    -noxmap will be assumed.

 

nox/map         Do not dump extent maps

-noxmap: This option eliminates reading of the indirect extents

    containing the file extent maps. This is the bulk of the metadata

    in most diskgroups. Even the entries in the map file will be

    eliminated.

 

o/utput         Files to create for extract

-output : This option specifies a different file for

    writing an extracted file. The file will be overwritten if it

    already exists. This option requires that exactly one file is

    extracted via the -extract option.

 

pa/rent         Parent for dump directory

-parent : By default the dump directory is created in the

    current directory, but another directory can be specified using

    this option. The parent directory for the dump directory must

    already exist.

 

pr/int          Block to print

-print : This option prints one or more blocks to standard

    out. This option may be specified multiple times to print multiple

    s. The printout contains information about how each

    block was read as well as a formatted printout. Multiple blocks

    matching the same may be found when scanning the

    disks. For example there may be multiple disks that have headers

    for the same diskgroup and disk number. If the block is from a

    mirrored file then multiple copies should exist on different disks.

    If multiple copies of the same block have identical contents then

    only one formatted printout of the contents will be generated, but

    a header will be printed for each copy. A may include

    a count of sequential blocks to print. A may specify

    a block either by disk or file.

   ::= | .C

   ::= | |

        | |

   ::=

        .N.A.B

   ::=

         .D.A.B

   ::=

         .F.X.B

   ::=

         .F.V

   ::=

         .F.M

 

r/egistry               Dump registry files

-registry: The ASM registries will be read and dumped to the image

    file. There will be no block consistency checks since these files

    do not have ASM cache headers. To dump one specific registry

    specify -filedump and include the file object for the registry

    (e.g. DATA.255).

 

s/pfile         Extract usable spfile

-spfile: This causes extract to render the resulting file in a form  

    that is directly usable by startup. Without this option, AMDU  

    will extract the file as a regular ASM file including all ASM  

specific headers and such

 

 

每次執行amdu命令,就會在當前目錄上建立出一個帶有當前時間資訊的資料夾結構。

 

 

[grid@NCR-Standby-Asm ~]$ amdu

amdu_2015_06_05_10_15_47/

[grid@NCR-Standby-Asm ~]$ ls -l | grep amdu

drwxr-xr-x 2 grid oinstall 4096 Jun  5 10:15 amdu_2015_06_05_10_15_47

 

 

進入其中,可以檢視report.txt檔案,作為資訊收集結果。

 

[grid@NCR-Standby-Asm ~]$ cd amdu_2015_06_05_10_15_47/

[grid@NCR-Standby-Asm amdu_2015_06_05_10_15_47]$ ls -l

total 8

-rw-r--r-- 1 grid oinstall 5350 Jun  5 10:15 report.txt

[grid@NCR-Standby-Asm amdu_2015_06_05_10_15_47]$ more report.txt

-*-amdu-*-

 

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

ORACLE_HOME = /u01/app/grid/product/11.2.0/grid

System name:    Linux

Node name:      NCR-Standby-Asm

Release:        2.6.32-431.el6.x86_64

Version:        #1 SMP Sun Nov 10 22:19:54 EST 2013

Machine:        x86_64

amdu run:       05-JUN-15 10:15:47

Endianess:      1

 

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

 

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

 -diskstring ''

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

 

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

 

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

 

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

                Disk Path: ORCL:DATA1

           Unique Disk ID:

               Disk Label: DATA1

     Physical Sector Size: 512 bytes

                Disk Size: 20489 megabytes

               Group Name: DATA

                Disk Name: DATA1

       Failure Group Name: DATA1

              Disk Number: 0

            Header Status: 3

       Disk Creation Time: 2015/05/05 09:27:12.410000

          Last Mount Time: 2015/06/01 08:45:51.489000

    Compatibility Version: 0x0b200000(11020000)

         Disk Sector Size: 512 bytes

         Disk size in AUs: 20489 AUs

         Group Redundancy: 1

      Metadata Block Size: 4096 bytes

                  AU Size: 1048576 bytes

                   Stride: 113792 AUs

      Group Creation Time: 2015/05/05 09:27:12.333000

  File 1 Block 1 location: AU 2

              OCR Present: NO

 

(篇幅原因,略……

 

 

通過加入引數,可以實現轉儲特定Disk Group的內部資訊。

 

 

[grid@NCR-Standby-Asm ~]$ cd /dev/oracleasm/disks/

[grid@NCR-Standby-Asm disks]$ ls -l

total 0

brw-rw---- 1 grid asmadmin 8, 17 May 22 16:57 DATA1

brw-rw---- 1 grid asmadmin 8, 18 May 22 16:57 DATA2

brw-rw---- 1 grid asmadmin 8, 19 May 22 16:57 DATA3

brw-rw---- 1 grid asmadmin 8, 21 May 22 16:57 DATA5

brw-rw---- 1 grid asmadmin 8, 22 May 22 16:57 DATA6

 

 

[grid@NCR-Standby-Asm oracleasm]$ cd ~

[grid@NCR-Standby-Asm ~]$ amdu -diskstring '/dev/oracleasm/disks/DATA*' -dump 'DATA'

amdu_2015_06_05_10_22_11/

 

[grid@NCR-Standby-Asm ~]$ cd amdu_2015_06_05_10_22_11/

[grid@NCR-Standby-Asm amdu_2015_06_05_10_22_11]$ ls -l

total 60448

-rw-r--r-- 1 grid oinstall 61882368 Jun  5 10:22 DATA_0001.img

-rw-r--r-- 1 grid oinstall     5360 Jun  5 10:22 DATA.map

-rw-r--r-- 1 grid oinstall     7325 Jun  5 10:22 report.txt

 

 

新增加檔案,為Disk Group DATA的對映資訊。

 

 

[grid@NCR-Standby-Asm amdu_2015_06_05_10_22_11]$ more DATA.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 F00000003 I0 E00000000 U00 C00256 S0001 B0003145728 

N0001 D0000 R00 A00000004 F00000003 I0 E00000003 U00 C00256 S0001 B0004194304 

N0001 D0000 R00 A00000005 F00000003 I0 E00000006 U00 C00256 S0001 B0005242880 

 

 

使用-extract命令,可以直接從ASM Disk Group中抽取檔案。

 

 

SQL> show parameter control 

 

NAME                                 TYPE        VALUE

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

control_file_record_keep_time        integer     7

control_files                        string      +DATA/sicsstb/controlfile/current.260.878897845, +RECO/sicsstb/controlfile/current.256.878897845

control_management_pack_access       string      DIAGNOSTIC+TUNING

 

 

嘗試抽取出控制檔案。

 

 

[grid@NCR-Standby-Asm ~]$ amdu -extract DATA.260

amdu_2015_06_05_10_27_46/

AMDU-00204: Disk N0001 is in currently mounted diskgroup DATA

AMDU-00201: Disk N0001: 'ORCL:DATA1'

 

 

關閉例項和ASM

 

 

[grid@NCR-Standby-Asm ~]$ srvctl stop database -d sicsstb

[grid@NCR-Standby-Asm ~]$ srvctl stop asm -f

[grid@NCR-Standby-Asm ~]$ amdu -extract DATA.260

amdu_2015_06_05_10_29_25/

[grid@NCR-Standby-Asm ~]$

 

 

抽取成功,進入目錄。以ASCII格式開啟control file

 

 

[grid@NCR-Standby-Asm ~]$ cd amdu_2015_06_05_10_29_25/

[grid@NCR-Standby-Asm amdu_2015_06_05_10_29_25]$ ls -l

total 9528

-rw-r--r-- 1 grid oinstall 9748480 Jun  5 10:29 DATA_260.f

-rw-r--r-- 1 grid oinstall    7971 Jun  5 10:29 report.txt

 

[grid@NCR-Standby-Asm amdu_2015_06_05_10_29_25]$ strings DATA_260.f | grep +DATA

+DATA/sicsstb/onlinelog/group_3.263.878897849

+DATA/sicsstb/onlinelog/group_2.262.878897849

+DATA/sicsstb/onlinelog/group_1.261.878897847

+DATA/sicsstb/datafile/users.259.878897773

+DATA/sicsstb/datafile/undotbs1.258.878897773

+DATA/sicsstb/datafile/sysaux.257.878897773

+DATA/sicsstb/datafile/system.256.878897771

+DATA/sicsstb/tempfile/temp.264.878897855

+DATA/sicsstb/datafile/example.265.878897857

+DATA/sicsstb/onlinelog/group_3.263.878897849

+DATA/sicsstb/onlinelog/group_2.262.878897849

+DATA/sicsstb/onlinelog/group_1.261.878897847

+DATA/sicsstb/datafile/users.259.878897773

+DATA/sicsstb/datafile/undotbs1.258.878897773

+DATA/sicsstb/datafile/sysaux.257.878897773

+DATA/sicsstb/datafile/system.256.878897771

+DATA/sicsstb/tempfile/temp.264.878897855

+DATA/sicsstb/datafile/example.265.878897857

+DATA/sicsstb/datafile/example.265.878897857

[grid@NCR-Standby-Asm amdu_2015_06_05_10_29_25]$ strings DATA_260.f | grep +RECO

+RECO/sicsstb/onlinelog/group_3.259.878897849

+RECO/sicsstb/onlinelog/group_2.258.878897849

+RECO/sicsstb/onlinelog/group_1.257.878897849

+RECO/sicsstb/onlinelog/group_3.259.878897849

+RECO/sicsstb/onlinelog/group_2.258.878897849

+RECO/sicsstb/onlinelog/group_1.257.878897849

 

 

後續的恢復過程就容易了~

 

4、結論

 

GridASM對於初學者是很頭疼的,主要在於高度的自動化讓很多人覺得神祕不可接近。“知識可以消除迷信”,在這樣的情況下,我們要抱著更加虛心的態度去學習新技術和新工具,才能跟上時代,不斷前進。







About Me

...............................................................................................................................

● 本文整理自網路

● 本文在itpub(http://blog.itpub.net/26736162)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新

● 本文itpub地址:http://blog.itpub.net/26736162/abstract/1/

● 本文部落格園地址:http://www.cnblogs.com/lhrbest

● 本文pdf版及小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● 資料庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/

● QQ群:230161599     微信群:私聊

● 聯絡我請加QQ好友(646634621),註明新增緣由

● 於 2017-06-02 09:00 ~ 2017-06-30 22:00 在魔都完成

● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

● 版權所有,歡迎分享本文,轉載請保留出處

...............................................................................................................................

拿起手機使用微信客戶端掃描下邊的左邊圖片來關注小麥苗的微信公眾號:xiaomaimiaolhr,掃描右邊的二維碼加入小麥苗的QQ群,學習最實用的資料庫技術。

ASM管理命令列三工具:KFOD、KFED和AMDU
DBA筆試面試講解
歡迎與我聯絡

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2141226/,如需轉載,請註明出處,否則將追究法律責任。

相關文章