Oracle使用dump轉儲資料區塊

來源:互聯網
上載者:User

標籤:oracle dump datafile block

在對Oracle做一些比較核心的研究時,會用需要用到dump命令把資料庫中的資訊轉儲到trace檔案中。本文簡單介紹使用dump命令把資料區塊中的資訊轉儲到trace檔案中。

實驗環境:rhel7.2+11.2.0.4

文法:

alter system dump datafile {File no} block {Block no};
alter system dump datafile 4 block 129;
alter system dump datafile {File no} block min {Block min} block max {Block max};
alter system dump datafile 4 block min 129 block max 133;

alter system dump datafile ‘{name}‘ block {Block no};
alter system dump datafile ‘{name}‘ block min {Block min} block max {Block max};

1、建立測試表

[email protected]>drop table t;Table dropped.[email protected]>create table t as select * from dual;Table created.[email protected]>select * from t;D-XXX3 rows selected.

2、查詢資料表所在的資料區塊號

[email protected]>select dbms_rowid.ROWID_RELATIVE_FNO(rowid),dbms_rowid.ROWID_BLOCK_NUMBER(rowid) from t;DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID) DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)------------------------------------ ------------------------------------   4    37771   4    37771   4    377713 rows selected.

從上面的查詢中可以看到三條資料都儲存在4號檔案的37771塊上。

3、使用dump命令轉儲塊資訊到trace檔案中,並找到相應的trace檔案

[email protected]>alter system dump datafile 4 block 37771;System altered.[email protected]>select value from v$diag_info where name=‘Default Trace File‘;VALUE-------------------------------------------------------------------------/u01/app/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_5332.trc

4、查看trace檔案中的內容

650) this.width=650;" src="https://s4.51cto.com/wyfs02/M02/08/5A/wKiom1ngNYfCh_0zAABwv61ESF0939.png" style="float:none;" title="1.png" alt="wKiom1ngNYfCh_0zAABwv61ESF0939.png" />

650) this.width=650;" src="https://s5.51cto.com/wyfs02/M02/A7/11/wKioL1ngMtGy8gXYAACJpOS68sw753.png" style="float:none;" title="2.png" alt="wKioL1ngMtGy8gXYAACJpOS68sw753.png" />

上面截取了一些資訊:包含表的object_id <objn 90835>,表上的事務槽資訊、表中的三行資料的詳細資料等。

轉儲出來的trace檔案包含大量的資訊,如果能看懂並分析這樣的trace檔案,說明向大師又邁近了一步。

不同版本對資料庫dump出來的trace檔案,出處有所不同,可能是從磁碟也可能是從buffer cache中,有興趣的同學可以自行測試。


參考:《OracleCore Essential Internals for DBAs and Developers》

本文出自 “DBA Fighting!” 部落格,請務必保留此出處http://hbxztc.blog.51cto.com/1587495/1972013

Oracle使用dump轉儲資料區塊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.