中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

oracle asm amdu和dd使用

發布時間:2020-08-03 13:42:12 來源:網絡 閱讀:518 作者:snowhill 欄目:關系型數據庫

隨著數據庫新版本的推廣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_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_size4K,au_size4M.

$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%';


結果就不一一展示了,總計是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 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號



向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

东宁县| 阿克苏市| 灵宝市| 靖远县| 革吉县| 香河县| 泰和县| 怀来县| 博乐市| 富顺县| 乐陵市| 重庆市| 孝昌县| 固始县| 利辛县| 贞丰县| 垣曲县| 屏山县| 河曲县| 株洲市| 丰都县| 镇雄县| 景泰县| 辽宁省| 麻城市| 南宁市| 石台县| 佛山市| 房山区| 郸城县| 常州市| 西乌珠穆沁旗| 阳东县| 沾益县| 玉山县| 通榆县| 灵山县| 鄂托克旗| 民丰县| 宜都市| 潞城市|