明明白白使用資料區塊:資料區塊格式深入解析

來源:互聯網
上載者:User

Data Block是資料庫中最小的I/O單元,下面我來簡單介紹下資料區塊的基本結構。

OK!跟著我一步步實驗:

一、建資料表空間

SQL>create tablespace tp1 datafile '/oradata/bxocp/tp01.dbf' size 10M;

二、建使用者及授權

SQL>create user gyj identified by gyj default tablespace tp1;

SQL>grant dba to gyj;

三、建表

SQL>conn gyj/gyj

SQL>create table t1 (id int,name varchar2(100));

四、插入一行資料

SQL>insert into t1 values(1,'AAAAA');

SQL>commit;

五、手動發生一個檢查點,使上面一行資料寫到資料檔案

alter system checkpoint;

六、查這行資料所在的檔案號和塊號

SQL>col name for a10

SQL>select  id,name,dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block# from t1;

ID       NAME        FILE#     BLOCK#

  ----------   ---------       ----------    ----------

1      AAAAA        6        135

七、轉儲6號檔案135號塊,新開個視窗

[oracle@guoyj ~]$ sqlplus / as sysdba

SQL> alter system dump datafile 6 block 135;

八、找到轉儲的檔案

SQL> show parameter dump

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

background_core_dump                 string      partial

background_dump_dest                 string      /u01/app/oracle/diag/rdbms/bxo

cp/bxocp/trace

再開一新視窗

[oracle@guoyj ~]$ cd  /u01/app/oracle/diag/rdbms/bxocp/bxocp/trace

[oracle@guoyj trace]$ ls -lFtr

下面這個追蹤記錄檔就是6號檔案135號塊轉儲出來的資料區塊資訊

-rw-r----- 1 oracle oinstall   3363 Dec 11 18:02 bxocp_ora_5429.trc -

九、分析資料塊結構

[oracle@guoyj trace]$ vi bxocp_ora_5429.trc

Trace file /u01/app/oracle/diag/rdbms/bxocp/bxocp/trace/bxocp_ora_5429.trc

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORACLE_HOME = /u01/app/oracle/product/11.2.0

System name:    Linux

Node name:      guoyj

Release:        2.6.18-128.el5

Version:        #1 SMP Wed Dec 17 11:41:38 EST 2008

Machine:        x86_64

VM name:        VMWare Version: 6

Instance name: bxocp

Redo thread mounted by this instance: 1

Oracle process number: 28

Unix process pid: 5429, image: oracle@guoyj (TNS V1-V3)

*** 2012-12-11 18:02:31.307

*** SESSION ID:(29.15) 2012-12-11 18:02:31.307

*** CLIENT ID:() 2012-12-11 18:02:31.307

*** SERVICE NAME:(SYS$USERS) 2012-12-11 18:02:31.307

*** MODULE NAME:(sqlplus@guoyj (TNS V1-V3)) 2012-12-11 18:02:31.307

*** ACTION NAME:() 2012-12-11 18:02:31.307

Start dump data blocks tsn: 7 file#:6 minblk 135 maxblk 135

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.