符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
随着数据库新版本的推广ASM肯定会越来越被重视。在11g里未出来之前,能做的很有限,想要copyASM里一个文件出来,只有用DD和exec dbms_file_transfer.copy_file(),如果块坏了,那只能用DD找到对应的文件DD出来,再做BBED分析。在11G里出了AMDU,这个可以使用在10G上。下面了解下其用法,并和DD对比,起一个抛砖的作用。
创新互联自2013年创立以来,先为三台等服务建站,三台等地企业,进行企业商务咨询服务。为三台企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
AMDU是oracle 11g自带的一款asm文件抽取工具,也可以给oracle 10g用,用法参见oraclemetalink553639.1:
下载下来:
unzipamdu_X86-64.zip
exportLD_LIBRARY_PATH=./
抽取spfile
SQL>selectname,file_number,alias_index,file_incarnation from v$asm_alias where name like'%spfile%'; NAME FILE_NUMBER ALIAS_INDEX FILE_INCARNATION spfile.266.866828907 266 477 866828907 spfiledb.ora 266 227 866828907 [grid@MySQL-1]$ amdu -diskstring '/dev/raw/raw*' -extract data.266 [grid@mysql-1]$ strings DATA_266.f db1.__db_cache_size=134217728 db2.__db_cache_size=146800640 db1.__java_pool_size=4194304 db2.__java_pool_size=4194304 db1.__large_pool_size=8388608 db2.__large_pool_size=8388608 db2.__oracle_base='/opt/oracle' #ORACLE_BASEset from environment …………..
抽取看来是没有问题的。如有兴趣可以继续跟踪下amdu的抽取流程:
strace -o amdu.log amdu -diskstring'/dev/raw/raw*' -extract data.266
我们这里同样用DD演示:
SQL> SELECT a.GROUP_KFFXP, a.DISK_KFFXP,a.AU_KFFXP, b.path,c.name FROM x$kffxp a, v$asm_disk b, v$asm_alias c WHERE a.number_kffxp = c.file_number AND a.GROUP_KFFXP = b.group_number AND a.disk_kffxp = b.disk_number AND b.group_number=1 AND c.name LIKE'%spfile%'; GROUP_KFFXP DISK_KFFXP AU_KFFXP PATH NAME 1 0 208 /dev/raw/raw4 spfiledb.ora 1 0 208 /dev/raw/raw4 spfile.266.866828907
确定块大小:
SQL>selectname,block_size,allocation_unit_size,state,type from v$asm_diskgroup; NAME BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TYPE DATA 4096 4194304 CONNECTED EXTERN ARCH 4096 0 DISMOUNTED
这里block_size为4K,au_size为4M.
$dd if=/dev/raw/raw4 bs=4096 count=1skip=212992 of=spfile.ora
说明:skip=208*1024 [grid@mysql-1 ~]$ strings spfile.ora db1.__db_cache_size=134217728 db2.__db_cache_size=150994944 ………………………………………………………. db1.thread=1 db2.thread=4 db1.undo_tablespace='UNDOTBS1' db2.undo_tablespace='UNDOTBS4'
抽取文件:
SQL>select file#,name,bytes/1024/1024 from v$datafile wherename like '%users%'; FILE# NAME BYTES/1024/1024 4 +DATA/db/users01.dbf 2728.75 5 +DATA/db/datafile/users.274.896306467 100 #amdu -diskstring '/dev/raw/raw*'-extract data.274 #cat report.txt **************************EXTRACTING FILE DATA.274 ************************** Creating file: DATA_274.f Extraction wrote: 104865792 bytes Stripe size: 4194304 bytes Stripe columns: 1 Mirror copies: 1 Block size: 8192 bytes File size: 12801 blocks File type: 2 Extent size #1: 4294967295 extentsof 1 AUs Extent size #2: 0 extents of 1 AUs Extent size #3: 0 extents of 1 AUs Extent size #4: 4294967295 extentsof 1 AUs Creation time: 2015/11/2022:01:07.797000 Modified time: 2015/12/1820:00:00.000000 Data extents in file: 26 Dataextents found: 26 Blocks not found: 0 blocks
dbv验证
[grid@mysql-1]$ dbv file=DATA_274.fblocksize=8192 DBVERIFY: Release11.2.0.4.0 - Production on Fri Dec 18 22:28:15 2015 Copyright (c) 1982,2011, Oracle and/or its affiliates. Allrights reserved. DBVERIFY - Verification starting : FILE =/home/grid/amdu_2015_12_18_22_21_11/DATA_274.f DBVERIFY -Verification complete Total PagesExamined : 12800 Total PagesProcessed (Data) : 252 Total PagesFailing (Data) : 0 Total PagesProcessed (Index): 0 Total PagesFailing (Index): 0 Total PagesProcessed (Other): 131 Total PagesProcessed (Seg) : 0 Total PagesFailing (Seg) : 0 Total PagesEmpty : 12417 Total Pages MarkedCorrupt : 0 Total PagesInflux : 0 Total Pages Encrypted : 0 Highest blockSCN : 4075933 (0.4075933)
这里和x$视图对比一下:
SELECTa.GROUP_KFFXP, a.DISK_KFFXP, a.AU_KFFXP, b.path,c.name FROM x$kffxp a, v$asm_disk b, v$asm_alias c WHEREa.number_kffxp = c.file_number ANDa.GROUP_KFFXP = b.group_number AND a.disk_kffxp= b.disk_number ANDb.group_number=1 AND c.name LIKE '%USERS.274%';
结果就不一一展示了,总计是26个AU,每个4M,正好100+4=104M.另外也可以看出,这里数据文件已打散。
这里再用DD,DD出这些块,然后合并,过程如下:
1 取出相应的块
SQL>select'dd if='||b.path||' bs=4194304 count=1 skip='||au_kffxp||'of=users_'||XNUM_KFFXP||'.dbf' FROM x$kffxp a,v$asm_disk b, v$asm_alias c WHERE a.number_kffxp = c.file_number AND a.GROUP_KFFXP = b.group_number AND a.disk_kffxp = b.disk_number AND b.group_number=1 AND c.name LIKE '%USERS.274%' order by XNUM_KFFXP ddif=/dev/raw/raw4 bs=4194304 count=1 skip=392 of=users_0.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=571 of=users_1.dbf ddif=/dev/raw/raw3 bs=4194304 count=1 skip=384 of=users_2.dbf ddif=/dev/raw/raw4 bs=4194304 count=1 skip=393 of=users_3.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=572 of=users_4.dbf ddif=/dev/raw/raw3 bs=4194304 count=1 skip=385 of=users_5.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=573 of=users_6.dbf ddif=/dev/raw/raw4 bs=4194304 count=1 skip=394 of=users_7.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=574 of=users_8.dbf ddif=/dev/raw/raw3 bs=4194304 count=1 skip=386 of=users_9.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=575 of=users_10.dbf ddif=/dev/raw/raw4 bs=4194304 count=1 skip=395 of=users_11.dbf ddif=/dev/raw/raw3 bs=4194304 count=1 skip=387 of=users_12.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=704 of=users_13.dbf ddif=/dev/raw/raw4 bs=4194304 count=1 skip=396 of=users_14.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=705 of=users_15.dbf ddif=/dev/raw/raw3 bs=4194304 count=1 skip=388 of=users_16.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=706 of=users_17.dbf ddif=/dev/raw/raw4 bs=4194304 count=1 skip=397 of=users_18.dbf ddif=/dev/raw/raw3 bs=4194304 count=1 skip=389 of=users_19.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=707 of=users_20.dbf ddif=/dev/raw/raw4 bs=4194304 count=1 skip=398 of=users_21.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=708 of=users_22.dbf ddif=/dev/raw/raw3 bs=4194304 count=1 skip=390 of=users_23.dbf ddif=/dev/raw/raw2 bs=4194304 count=1 skip=709 of=users_24.dbf ddif=/dev/raw/raw4 bs=4194304 count=1 skip=399 of=users_25.dbf
2 执行上述结果,导出
3 合并
SQL>SELECT 'ddif=uses_'||XNUM_KFFXP||'.dbf bs=4194304 count=1seek='||XNUM_KFFXP||' of=users.274.dbf' FROM x$kffxp a, v$asm_disk b, v$asm_alias c WHERE a.number_kffxp = c.file_number AND a.GROUP_KFFXP = b.group_number AND a.disk_kffxp = b.disk_number AND b.group_number=1 AND c.name LIKE'%USERS.274%' orderby XNUM_KFFXP dd if=users_0.dbf bs=4194304 count=1 seek=0of=users.274.dbf dd if=users_1.dbf bs=4194304 count=1 seek=1of=users.274.dbf dd if=users_2.dbf bs=4194304 count=1 seek=2of=users.274.dbf dd if=users_3.dbf bs=4194304 count=1 seek=3of=users.274.dbf dd if=users_4.dbf bs=4194304 count=1 seek=4of=users.274.dbf dd if=users_5.dbf bs=4194304 count=1 seek=5of=users.274.dbf dd if=users_6.dbf bs=4194304 count=1 seek=6of=users.274.dbf dd if=users_7.dbf bs=4194304 count=1 seek=7of=users.274.dbf dd if=users_8.dbf bs=4194304 count=1 seek=8of=users.274.dbf dd if=users_9.dbf bs=4194304 count=1 seek=9of=users.274.dbf dd if=users_10.dbf bs=4194304 count=1seek=10 of=users.274.dbf dd if=users_11.dbf bs=4194304 count=1seek=11 of=users.274.dbf dd if=users_12.dbf bs=4194304 count=1seek=12 of=users.274.dbf dd if=users_13.dbf bs=4194304 count=1seek=13 of=users.274.dbf dd if=users_14.dbf bs=4194304 count=1seek=14 of=users.274.dbf dd if=users_15.dbf bs=4194304 count=1seek=15 of=users.274.dbf dd if=users_16.dbf bs=4194304 count=1seek=16 of=users.274.dbf dd if=users_17.dbf bs=4194304 count=1seek=17 of=users.274.dbf dd if=users_18.dbf bs=4194304 count=1seek=18 of=users.274.dbf dd if=users_19.dbf bs=4194304 count=1seek=19 of=users.274.dbf dd if=users_20.dbf bs=4194304 count=1seek=20 of=users.274.dbf dd if=users_21.dbf bs=4194304 count=1seek=21 of=users.274.dbf dd if=users_22.dbf bs=4194304 count=1seek=22 of=users.274.dbf dd if=users_23.dbf bs=4194304 count=1seek=23 of=users.274.dbf dd if=users_24.dbf bs=4194304 count=1seek=24 of=users.274.dbf dd if=users_25.dbf bs=4194304 count=1seek=25 of=users.274.dbf
4 对比验证
[grid@mysql-1amdu_2015_12_21_13_39_36]$ dbv file=DATA_274.f DBVERIFY: Release 11.2.0.4.0 - Production onMon Dec 21 13:41:09 2015 Copyright(c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY- Verification starting : FILE =/home/grid/users/amdu_2015_12_21_13_39_36/DATA_274.f DBVERIFY- Verification complete TotalPages Examined : 12800 TotalPages Processed (Data) : 252 TotalPages Failing (Data) : 0 TotalPages Processed (Index): 0 TotalPages Failing (Index): 0 TotalPages Processed (Other): 131 TotalPages Processed (Seg) : 0 TotalPages Failing (Seg) : 0 TotalPages Empty : 12417 TotalPages Marked Corrupt : 0 TotalPages Influx : 0 TotalPages Encrypted : 0 Highestblock SCN : 4075933(0.4075933) [grid@mysql-1amdu_2015_12_21_13_39_36]$ dbv file=users.274.dbf DBVERIFY:Release 11.2.0.4.0 - Production on Mon Dec 21 13:41:17 2015 Copyright(c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY- Verification starting : FILE =/home/grid/users/amdu_2015_12_21_13_39_36/users.274.dbf DBVERIFY- Verification complete TotalPages Examined : 12800 TotalPages Processed (Data) : 252 TotalPages Failing (Data) : 0 TotalPages Processed (Index): 0 TotalPages Failing (Index): 0 TotalPages Processed (Other): 131 TotalPages Processed (Seg) : 0 TotalPages Failing (Seg) : 0 TotalPages Empty : 12417 TotalPages Marked Corrupt : 0 TotalPages Influx : 0 TotalPages Encrypted : 0 Highestblock SCN : 4075933(0.4075933)
两者在dbv验证都可以通过。
附:x$kffxp简要说明:
GROUP_KFFXP :磁盘组编号 NUMBER_KFFXP :文件编号 PXN_KFFXP :物理区号 XNUM_KFFXP :逻辑区号 LXN_KFFXP :0=primary, 1=first mirror, 2=secondmirror DISK_KFFXP :磁盘编号 AU_KFFXP:AU号