千家信息网

oracle asm amdu和dd使用

发表于:2024-11-28 作者:千家信息网编辑
千家信息网最后更新 2024年11月28日,随着数据库新版本的推广ASM肯定会越来越被重视。在11g里未出来之前,能做的很有限,想要copyASM里一个文件出来,只有用DD和exec dbms_file_transfer.copy_file()
千家信息网最后更新 2024年11月28日oracle asm amdu和dd使用

随着数据库新版本的推广ASM肯定会越来越被重视。在11g里未出来之前,能做的很有限,想要copyASM里一个文件出来,只有用DDexec dbms_file_transfer.copy_file(),如果块坏了,那只能用DD找到对应的文件DD出来,再做BBED分析。在11G里出了AMDU,这个可以使用在10G上。下面了解下其用法,并和DD对比,起一个抛砖的作用。

AMDUoracle 11g自带的一款asm文件抽取工具,也可以给oracle 10g用,用法参见oraclemetalink 553639.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_INCARNATIONspfile.266.866828907                       266                         477                         866828907spfiledb.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=134217728db2.__db_cache_size=146800640db1.__java_pool_size=4194304db2.__java_pool_size=4194304db1.__large_pool_size=8388608db2.__large_pool_size=8388608db2.__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 cWHERE a.number_kffxp = c.file_numberAND a.GROUP_KFFXP = b.group_numberAND a.disk_kffxp = b.disk_numberAND b.group_number=1AND c.name LIKE'%spfile%';GROUP_KFFXP    DISK_KFFXP         AU_KFFXP            PATH                      NAME1                                                              0                                              208                         /dev/raw/raw4   spfiledb.ora1                                                              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    TYPEDATA     4096                       4194304                                                CONNECTED        EXTERNARCH     4096                       0                                                              DISMOUNTED

这里block_size4K,au_size4M.

$dd if=/dev/raw/raw4 bs=4096 count=1skip=212992 of=spfile.ora
说明:skip=208*1024[grid@mysql-1 ~]$ strings spfile.oradb1.__db_cache_size=134217728db2.__db_cache_size=150994944……………………………………………………….db1.thread=1db2.thread=4db1.undo_tablespace='UNDOTBS1'db2.undo_tablespace='UNDOTBS4'

抽取文件:

SQL>select file#,name,bytes/1024/1024 from v$datafile wherename like '%users%';FILE#       NAME      BYTES/1024/10244              +DATA/db/users01.dbf                                                                           2728.755              +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=8192DBVERIFY: 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         : 12800Total PagesProcessed (Data) : 252Total PagesFailing   (Data) : 0Total PagesProcessed (Index): 0Total PagesFailing   (Index): 0Total PagesProcessed (Other): 131Total PagesProcessed (Seg)  : 0Total PagesFailing   (Seg)  : 0Total PagesEmpty            : 12417Total Pages MarkedCorrupt   : 0Total PagesInflux           : 0Total Pages Encrypted        : 0Highest 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 cWHEREa.number_kffxp = c.file_numberANDa.GROUP_KFFXP = b.group_numberAND a.disk_kffxp= b.disk_numberANDb.group_number=1AND c.name LIKE '%USERS.274%';


结果就不一一展示了,总计是26AU,每个4M,正好100+4=104M.另外也可以看出,这里数据文件已打散。

这里再用DDDD出这些块,然后合并,过程如下:
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 cWHERE a.number_kffxp = c.file_numberAND a.GROUP_KFFXP = b.group_numberAND a.disk_kffxp = b.disk_numberAND b.group_number=1AND c.name LIKE '%USERS.274%'order by XNUM_KFFXPddif=/dev/raw/raw4 bs=4194304 count=1 skip=392 of=users_0.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=571 of=users_1.dbfddif=/dev/raw/raw3 bs=4194304 count=1 skip=384 of=users_2.dbfddif=/dev/raw/raw4 bs=4194304 count=1 skip=393 of=users_3.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=572 of=users_4.dbfddif=/dev/raw/raw3 bs=4194304 count=1 skip=385 of=users_5.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=573 of=users_6.dbfddif=/dev/raw/raw4 bs=4194304 count=1 skip=394 of=users_7.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=574 of=users_8.dbfddif=/dev/raw/raw3 bs=4194304 count=1 skip=386 of=users_9.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=575 of=users_10.dbfddif=/dev/raw/raw4 bs=4194304 count=1 skip=395 of=users_11.dbfddif=/dev/raw/raw3 bs=4194304 count=1 skip=387 of=users_12.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=704 of=users_13.dbfddif=/dev/raw/raw4 bs=4194304 count=1 skip=396 of=users_14.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=705 of=users_15.dbfddif=/dev/raw/raw3 bs=4194304 count=1 skip=388 of=users_16.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=706 of=users_17.dbfddif=/dev/raw/raw4 bs=4194304 count=1 skip=397 of=users_18.dbfddif=/dev/raw/raw3 bs=4194304 count=1 skip=389 of=users_19.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=707 of=users_20.dbfddif=/dev/raw/raw4 bs=4194304 count=1 skip=398 of=users_21.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=708 of=users_22.dbfddif=/dev/raw/raw3 bs=4194304 count=1 skip=390 of=users_23.dbfddif=/dev/raw/raw2 bs=4194304 count=1 skip=709 of=users_24.dbfddif=/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 cWHERE a.number_kffxp = c.file_numberAND a.GROUP_KFFXP = b.group_numberAND a.disk_kffxp = b.disk_numberAND b.group_number=1AND c.name LIKE'%USERS.274%'orderby XNUM_KFFXPdd if=users_0.dbf bs=4194304 count=1 seek=0of=users.274.dbfdd if=users_1.dbf bs=4194304 count=1 seek=1of=users.274.dbfdd if=users_2.dbf bs=4194304 count=1 seek=2of=users.274.dbfdd if=users_3.dbf bs=4194304 count=1 seek=3of=users.274.dbfdd if=users_4.dbf bs=4194304 count=1 seek=4of=users.274.dbfdd if=users_5.dbf bs=4194304 count=1 seek=5of=users.274.dbfdd if=users_6.dbf bs=4194304 count=1 seek=6of=users.274.dbfdd if=users_7.dbf bs=4194304 count=1 seek=7of=users.274.dbfdd if=users_8.dbf bs=4194304 count=1 seek=8of=users.274.dbfdd if=users_9.dbf bs=4194304 count=1 seek=9of=users.274.dbfdd if=users_10.dbf bs=4194304 count=1seek=10 of=users.274.dbfdd if=users_11.dbf bs=4194304 count=1seek=11 of=users.274.dbfdd if=users_12.dbf bs=4194304 count=1seek=12 of=users.274.dbfdd if=users_13.dbf bs=4194304 count=1seek=13 of=users.274.dbfdd if=users_14.dbf bs=4194304 count=1seek=14 of=users.274.dbfdd if=users_15.dbf bs=4194304 count=1seek=15 of=users.274.dbfdd if=users_16.dbf bs=4194304 count=1seek=16 of=users.274.dbfdd if=users_17.dbf bs=4194304 count=1seek=17 of=users.274.dbfdd if=users_18.dbf bs=4194304 count=1seek=18 of=users.274.dbfdd if=users_19.dbf bs=4194304 count=1seek=19 of=users.274.dbfdd if=users_20.dbf bs=4194304 count=1seek=20 of=users.274.dbfdd if=users_21.dbf bs=4194304 count=1seek=21 of=users.274.dbfdd if=users_22.dbf bs=4194304 count=1seek=22 of=users.274.dbfdd if=users_23.dbf bs=4194304 count=1seek=23 of=users.274.dbfdd if=users_24.dbf bs=4194304 count=1seek=24 of=users.274.dbfdd 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 2015Copyright(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.fDBVERIFY- Verification completeTotalPages Examined         : 12800TotalPages Processed (Data) : 252TotalPages Failing   (Data) : 0TotalPages Processed (Index): 0TotalPages Failing   (Index): 0TotalPages Processed (Other): 131TotalPages Processed (Seg)  : 0TotalPages Failing   (Seg)  : 0TotalPages Empty            : 12417TotalPages Marked Corrupt   : 0TotalPages Influx           : 0TotalPages Encrypted        : 0Highestblock SCN            : 4075933(0.4075933)[grid@mysql-1amdu_2015_12_21_13_39_36]$ dbv file=users.274.dbfDBVERIFY:Release 11.2.0.4.0 - Production on Mon Dec 21 13:41:17 2015Copyright(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.dbfDBVERIFY- Verification completeTotalPages Examined         : 12800TotalPages Processed (Data) : 252TotalPages Failing   (Data) : 0TotalPages Processed (Index): 0TotalPages Failing   (Index): 0TotalPages Processed (Other): 131TotalPages Processed (Seg)  : 0TotalPages Failing   (Seg)  : 0TotalPages Empty            : 12417TotalPages Marked Corrupt   : 0TotalPages Influx           : 0TotalPages Encrypted        : 0Highestblock SCN            : 4075933(0.4075933)

两者在dbv验证都可以通过。

附:x$kffxp简要说明:

GROUP_KFFXP :磁盘组编号NUMBER_KFFXP  :文件编号PXN_KFFXP  :物理区号XNUM_KFFXP :逻辑区号LXN_KFFXP  :0=primary, 1=first mirror, 2=secondmirrorDISK_KFFXP :磁盘编号AU_KFFXP:AU号



文件 抽取 验证 区号 数据 磁盘 结果 作用 兴趣 只有 可以通过 大小 工具 数据库 有限 流程 物理 简要 视图 越来越 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 工业互联网展会的黑科技 我的世界密室杀手服务器在哪里玩 湖南本地软件开发定制优势 租借云端服务是否要买数据库 数据库技术及应用王成良网课 易安卓连接数据库源码 数据库统计产品个数最多 构建数据库的要点 一个电脑能装二个数据库吗 怎么通过数据库判断学术高低 数据库设计技术可行性 数据库指定表容量查询 网络安全中的抓包软件 自贡软件开发电话 和平精英手游如何选服务器 苏州的科技互联网公司 网络安全研究员是什么学历 nac网络安全准入控制哪家好 云服务器qq 上海创新软件开发价格走势 gps导航软件开发 一般软件开发的周期 王者打完为什么要重新连接服务器 怀柔区智能网络技术口碑推荐 台湾网络安全大世界 网络安全应具备的的功能 公安网络安全人才培养 丽江信息安全技术提升网络安全 软件开发和单片机编程区别 第六感程序是用什么软件开发的
0