ITPUB论坛-专业的IT技术社区

标题: ASM磁盘分区或者设备文件删除后恢复的方法 [打印本页]

作者: 赵宇    时间: 2008-7-15 14:04
标题: ASM磁盘分区或者设备文件删除后恢复的方法
$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba

查看磁盘组的状态和磁盘组的类型,这里的磁盘组是外部
SQL> select name,type,state from v$asm_diskgroup;

NAME                 TYPE         STATE
-------------------- ------------ ----------------------
DISK_GROUP1          EXTERN       MOUNTED
DISK_GROUP2          EXTERN       MOUNTED
FLASHBACK_DISKGROUP  EXTERN       MOUNTED

查看磁盘组对应的磁盘,为什么会ORCL:VOL这些磁盘没有分配,实际这些磁盘就是
ASM磁盘,由于他们有标识设备文件,所以没有对应磁盘组,如果它们没有标识设备,会对应
磁盘,我们看一下:
SQL> select group_number,disk_number,path from v$asm_disk;

GROUP_NUMBER DISK_NUMBER PATH
------------ ----------- --------------------
           0           3 ORCL:VOL1
           0           5 ORCL:VOL3
           0           6 ORCL:VOL4
           2           0 /dev/raw/raw3
           3           0 /dev/raw/raw2
           1           1 /dev/raw/raw4
           1           0 ORCL:VOL2

7 rows selected.

$ /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4

发现其他的ASMDISK的设备文件都直接对应了磁盘组,但是VOL2却直接对应磁盘组.
看到VOL2没有定义标识,我们来定义一下.
$ /etc/init.d/oracleasm querydisk VOL1
Disk "VOL1" is a valid ASM disk on device [8, 17]
$ /etc/init.d/oracleasm querydisk VOL2
ASM disk "VOL2" defines an unmarked device
$ /etc/init.d/oracleasm querydisk VOL3
Disk "VOL3" is a valid ASM disk on device [8, 49]
$ /etc/init.d/oracleasm querydisk VOL4
Disk "VOL4" is a valid ASM disk on device [8, 81]

$ su - root
Password:
-bash: [: missing `]'
[root@dg1 ~]# vi /etc/sysconfig/rawdevices
加入 /dev/raw/raw1 /dev/sdc1这条

[root@dg1 ~]# /sbin/service rawdevices restart
Assigning devices:
           /dev/raw/raw3  -->   /dev/sdb1
/dev/raw/raw3:  bound to major 8, minor 17
           /dev/raw/raw2  -->   /dev/sdd1
/dev/raw/raw2:  bound to major 8, minor 49
           /dev/raw/raw4  -->   /dev/sdf1
/dev/raw/raw4:  bound to major 8, minor 81
           /dev/raw/raw1  -->   /dev/sdc1
/dev/raw/raw1:  bound to major 8, minor 33
done

[root@dg1 ~]# cd /dev/raw
[root@dg1 raw]# ls
raw1  raw2  raw3  raw4

RAW1文件已经生成,在到V$ASM_DISK表看一下
  1* select group_number,name,path,state from v$asm_disk
SQL> /

GROUP_NUMBER NAME                      PATH                 STATE
------------ ------------------------- -------------------- ----------------
           0                           ORCL:VOL1            NORMAL
           0                           ORCL:VOL2            NORMAL
           0                           ORCL:VOL3            NORMAL
           0                           ORCL:VOL4            NORMAL
           2 DISK_GROUP2_0000          /dev/raw/raw3        NORMAL
           3 FLASHBACK_DISKGROUP_0000  /dev/raw/raw2        NORMAL
           1 DISK_GROUP1_0001          /dev/raw/raw4        NORMAL
           1 DISK_GROUP1_0000          /dev/raw/raw1        NORMAL

8 rows selected.
发现VOL2已经不对应磁盘组了.
作者: 赵宇    时间: 2008-7-15 14:08
模拟删除ASMDISK以及磁盘分区的过程:

首先删除了ASMDISK,并没有实际删除磁盘分区
$ su - root
Password:
-bash: [: missing `]'
[root@dg1 ~]# /etc/init.d/oracleasm deletedisk VOL2
Removing ASM disk "VOL2":                                  [  OK  ]

SQL> startup nomount
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1217836 bytes
Variable Size              57502420 bytes
ASM Cache                  25165824 bytes

SQL> alter diskgroup DISK_GROUP1 mount;
alter diskgroup DISK_GROUP1 mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"DISK_GROUP1"

再重新创建ASMDISK:
$ su - root
Password:
-bash: [: missing `]'
[root@dg1 ~]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk:                   [  OK  ]
[root@dg1 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4

发现磁盘组已经不能正常mount:

SQL> alter diskgroup DISK_GROUP1 mount;
alter diskgroup DISK_GROUP1 mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"DISK_GROUP1"

用以前ASM磁盘头的备份信息进行恢复:
SQL> !
$ dd if=/u01/asmdisk_header/raw1_header bs=4096 count=1 of=/dev/raw/raw1
读入了 1+0 个块
输出了 1+0 个块
$ exit

SQL> l
  1* alter diskgroup DISK_GROUP1 mount
SQL> /
Diskgroup altered.





作者: 赵宇    时间: 2008-7-15 14:12
现在删除磁盘分区,再测试:
[root@dg1 ~]# fdisk /dev/sdc

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sdc: 1610 MB, 1610612736 bytes
255 heads, 63 sectors/track, 195 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         195     1566306   83  Linux
磁盘只划了1个分区

Command (m for help): d
Selected partition 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Command (m for help): p
Disk /dev/sdc: 1610 MB, 1610612736 bytes
255 heads, 63 sectors/track, 195 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         195     1566306   83  Linux

实际删除分区
Command (m for help): d
Selected partition 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


Command (m for help): p

Disk /dev/sdc: 1610 MB, 1610612736 bytes
255 heads, 63 sectors/track, 195 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

分区已经被删除.

SQL> alter diskgroup DISK_GROUP1 mount;
alter diskgroup DISK_GROUP1 mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"DISK_GROUP1"


SQL> !
$ dd if=/u01/asmdisk_header/raw1_header bs=4096 count=1 of=/dev/raw/raw1
dd: 打开 ‘/dev/raw/raw1’: 没有那个设备或地址
$ cd /dev/raw
$ ls
raw1  raw2  raw3  raw4
$ ls -l
总用量 0
crw-rw----  1 oracle dba 162, 1  7月 15 11:24 raw1
crw-rw----  1 oracle dba 162, 2  7月 15 11:24 raw2
crw-rw----  1 oracle dba 162, 3  7月 15 11:24 raw3
crw-rw----  1 oracle dba 162, 4  7月 15 11:24 raw4

其实设备文件还在,但是已经不能对应到磁盘分区.因为分区已经删除,这个磁盘组肯定不能mount
尝试重建分区:
[root@dg1 ~]# fdisk /dev/sdc

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-195, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-195, default 195):
Using default value 195

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.



作者: oradbHome    时间: 2008-7-15 14:19
用以前ASM磁盘头的备份信息进行恢复:
SQL> !
$ dd if=/u01/asmdisk_header/raw1_header bs=4096 count=1 of=/dev/raw/raw1
读入了 1+0 个块
输出了 1+0 个块
$ exit



问下 asm diskgroup 的配置信息就在raw的第一个block上吗?
作者: 赵宇    时间: 2008-7-15 14:20
用备份还原磁盘头信息:
$ dd if=/u01/asmdisk_header/raw1_header bs=4096 count=1 of=/dev/raw/raw1
读入了 1+0 个块
输出了 1+0 个块
$ env |grep ORA
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE_SID=+ASM
$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 15 13:40:41 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1217836 bytes
Variable Size              57502420 bytes
ASM Cache                  25165824 bytes
SQL>


SQL> alter diskgroup DISK_GROUP1 mount;

Diskgroup altered.


$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 15 13:41:28 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area  197132288 bytes
Fixed Size                  1218484 bytes
Variable Size              83888204 bytes
Database Buffers          109051904 bytes
Redo Buffers                2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info



ALTER DATABASE   MOUNT
Tue Jul 15 13:41:35 2008
Starting background process ASMB
ASMB started with pid=16, OS id=3352
Starting background process RBAL
RBAL started with pid=17, OS id=3356
Tue Jul 15 13:41:40 2008
SUCCESS: diskgroup DISK_GROUP1 was mounted
Tue Jul 15 13:41:40 2008
ORA-00202: ????: ''+FLASHBACK_DISKGROUP/devdb/controlfile/current.256.657732291''
ORA-17503: ksfdopn: 2 ?????? +FLASHBACK_DISKGROUP/devdb/controlfile/current.256.657732291
ORA-15001: ??? "FLASHBACK_DISKGROUP" ????????
ORA-15001: diskgroup "FLASHBACK_DISKGROUP" does not exist or is not mounted
SUCCESS: diskgroup DISK_GROUP1 was dismounted
Tue Jul 15 13:41:40 2008
ORA-205 signalled during: ALTER DATABASE   MOUNT...


因为其他磁盘组没有装载,导致controlfile不能全部找到,回到ASM instance mount所有磁盘组

$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 15 13:43:21 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter diskgroup DISK_GROUP1 dismount;

Diskgroup altered.

SQL> alter diskgroup all mount;

Diskgroup altered.




QL> startup mount
ORACLE instance started.

Total System Global Area  197132288 bytes
Fixed Size                  1218484 bytes
Variable Size              83888204 bytes
Database Buffers          109051904 bytes
Redo Buffers                2973696 bytes
Database mounted.

SQL> alter database open;

Database altered.

SQL> select file_name from dba_data_files;

FILE_NAME
----------------------------------------------------------------------------------------------------
+DISK_GROUP1/devdb/datafile/users.259.657732133
+DISK_GROUP1/devdb/datafile/sysaux.257.657732131
+DISK_GROUP1/devdb/datafile/undotbs1.258.657732131
+DISK_GROUP1/devdb/datafile/system.256.657732131
+DISK_GROUP1/devdb/datafile/example.265.657732351
+DISK_GROUP2/devdb/datafile/users.256.659787481

6 rows selected.

发现数据库可以正常打开,数据没有丢失.


总结: 磁盘划分区以后,在Linux下通过asm lib用oracleasm命令创建ASM磁盘,然后在/etc/sysconfig/rawdevices创建设备文件

disk partition (fdisk -l查看)->asm disk (/etc/init.d/oracleasm listdisks 查看)->more /etc/sysconfig/rawdevices or ls -l
/dev/raw/raw*查看

测试看出,删除raw 设备文件,磁盘组仍然可以直接读取asm disk,但是如果磁盘分区或者asm disk被删除,需要利用备份进行恢复

请兄弟门指正测试中不足,错误的地方

作者: owlstudio    时间: 2008-7-15 16:42
好好试试,先顶一个!
作者: paulyibinyi    时间: 2008-7-15 17:10
谢谢分享 mark
作者: jieyancai    时间: 2008-7-15 17:19
没怎么研究asm,留个记号。
作者: 五“宅”一生    时间: 2008-7-15 22:17
好文章。找个时间做做实验。谢谢
作者: 赵宇    时间: 2008-7-16 08:25

原帖由 oradbHome 于 2008-7-15 14:19 发表
问下 asm diskgroup 的配置信息就在raw的第一个block上吗?


$ kfed read /dev/raw/raw1
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: T=0 NUMB=0x0
kfbh.block.obj:              2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check:                   452538402 ; 0x00c: 0x1af93022
kfbh.fcn.base:                     4532 ; 0x010: 0x000011b4
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfdhdb.driver.provstr:     ORCLDISKVOL2 ; 0x000: length=12
kfdhdb.driver.reserved[0]:    843861846 ; 0x008: 0x324c4f56
kfdhdb.driver.reserved[1]:            0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]:            0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]:            0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]:            0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]:            0 ; 0x01c: 0x00000000
kfdhdb.compat:                168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:        DISK_GROUP1_0000 ; 0x028: length=16
kfdhdb.grpname:             DISK_GROUP1 ; 0x048: length=11
kfdhdb.fgname:         DISK_GROUP1_0000 ; 0x068: length=16
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             32905806 ; 0x0a8: HOUR=0xe DAYS=0x12 MNTH=0x6 YEAR=0x7d8
kfdhdb.crestmp.lo:           2565405696 ; 0x0ac: USEC=0x0 MSEC=0x23f SECS=0xe MINS=0x26
kfdhdb.mntstmp.hi:             32906736 ; 0x0b0: HOUR=0x10 DAYS=0xf MNTH=0x7 YEAR=0x7d8
kfdhdb.mntstmp.lo:           2152955904 ; 0x0b4: USEC=0x0 MSEC=0xe0 SECS=0x5 MINS=0x20
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    1529 ; 0x0c4: 0x000005f9
kfdhdb.pmcnt:                         2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                      2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:            65535 ; 0x0da: 0xffff
kfdhdb.redomirrors[2]:            65535 ; 0x0dc: 0xffff
kfdhdb.redomirrors[3]:            65535 ; 0x0de: 0xffff
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi:             32905806 ; 0x0e4: HOUR=0xe DAYS=0x12 MNTH=0x6 YEAR=0x7d8
kfdhdb.grpstmp.lo:           2565314560 ; 0x0e8: USEC=0x0 MSEC=0x1e6 SECS=0xe MINS=0x26
kfdhdb.ub4spare[0]:                   0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]:                   0 ; 0x0f0: 0x00000000
kfdhdb.ub4spare[2]:                   0 ; 0x0f4: 0x00000000
kfdhdb.ub4spare[3]:                   0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[4]:                   0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[5]:                   0 ; 0x100: 0x00000000
kfdhdb.ub4spare[6]:                   0 ; 0x104: 0x00000000
kfdhdb.ub4spare[7]:                   0 ; 0x108: 0x00000000
kfdhdb.ub4spare[8]:                   0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[9]:                   0 ; 0x110: 0x00000000
kfdhdb.ub4spare[10]:                  0 ; 0x114: 0x00000000
kfdhdb.ub4spare[11]:                  0 ; 0x118: 0x00000000
kfdhdb.ub4spare[12]:                  0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[13]:                  0 ; 0x120: 0x00000000
kfdhdb.ub4spare[14]:                  0 ; 0x124: 0x00000000
kfdhdb.ub4spare[15]:                  0 ; 0x128: 0x00000000
kfdhdb.ub4spare[16]:                  0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[17]:                  0 ; 0x130: 0x00000000
kfdhdb.ub4spare[18]:                  0 ; 0x134: 0x00000000
kfdhdb.ub4spare[19]:                  0 ; 0x138: 0x00000000
kfdhdb.ub4spare[20]:                  0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[21]:                  0 ; 0x140: 0x00000000
kfdhdb.ub4spare[22]:                  0 ; 0x144: 0x00000000
kfdhdb.ub4spare[23]:                  0 ; 0x148: 0x00000000
kfdhdb.ub4spare[24]:                  0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[25]:                  0 ; 0x150: 0x00000000
kfdhdb.ub4spare[26]:                  0 ; 0x154: 0x00000000
kfdhdb.ub4spare[27]:                  0 ; 0x158: 0x00000000
kfdhdb.ub4spare[28]:                  0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[29]:                  0 ; 0x160: 0x00000000
kfdhdb.ub4spare[30]:                  0 ; 0x164: 0x00000000
kfdhdb.ub4spare[31]:                  0 ; 0x168: 0x00000000
kfdhdb.ub4spare[32]:                  0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[33]:                  0 ; 0x170: 0x00000000
kfdhdb.ub4spare[34]:                  0 ; 0x174: 0x00000000
kfdhdb.ub4spare[35]:                  0 ; 0x178: 0x00000000
kfdhdb.ub4spare[36]:                  0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[37]:                  0 ; 0x180: 0x00000000
kfdhdb.ub4spare[38]:                  0 ; 0x184: 0x00000000
kfdhdb.ub4spare[39]:                  0 ; 0x188: 0x00000000
kfdhdb.ub4spare[40]:                  0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[41]:                  0 ; 0x190: 0x00000000
kfdhdb.ub4spare[42]:                  0 ; 0x194: 0x00000000
kfdhdb.ub4spare[43]:                  0 ; 0x198: 0x00000000
kfdhdb.ub4spare[44]:                  0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[45]:                  0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[46]:                  0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[47]:                  0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[48]:                  0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[49]:                  0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[50]:                  0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[51]:                  0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[52]:                  0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[53]:                  0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[54]:                  0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[55]:                  0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[56]:                  0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[57]:                  0 ; 0x1d0: 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

从kfed看,这个磁盘的扇区是512,OS块大小是4096,用DD拷贝第一个块就包含磁盘头的信息


作者: Charele    时间: 2008-7-16 08:41
请问一下“$ kfed read /dev/raw/raw1”
作者: Charele    时间: 2008-7-16 08:43
我在Rhel5下,用/dev/sda1,/dev/sdb1,/dev/sdc1做的磁盘形成的磁盘组,
我用类似的写法$ kfed read /dev/sda1会报错啊?
作者: 赵宇    时间: 2008-7-16 09:30
原帖由 Charele 于 2008-7-16 08:43 发表
我在Rhel5下,用/dev/sda1,/dev/sdb1,/dev/sdc1做的磁盘形成的磁盘组,
我用类似的写法$ kfed read /dev/sda1会报错啊?


用/etc/init.d/oracleasm createdisk VOL1 /dev/sda1创建ASM磁盘
在/etc/sysconfig/rawdevices下/dev/raw/raw1 /dev/sda1加入这个后
/sbin/service rawdevices restart

这样设备文件就对应到磁盘了
作者: Charele    时间: 2008-7-16 10:03
service rawdevices restart
才知道,红帽5中已没有Rawdevice这个东东了,呵呵,
作者: oradbHome    时间: 2008-7-16 10:26
附加上 kfed 工具的使用. oracle 默认是没有make 这个工具的.需要手动make .

[oracle@racdb ~]$ cd $ORACLE_HOME/rdbms/lib
[oracle@racdb lib]$
[oracle@racdb lib]$ make -f ins_rdbms.mk ikfed

Linking KFED utility (kfed)
rm -f /app/oracle/product/10.2.0/db_1/rdbms/lib/kfed
gcc -o /app/oracle/product/10.2.0/db_1/rdbms/lib/kfed -L/app/oracle/product/10.2.0/db_1/rdbms/lib/ -L/app/oracle/product/10.2.0/db_1/lib/ -L/app/oracle/product/10.2.0/db_1/lib/stubs/  /app/oracle/product/10.2.0/db_1/lib/s0main.o /app/oracle/product/10.2.0/db_1/rdbms/lib/sskfeded.o /app/oracle/product/10.2.0/db_1/rdbms/lib/skfedpt.o  /app/oracle/product/10.2.0/db_1/rdbms/lib/defopt.o -ldbtools10 -lclntsh  `cat /app/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /app/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /app/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /app/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10   -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10  -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10  -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10   `cat /app/oracle/product/10.2.0/db_1/lib/sysliblist` -Wl,-rpath,/app/oracle/product/10.2.0/db_1/lib -lm    `cat /app/oracle/product/10.2.0/db_1/lib/sysliblist` -ldl -lm   -L/app/oracle/product/10.2.0/db_1/lib
mv -f /app/oracle/product/10.2.0/db_1/bin/kfed /app/oracle/product/10.2.0/db_1/bin/kfedO
mv: cannot stat `/app/oracle/product/10.2.0/db_1/bin/kfed': No such file or directory
make: [ikfed] Error 1 (ignored)
mv /app/oracle/product/10.2.0/db_1/rdbms/lib/kfed /app/oracle/product/10.2.0/db_1/bin/kfed
chmod 751 /app/oracle/product/10.2.0/db_1/bin/kfed
[oracle@racdb lib]$
作者: battleman    时间: 2008-7-16 10:45
先顶!!
作者: ruluo    时间: 2008-7-16 11:06
标题: 回复 #13 赵宇 的帖子
这个工具只能读裸设备? 不能读块设备还是怎么?
作者: battleman    时间: 2008-7-16 11:06
原帖由 oradbHome 于 2008-7-15 14:19 发表


问下 asm diskgroup 的配置信息就在raw的第一个block上吗?


是在ASM的第一个块上,ASM块大小为4096,由参数_asm_blksize来控制
作者: 赵宇    时间: 2008-7-16 13:27
原帖由 ruluo 于 2008-7-16 11:06 发表
这个工具只能读裸设备? 不能读块设备还是怎么?



恩?只要是v$asm_disk里面path列 列出的就可以
/dev/sdc1 是磁盘,不是设备文件

裸设备是一种存储方式,kfed 是为ASM用的
作者: 赵宇    时间: 2008-7-16 14:17
原帖由 battleman 于 2008-7-16 11:06 发表
是在ASM的第一个块上,ASM块大小为4096,由参数_asm_blksize来控制


用kfed 来看一下: ausz ASM磁盘以AU为分配单位,AU一般是1M,所以是1048576
aunum就是第1个AU

$ kfed find /dev/raw/raw2 aunum=0 ausz=1048576
Block 0 has type 1
Block 1 has type 2
Block 2 has type 3
Block 3 has type 3
Block 4 has type 3
Block 5 has type 3
Block 6 has type 3
Block 7 has type 3
Block 8 has type 3
Block 9 has type 3
Block 10 has type 3
Block 11 has type 3
Block 12 has type 3
Block 13 has type 3
Block 14 has type 3
Block 15 has type 3
Block 16 has type 3
Block 17 has type 3
Block 18 has type 3
Block 19 has type 3
Block 20 has type 3
Block 21 has type 3
Block 22 has type 3
Block 23 has type 3
Block 24 has type 3
Block 25 has type 3
Block 26 has type 3
Block 27 has type 3
Block 28 has type 3
Block 29 has type 3
Block 30 has type 3
Block 31 has type 3
Block 32 has type 3
Block 33 has type 3
Block 34 has type 3
Block 35 has type 3
Block 36 has type 3
Block 37 has type 3
Block 38 has type 3
Block 39 has type 3
Block 40 has type 3
Block 41 has type 3
Block 42 has type 3
Block 43 has type 3
Block 44 has type 3
Block 45 has type 3
Block 46 has type 3
Block 47 has type 3
Block 48 has type 3
Block 49 has type 3
Block 50 has type 3
Block 51 has type 3
Block 52 has type 3
Block 53 has type 3
Block 54 has type 3
Block 55 has type 3
Block 56 has type 3
Block 57 has type 3
Block 58 has type 3
Block 59 has type 3
Block 60 has type 3
Block 61 has type 3
Block 62 has type 3
Block 63 has type 3
Block 64 has type 3
Block 65 has type 3
Block 66 has type 3
Block 67 has type 3
Block 68 has type 3
Block 69 has type 3
Block 70 has type 3
Block 71 has type 3
Block 72 has type 3
Block 73 has type 3
Block 74 has type 3
Block 75 has type 3
Block 76 has type 3
Block 77 has type 3
Block 78 has type 3
Block 79 has type 3
Block 80 has type 3
Block 81 has type 3
Block 82 has type 3
Block 83 has type 3
Block 84 has type 3
Block 85 has type 3
Block 86 has type 3
Block 87 has type 3
Block 88 has type 3
Block 89 has type 3
Block 90 has type 3
Block 91 has type 3
Block 92 has type 3
Block 93 has type 3
Block 94 has type 3
Block 95 has type 3
Block 96 has type 3
Block 97 has type 3
Block 98 has type 3
Block 99 has type 3
Block 100 has type 3
Block 101 has type 3
Block 102 has type 3
Block 103 has type 3
Block 104 has type 3
Block 105 has type 3
Block 106 has type 3
Block 107 has type 3
Block 108 has type 3
Block 109 has type 3
Block 110 has type 3
Block 111 has type 3
Block 112 has type 3
Block 113 has type 3
Block 114 has type 3
Block 115 has type 3
Block 116 has type 3
Block 117 has type 3
Block 118 has type 3
Block 119 has type 3
Block 120 has type 3
Block 121 has type 3
Block 122 has type 3
Block 123 has type 3
Block 124 has type 3
Block 125 has type 3
Block 126 has type 3
Block 127 has type 3
Block 128 has type 3
Block 129 has type 3
Block 130 has type 3
Block 131 has type 3
Block 132 has type 3
Block 133 has type 3
Block 134 has type 3
Block 135 has type 3
Block 136 has type 3
Block 137 has type 3
Block 138 has type 3
Block 139 has type 3
Block 140 has type 3
Block 141 has type 3
Block 142 has type 3
Block 143 has type 3
Block 144 has type 3
Block 145 has type 3
Block 146 has type 3
Block 147 has type 3
Block 148 has type 3
Block 149 has type 3
Block 150 has type 3
Block 151 has type 3
Block 152 has type 3
Block 153 has type 3
Block 154 has type 3
Block 155 has type 3
Block 156 has type 3
Block 157 has type 3
Block 158 has type 3
Block 159 has type 3
Block 160 has type 3
Block 161 has type 3
Block 162 has type 3
Block 163 has type 3
Block 164 has type 3
Block 165 has type 3
Block 166 has type 3
Block 167 has type 3
Block 168 has type 3
Block 169 has type 3
Block 170 has type 3
Block 171 has type 3
Block 172 has type 3
Block 173 has type 3
Block 174 has type 3
Block 175 has type 3
Block 176 has type 3
Block 177 has type 3
Block 178 has type 3
Block 179 has type 3
Block 180 has type 3
Block 181 has type 3
Block 182 has type 3
Block 183 has type 3
Block 184 has type 3
Block 185 has type 3
Block 186 has type 3
Block 187 has type 3
Block 188 has type 3
Block 189 has type 3
Block 190 has type 3
Block 191 has type 3
Block 192 has type 3
Block 193 has type 3
Block 194 has type 3
Block 195 has type 3
Block 196 has type 3
Block 197 has type 3
Block 198 has type 3
Block 199 has type 3
Block 200 has type 3
Block 201 has type 3
Block 202 has type 3
Block 203 has type 3
Block 204 has type 3
Block 205 has type 3
Block 206 has type 3
Block 207 has type 3
Block 208 has type 3
Block 209 has type 3
Block 210 has type 3
Block 211 has type 3
Block 212 has type 3
Block 213 has type 3
Block 214 has type 3
Block 215 has type 3
Block 216 has type 3
Block 217 has type 3
Block 218 has type 3
Block 219 has type 3
Block 220 has type 3
Block 221 has type 3
Block 222 has type 3
Block 223 has type 3
Block 224 has type 3
Block 225 has type 3
Block 226 has type 3
Block 227 has type 3
Block 228 has type 3
Block 229 has type 3
Block 230 has type 3
Block 231 has type 3
Block 232 has type 3
Block 233 has type 3
Block 234 has type 3
Block 235 has type 3
Block 236 has type 3
Block 237 has type 3
Block 238 has type 3
Block 239 has type 3
Block 240 has type 3
Block 241 has type 3
Block 242 has type 3
Block 243 has type 3
Block 244 has type 3
Block 245 has type 3
Block 246 has type 3
Block 247 has type 3
Block 248 has type 3
Block 249 has type 3
Block 250 has type 3
Block 251 has type 3
Block 252 has type 3
Block 253 has type 3
Block 254 has type 3
Block 255 has type 3

可以看到第1个AU包含256个块,每个块是4096*265正好是一个AU大小

再用kfed读取一遍,实际默认是aunum=0
$ kfed read /dev/raw/raw2
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: T=0 NUMB=0x0
kfbh.block.obj:              2147483648 ; 0x008: TYPE=0x8 NUMB=0x0
kfbh.check:                  3528987942 ; 0x00c: 0xd2581526
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:         ORCLDISK ; 0x000: length=8
kfdhdb.driver.reserved[0]:            0 ; 0x008: 0x00000000
kfdhdb.driver.reserved[1]:            0 ; 0x00c: 0x00000000
kfdhdb.driver.reserved[2]:            0 ; 0x010: 0x00000000
kfdhdb.driver.reserved[3]:            0 ; 0x014: 0x00000000
kfdhdb.driver.reserved[4]:            0 ; 0x018: 0x00000000
kfdhdb.driver.reserved[5]:            0 ; 0x01c: 0x00000000
kfdhdb.compat:                168820736 ; 0x020: 0x0a100000
kfdhdb.dsknum:                        0 ; 0x024: 0x0000
kfdhdb.grptyp:                        1 ; 0x026: KFDGTP_EXTERNAL
kfdhdb.hdrsts:                        3 ; 0x027: KFDHDR_MEMBER
kfdhdb.dskname:FLASHBACK_DISKGROUP_0000 ; 0x028: length=24
kfdhdb.grpname:     FLASHBACK_DISKGROUP ; 0x048: length=19
kfdhdb.fgname: FLASHBACK_DISKGROUP_0000 ; 0x068: length=24
kfdhdb.capname:                         ; 0x088: length=0
kfdhdb.crestmp.hi:             32906763 ; 0x0a8: HOUR=0xb DAYS=0x10 MNTH=0x7 YEAR=0x7d8
kfdhdb.crestmp.lo:           3510297600 ; 0x0ac: USEC=0x0 MSEC=0x2b9 SECS=0x13 MINS=0x34
kfdhdb.mntstmp.hi:             32906765 ; 0x0b0: HOUR=0xd DAYS=0x10 MNTH=0x7 YEAR=0x7d8
kfdhdb.mntstmp.lo:           1308567552 ; 0x0b4: USEC=0x0 MSEC=0x3ca SECS=0x1f MINS=0x13
kfdhdb.secsize:                     512 ; 0x0b8: 0x0200
kfdhdb.blksize:                    4096 ; 0x0ba: 0x1000
kfdhdb.ausize:                  1048576 ; 0x0bc: 0x00100000
kfdhdb.mfact:                    113792 ; 0x0c0: 0x0001bc80
kfdhdb.dsksize:                    1019 ; 0x0c4: 0x000003fb
kfdhdb.pmcnt:                         2 ; 0x0c8: 0x00000002
kfdhdb.fstlocn:                       1 ; 0x0cc: 0x00000001
kfdhdb.altlocn:                       2 ; 0x0d0: 0x00000002
kfdhdb.f1b1locn:                      2 ; 0x0d4: 0x00000002
kfdhdb.redomirrors[0]:                0 ; 0x0d8: 0x0000
kfdhdb.redomirrors[1]:                0 ; 0x0da: 0x0000
kfdhdb.redomirrors[2]:                0 ; 0x0dc: 0x0000
kfdhdb.redomirrors[3]:                0 ; 0x0de: 0x0000
kfdhdb.dbcompat:              168820736 ; 0x0e0: 0x0a100000
kfdhdb.grpstmp.hi:             32906763 ; 0x0e4: HOUR=0xb DAYS=0x10 MNTH=0x7 YEAR=0x7d8
kfdhdb.grpstmp.lo:           3510217728 ; 0x0e8: USEC=0x0 MSEC=0x26b SECS=0x13 MINS=0x34
kfdhdb.ub4spare[0]:                   0 ; 0x0ec: 0x00000000
kfdhdb.ub4spare[1]:                   0 ; 0x0f0: 0x00000000
kfdhdb.ub4spare[2]:                   0 ; 0x0f4: 0x00000000
kfdhdb.ub4spare[3]:                   0 ; 0x0f8: 0x00000000
kfdhdb.ub4spare[4]:                   0 ; 0x0fc: 0x00000000
kfdhdb.ub4spare[5]:                   0 ; 0x100: 0x00000000
kfdhdb.ub4spare[6]:                   0 ; 0x104: 0x00000000
kfdhdb.ub4spare[7]:                   0 ; 0x108: 0x00000000
kfdhdb.ub4spare[8]:                   0 ; 0x10c: 0x00000000
kfdhdb.ub4spare[9]:                   0 ; 0x110: 0x00000000
kfdhdb.ub4spare[10]:                  0 ; 0x114: 0x00000000
kfdhdb.ub4spare[11]:                  0 ; 0x118: 0x00000000
kfdhdb.ub4spare[12]:                  0 ; 0x11c: 0x00000000
kfdhdb.ub4spare[13]:                  0 ; 0x120: 0x00000000
kfdhdb.ub4spare[14]:                  0 ; 0x124: 0x00000000
kfdhdb.ub4spare[15]:                  0 ; 0x128: 0x00000000
kfdhdb.ub4spare[16]:                  0 ; 0x12c: 0x00000000
kfdhdb.ub4spare[17]:                  0 ; 0x130: 0x00000000
kfdhdb.ub4spare[18]:                  0 ; 0x134: 0x00000000
kfdhdb.ub4spare[19]:                  0 ; 0x138: 0x00000000
kfdhdb.ub4spare[20]:                  0 ; 0x13c: 0x00000000
kfdhdb.ub4spare[21]:                  0 ; 0x140: 0x00000000
kfdhdb.ub4spare[22]:                  0 ; 0x144: 0x00000000
kfdhdb.ub4spare[23]:                  0 ; 0x148: 0x00000000
kfdhdb.ub4spare[24]:                  0 ; 0x14c: 0x00000000
kfdhdb.ub4spare[25]:                  0 ; 0x150: 0x00000000
kfdhdb.ub4spare[26]:                  0 ; 0x154: 0x00000000
kfdhdb.ub4spare[27]:                  0 ; 0x158: 0x00000000
kfdhdb.ub4spare[28]:                  0 ; 0x15c: 0x00000000
kfdhdb.ub4spare[29]:                  0 ; 0x160: 0x00000000
kfdhdb.ub4spare[30]:                  0 ; 0x164: 0x00000000
kfdhdb.ub4spare[31]:                  0 ; 0x168: 0x00000000
kfdhdb.ub4spare[32]:                  0 ; 0x16c: 0x00000000
kfdhdb.ub4spare[33]:                  0 ; 0x170: 0x00000000
kfdhdb.ub4spare[34]:                  0 ; 0x174: 0x00000000
kfdhdb.ub4spare[35]:                  0 ; 0x178: 0x00000000
kfdhdb.ub4spare[36]:                  0 ; 0x17c: 0x00000000
kfdhdb.ub4spare[37]:                  0 ; 0x180: 0x00000000
kfdhdb.ub4spare[38]:                  0 ; 0x184: 0x00000000
kfdhdb.ub4spare[39]:                  0 ; 0x188: 0x00000000
kfdhdb.ub4spare[40]:                  0 ; 0x18c: 0x00000000
kfdhdb.ub4spare[41]:                  0 ; 0x190: 0x00000000
kfdhdb.ub4spare[42]:                  0 ; 0x194: 0x00000000
kfdhdb.ub4spare[43]:                  0 ; 0x198: 0x00000000
kfdhdb.ub4spare[44]:                  0 ; 0x19c: 0x00000000
kfdhdb.ub4spare[45]:                  0 ; 0x1a0: 0x00000000
kfdhdb.ub4spare[46]:                  0 ; 0x1a4: 0x00000000
kfdhdb.ub4spare[47]:                  0 ; 0x1a8: 0x00000000
kfdhdb.ub4spare[48]:                  0 ; 0x1ac: 0x00000000
kfdhdb.ub4spare[49]:                  0 ; 0x1b0: 0x00000000
kfdhdb.ub4spare[50]:                  0 ; 0x1b4: 0x00000000
kfdhdb.ub4spare[51]:                  0 ; 0x1b8: 0x00000000
kfdhdb.ub4spare[52]:                  0 ; 0x1bc: 0x00000000
kfdhdb.ub4spare[53]:                  0 ; 0x1c0: 0x00000000
kfdhdb.ub4spare[54]:                  0 ; 0x1c4: 0x00000000
kfdhdb.ub4spare[55]:                  0 ; 0x1c8: 0x00000000
kfdhdb.ub4spare[56]:                  0 ; 0x1cc: 0x00000000
kfdhdb.ub4spare[57]:                  0 ; 0x1d0: 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

蓝色部分告诉我们这个块头的类型是1,type=1是第几块呢,我们再看
作者: 赵宇    时间: 2008-7-16 14:22
$ kfed find /dev/raw/raw2 type=1
Block 0 has type 1
就是第1块,为了确认,再用DD测试一下

$dd if=/dev/raw/raw2 skip=1 bs=4096 cvount=1 of=/u01/asmdisk_header/raw2_header
读入了 1+0 个块
输出了 1+0 个块

用dd跨过第1个块,存取以后,读取文件,发现没有信息
$ more /u01/asmdisk_header/raw2_header


$


再对比不同AU的内容,读取第3个AU先看一下:

$ kfed read /dev/raw/raw2 aunum=2 >/u01/zhaoyu.txt
$ more zhaoyu.txt
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            5 ; 0x002: KFBTYP_LISTHEAD
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                       0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj:                       1 ; 0x008: TYPE=0x0 NUMB=0x1
kfbh.check:                    17138431 ; 0x00c: 0x010582ff
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfflhe[0].cnt:                        0 ; 0x000: 0x00000000
kfflhe[0].rcvr:                       0 ; 0x004: 0x00000000
kfflhe[0].high:                       0 ; 0x008: 0x00000000
kfflhe[0].frlist.number:     4294967295 ; 0x00c: 0xffffffff
kfflhe[0].frlist.incarn:              0 ; 0x010: A=0 NUMM=0x0
kfflhe[0].dangle.number:     4294967295 ; 0x014: 0xffffffff
kfflhe[0].dangle.incarn:              0 ; 0x018: A=0 NUMM=0x0
kfflhe[1].cnt:                        0 ; 0x01c: 0x00000000
kfflhe[1].rcvr:                     256 ; 0x020: 0x00000100
kfflhe[1].high:                     256 ; 0x024: 0x00000100
kfflhe[1].frlist.number:     4294967295 ; 0x028: 0xffffffff
kfflhe[1].frlist.incarn:              0 ; 0x02c: A=0 NUMM=0x0
kfflhe[1].dangle.number:     4294967295 ; 0x030: 0xffffffff
kfflhe[1].dangle.incarn:              0 ; 0x034: A=0 NUMM=0x0
kfflhe[2].cnt:                      255 ; 0x038: 0x000000ff
kfflhe[2].rcvr:                     256 ; 0x03c: 0x00000100
kfflhe[2].high:                     256 ; 0x040: 0x00000100
kfflhe[2].frlist.number:              1 ; 0x044: 0x00000001
kfflhe[2].frlist.incarn:              0 ; 0x048: A=0 NUMM=0x0
kfflhe[2].dangle.number:              0 ; 0x04c: 0x00000000
kfflhe[2].dangle.incarn:              1 ; 0x050: A=1 NUMM=0x0
kfflhe[3].cnt:                        0 ; 0x054: 0x00000000
kfflhe[3].rcvr:                       0 ; 0x058: 0x00000000
kfflhe[3].high:                       0 ; 0x05c: 0x00000000
kfflhe[3].frlist.number:     4294967295 ; 0x060: 0xffffffff
kfflhe[3].frlist.incarn:              0 ; 0x064: A=0 NUMM=0x0
kfflhe[3].dangle.number:     4294967295 ; 0x068: 0xffffffff
kfflhe[3].dangle.incarn:              0 ; 0x06c: A=0 NUMM=0x0
kfflhe[4].cnt:                        0 ; 0x070: 0x00000000
kfflhe[4].rcvr:                       0 ; 0x074: 0x00000000
kfflhe[4].high:                       0 ; 0x078: 0x00000000
kfflhe[4].frlist.number:     4294967295 ; 0x07c: 0xffffffff
kfflhe[4].frlist.incarn:              0 ; 0x080: A=0 NUMM=0x0
kfflhe[4].dangle.number:     4294967295 ; 0x084: 0xffffffff
kfflhe[4].dangle.incarn:              0 ; 0x088: A=0 NUMM=0x0
kfflhe[5].cnt:                      255 ; 0x08c: 0x000000ff
kfflhe[5].rcvr:                     256 ; 0x090: 0x00000100
kfflhe[5].high:                     256 ; 0x094: 0x00000100
kfflhe[5].frlist.number:              1 ; 0x098: 0x00000001
kfflhe[5].frlist.incarn:              0 ; 0x09c: A=0 NUMM=0x0
kfflhe[5].dangle.number:              0 ; 0x0a0: 0x00000000
kfflhe[5].dangle.incarn:              1 ; 0x0a4: A=1 NUMM=0x0
kfflhe[6].cnt:                      255 ; 0x0a8: 0x000000ff
kfflhe[6].rcvr:                     256 ; 0x0ac: 0x00000100
kfflhe[6].high:                     256 ; 0x0b0: 0x00000100
kfflhe[6].frlist.number:              1 ; 0x0b4: 0x00000001
kfflhe[6].frlist.incarn:              0 ; 0x0b8: A=0 NUMM=0x0
kfflhe[6].dangle.number:              0 ; 0x0bc: 0x00000000
kfflhe[6].dangle.incarn:              1 ; 0x0c0: A=1 NUMM=0x0
kfflhe[7].cnt:                        0 ; 0x0c4: 0x00000000
kfflhe[7].rcvr:                       0 ; 0x0c8: 0x00000000
kfflhe[7].high:                       0 ; 0x0cc: 0x00000000
kfflhe[7].frlist.number:     4294967295 ; 0x0d0: 0xffffffff
kfflhe[7].frlist.incarn:              0 ; 0x0d4: A=0 NUMM=0x0
kfflhe[7].dangle.number:     4294967295 ; 0x0d8: 0xffffffff
kfflhe[7].dangle.incarn:              0 ; 0x0dc: A=0 NUMM=0x0
kfflhe[8].cnt:                        0 ; 0x0e0: 0x00000000
kfflhe[8].rcvr:                       0 ; 0x0e4: 0x00000000
kfflhe[8].high:                       0 ; 0x0e8: 0x00000000
kfflhe[8].frlist.number:     4294967295 ; 0x0ec: 0xffffffff
kfflhe[8].frlist.incarn:              0 ; 0x0f0: A=0 NUMM=0x0
kfflhe[8].dangle.number:     4294967295 ; 0x0f4: 0xffffffff
kfflhe[8].dangle.incarn:              0 ; 0x0f8: A=0 NUMM=0x0
kfflhe[9].cnt:                        0 ; 0x0fc: 0x00000000
kfflhe[9].rcvr:                       0 ; 0x100: 0x00000000
kfflhe[9].high:                       0 ; 0x104: 0x00000000
kfflhe[9].frlist.number:     4294967295 ; 0x108: 0xffffffff
kfflhe[9].frlist.incarn:              0 ; 0x10c: A=0 NUMM=0x0
kfflhe[9].dangle.number:     4294967295 ; 0x110: 0xffffffff
kfflhe[9].dangle.incarn:              0 ; 0x114: A=0 NUMM=0x0
kfflhe[10].cnt:                       0 ; 0x118: 0x00000000
kfflhe[10].rcvr:                      0 ; 0x11c: 0x00000000
kfflhe[10].high:                      0 ; 0x120: 0x00000000
kfflhe[10].frlist.number:    4294967295 ; 0x124: 0xffffffff
kfflhe[10].frlist.incarn:             0 ; 0x128: A=0 NUMM=0x0
kfflhe[10].dangle.number:    4294967295 ; 0x12c: 0xffffffff
kfflhe[10].dangle.incarn:             0 ; 0x130: A=0 NUMM=0x0
kfflhe[11].cnt:                       0 ; 0x134: 0x00000000
kfflhe[11].rcvr:                      0 ; 0x138: 0x00000000
kfflhe[11].high:                      0 ; 0x13c: 0x00000000
kfflhe[11].frlist.number:    4294967295 ; 0x140: 0xffffffff
kfflhe[11].frlist.incarn:             0 ; 0x144: A=0 NUMM=0x0
kfflhe[11].dangle.number:    4294967295 ; 0x148: 0xffffffff
kfflhe[11].dangle.incarn:             0 ; 0x14c: A=0 NUMM=0x0

[ 本帖最后由 赵宇 于 2008-7-16 14:28 编辑 ]
作者: 赵宇    时间: 2008-7-16 14:26
第4个AU又对应一个不同的类型

$ kfed read /dev/raw/raw2 aunum=3 >/u01/zhaoyu.txt
$ more zhaoyu.txt
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            6 ; 0x002: KFBTYP_DISKDIR
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                       0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj:                       2 ; 0x008: TYPE=0x0 NUMB=0x2
kfbh.check:                   775391221 ; 0x00c: 0x2e3787f5
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kffdnd.bnode.incarn:                  1 ; 0x000: A=1 NUMM=0x0
kffdnd.bnode.frlist.number:  4294967295 ; 0x004: 0xffffffff
kffdnd.bnode.frlist.incarn:           0 ; 0x008: A=0 NUMM=0x0
kffdnd.overfl.number:        4294967295 ; 0x00c: 0xffffffff
kffdnd.overfl.incarn:                 0 ; 0x010: A=0 NUMM=0x0
kffdnd.parent.number:                 0 ; 0x014: 0x00000000
kffdnd.parent.incarn:                 1 ; 0x018: A=1 NUMM=0x0
kffdnd.fstblk.number:                 0 ; 0x01c: 0x00000000
kffdnd.fstblk.incarn:                 1 ; 0x020: A=1 NUMM=0x0
kfddde[0].entry.incarn:               1 ; 0x024: A=1 NUMM=0x0
kfddde[0].entry.hash:                 0 ; 0x028: 0x00000000
kfddde[0].entry.refer.number:4294967295 ; 0x02c: 0xffffffff
kfddde[0].entry.refer.incarn:         0 ; 0x030: A=0 NUMM=0x0
kfddde[0].dsknum:                     0 ; 0x034: 0x0000
kfddde[0].state:                      2 ; 0x036: KFDSTA_NORMAL
kfddde[0].ub1spare:                   0 ; 0x037: 0x00
kfddde[0].dskname:FLASHBACK_DISKGROUP_0000 ; 0x038: length=24
kfddde[0].fgname:FLASHBACK_DISKGROUP_0000 ; 0x058: length=24

kfddde[0].crestmp.hi:          32906763 ; 0x078: HOUR=0xb DAYS=0x10 MNTH=0x7 YEAR=0x7d8
kfddde[0].crestmp.lo:        3510297600 ; 0x07c: USEC=0x0 MSEC=0x2b9 SECS=0x13 MINS=0x34
kfddde[0].failstmp.hi:                0 ; 0x080: HOUR=0x0 DAYS=0x0 MNTH=0x0 YEAR=0x0
kfddde[0].failstmp.lo:                0 ; 0x084: USEC=0x0 MSEC=0x0 SECS=0x0 MINS=0x0
kfddde[0].timer:                      0 ; 0x088: 0x00000000
kfddde[0].size:                    1019 ; 0x08c: 0x000003fb
kfddde[0].spare[0]:                   0 ; 0x090: 0x00000000
kfddde[0].spare[1]:                   0 ; 0x094: 0x00000000
kfddde[0].spare[2]:                   0 ; 0x098: 0x00000000
kfddde[0].spare[3]:                   0 ; 0x09c: 0x00000000
kfddde[0].spare[4]:                   0 ; 0x0a0: 0x00000000
kfddde[0].zones[0].start:             0 ; 0x0a4: 0x00000000
kfddde[0].zones[0].size:           1019 ; 0x0a8: 0x000003fb
kfddde[0].zones[0].used:             50 ; 0x0ac: 0x00000032
kfddde[0].zones[0].spare:             0 ; 0x0b0: 0x00000000
kfddde[0].zones[0].classes[0].imbal[0]:48 ; 0x0b4: 0x00000030
kfddde[0].zones[0].classes[0].imbal[1]:0 ; 0x0b8: 0x00000000
kfddde[0].zones[0].classes[0].imbal[2]:0 ; 0x0bc: 0x00000000
kfddde[0].zones[0].classes[0].imbal[3]:0 ; 0x0c0: 0x00000000
kfddde[0].zones[0].classes[1].imbal[0]:0 ; 0x0c4: 0x00000000
kfddde[0].zones[0].classes[1].imbal[1]:0 ; 0x0c8: 0x00000000
kfddde[0].zones[0].classes[1].imbal[2]:0 ; 0x0cc: 0x00000000
kfddde[0].zones[0].classes[1].imbal[3]:0 ; 0x0d0: 0x00000000
kfddde[0].zones[0].classes[2].imbal[0]:0 ; 0x0d4: 0x00000000
kfddde[0].zones[0].classes[2].imbal[1]:0 ; 0x0d8: 0x00000000
kfddde[0].zones[0].classes[2].imbal[2]:0 ; 0x0dc: 0x00000000
kfddde[0].zones[0].classes[2].imbal[3]:0 ; 0x0e0: 0x00000000
kfddde[0].zones[0].classes[3].imbal[0]:0 ; 0x0e4: 0x00000000
kfddde[0].zones[0].classes[3].imbal[1]:0 ; 0x0e8: 0x00000000
kfddde[0].zones[0].classes[3].imbal[2]:0 ; 0x0ec: 0x00000000
kfddde[0].zones[0].classes[3].imbal[3]:0 ; 0x0f0: 0x00000000
kfddde[0].zones[1].start:             0 ; 0x0f4: 0x00000000
kfddde[0].zones[1].size:              0 ; 0x0f8: 0x00000000
kfddde[0].zones[1].used:              0 ; 0x0fc: 0x00000000
kfddde[0].zones[1].spare:             0 ; 0x100: 0x00000000
kfddde[0].zones[1].classes[0].imbal[0]:0 ; 0x104: 0x00000000
kfddde[0].zones[1].classes[0].imbal[1]:0 ; 0x108: 0x00000000
kfddde[0].zones[1].classes[0].imbal[2]:0 ; 0x10c: 0x00000000
kfddde[0].zones[1].classes[0].imbal[3]:0 ; 0x110: 0x00000000
kfddde[0].zones[1].classes[1].imbal[0]:0 ; 0x114: 0x00000000
kfddde[0].zones[1].classes[1].imbal[1]:0 ; 0x118: 0x00000000
kfddde[0].zones[1].classes[1].imbal[2]:0 ; 0x11c: 0x00000000
kfddde[0].zones[1].classes[1].imbal[3]:0 ; 0x120: 0x00000000
kfddde[0].zones[1].classes[2].imbal[0]:0 ; 0x124: 0x00000000
kfddde[0].zones[1].classes[2].imbal[1]:0 ; 0x128: 0x00000000
kfddde[0].zones[1].classes[2].imbal[2]:0 ; 0x12c: 0x00000000
kfddde[0].zones[1].classes[2].imbal[3]:0 ; 0x130: 0x00000000
kfddde[0].zones[1].classes[3].imbal[0]:0 ; 0x134: 0x00000000
kfddde[0].zones[1].classes[3].imbal[1]:0 ; 0x138: 0x00000000
kfddde[0].zones[1].classes[3].imbal[2]:0 ; 0x13c: 0x00000000
kfddde[0].zones[1].classes[3].imbal[3]:0 ; 0x140: 0x00000000
kfddde[0].zones[2].start:             0 ; 0x144: 0x00000000
kfddde[0].zones[2].size:              0 ; 0x148: 0x00000000
kfddde[0].zones[2].used:              0 ; 0x14c: 0x00000000
kfddde[0].zones[2].spare:             0 ; 0x150: 0x00000000
--More--(10%)

[ 本帖最后由 赵宇 于 2008-7-16 14:30 编辑 ]
作者: 赵宇    时间: 2008-7-16 14:37
$  kfed read /dev/raw/raw2 aunum=6 >/u01/zhaoyu.txt
$ more zhaoyu.txt
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                          130 ; 0x001: 0x82
kfbh.type:                            8 ; 0x002: KFBTYP_CHNGDIR
kfbh.datfmt:                          1 ; 0x003: 0x01
kfbh.block.blk:                     512 ; 0x004: T=0 NUMB=0x200
kfbh.block.obj:                       3 ; 0x008: TYPE=0x0 NUMB=0x3
kfbh.check:                    17334781 ; 0x00c: 0x010881fd
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
kfracdb.aba.seq:                      0 ; 0x000: 0x00000000
kfracdb.aba.blk:                    511 ; 0x004: 0x000001ff
kfracdb.ents:                         0 ; 0x008: 0x0000
kfracdb.ub2spare:                     0 ; 0x00a: 0x0000

没有使用的AU会显示invalid
$  kfed read /dev/raw/raw2 aunum=100 >/u01/zhaoyu.txt
$ more zhaoyu.txt
kfbh.endian:                          1 ; 0x000: 0x01
kfbh.hard:                           34 ; 0x001: 0x22
kfbh.type:                            0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt:                          0 ; 0x003: 0x00
kfbh.block.blk:                   82176 ; 0x004: T=0 NUMB=0x14100
kfbh.block.obj:                       2 ; 0x008: TYPE=0x0 NUMB=0x2
kfbh.check:                  2299953472 ; 0x00c: 0x89168140
kfbh.fcn.base:               2354524384 ; 0x010: 0x8c5730e0
kfbh.fcn.wrap:               2031162885 ; 0x014: 0x79111605
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
作者: Charele    时间: 2008-7-16 15:48
用以前ASM磁盘头的备份信息进行恢复:
SQL> !
$ dd if=/u01/asmdisk_header/raw1_header bs=4096 count=1 of=/dev/raw/raw1
读入了 1+0 个块
输出了 1+0 个块
$ exit

这里的raw1_header是如何形成的呢?就是把/dev/raw/raw1拷贝一下么?
作者: ruluo    时间: 2008-7-16 16:16
原帖由 赵宇 于 2008-7-16 14:17 发表


用kfed 来看一下: ausz ASM磁盘以AU为分配单位,AU一般是1M,所以是1048576
aunum就是第1个AU

$ kfed find /dev/raw/raw2 aunum=0 ausz=1048576
Block 0 has type 1
Block 1 has type 2
Block 2 has type 3
Block 3 has type 3



这里的ausz是什么, AU又是什么呢? :-)
作者: ruluo    时间: 2008-7-16 16:17
标题: 回复 #24 Charele 的帖子
就是从raw1, dd出来的第一个大小为4096的block
作者: Charele    时间: 2008-7-16 16:32
原帖由 ruluo 于 2008-7-16 16:17 发表
就是从raw1, dd出来的第一个大小为4096的block


这个文件是如何dd的?我用cp /dev/raw/raw1 /home/oracle/raw1.bak不行啊,
就停在那儿不动了,
作者: 赵宇    时间: 2008-7-16 16:38
原帖由 Charele 于 2008-7-16 15:48 发表
用以前ASM磁盘头的备份信息进行恢复:
SQL> !
$ dd if=/u01/asmdisk_header/raw1_header bs=4096 count=1 of=/dev/raw/raw1
读入了 1+0 个块
输出了 1+0 个块
$ exit

这里的raw1_header是如何形成的呢?就是把/dev/raw/raw1拷贝一下么?



也是用dd做的备份,把上面的命令改一下就做备份了
dd if=/dev/raw/raw1 bs=4096 count=1 of=/u01/asmdisk_header/raw1_header
作者: 赵宇    时间: 2008-7-16 16:44
原帖由 ruluo 于 2008-7-16 16:16 发表
这里的ausz是什么, AU又是什么呢? :-)



ausz是au大小
au是ASM在磁盘内部的最小分配单位 allocate unit
作者: Charele    时间: 2008-7-17 14:36
其实不用Raw设备,直接用/dev/sda1也是这可以样操作的。
之前我用kfed read /dev/sda1出错,是因为要在root下才可以。
感谢LZ的帖子,让我学会了很多!
作者: ruluo    时间: 2008-7-17 16:58
标题: 回复 #30 Charele 的帖子
赵宇此帖的确不错

你这个回复也回答了我上面一个问题:kfed同样可以直接读/dev/sda1这种块设备的。

此外,那种字符设备(/dev/raw/raw1)是不能cp的,得用dd

[ 本帖最后由 ruluo 于 2008-7-17 17:04 编辑 ]




欢迎光临 ITPUB论坛-专业的IT技术社区 (http://www.itpub.net/) Powered by Discuz! X3.2