dumping_oracle_blocks翻譯(一)個人翻譯,學習總結用

zhangshengdong發表於2011-11-30

Dumping Oracle Blocks

             dumping oracle  資料塊(Blocks

 

Brian Peasland, Raytheon at EROS Data Center

 

 

 

 

Introduction(介紹)

 

In a few cases, it is desirable to dump the contents of an Oracle data block.

在很少的情況下,dump 一個oracle的資料庫內容是很適事宜的。

These blocks may comprise a table, an index, or even the control file. While we

這些資料塊可能包含了包含了一張表,一個索引,甚至是一個控制檔案。      當我們

can query the contents of a table, we may want to see what is happening to a

能查詢一個表中的內容時,我們可能想看看那張表的一個特殊資料塊(block)究竟發生

particular block of that table. We might want to see not only the data in the

什麼。                        我們想看到的不僅是資料塊(block)裡任何能查詢出來
block that any query can return, but also see what’s going on behind the scenes

的資料。而且希望知道後臺究竟做了什麼手腳。

in the block. This paper will show you how to dump the contents of a block in a

             這篇文章就是告訴你們如何dump出一個在表或者索引或者控制檔案裡面

table, index and control file.This paper will also show you how to interpret some

的資料塊(block)。         這篇文章也同樣能告訴你如何解釋這些dump出來的結果數

of the results of these dumps.

 

Why Dump Blocks?(為什麼要dump資料塊(blcoks))

 

So why are we doing this? For the most part, it is just idle curiosity. DBAs are

為什麼我們要做這些?很大一部分程度,就是好奇!                       DBA天生就

inquisitive folks by nature. Oracle Corp. has released just enough information

是一幫很好奇的人。          Oracle公司,在沒有洩露任何祕密的情況下,已經發布了

on database internals to tantalize us without giving away all the secrets. And

足夠的資料庫的內部資訊來吊足我們的胃口。                                  然後

we’d like to see what’s going on behind the scenes. So for most cases, we are

讓我們想知道背後發生了什麼。                        所以大多數情況,我們dumping
dumping blocks just for fun. In other cases, we are dumping blocks to actually

資料塊只是為了好玩。         另外一些情況,我們dumping資料塊是為了實際的找出一

just for fun 我喜歡這個片語)

find out some meaningful information. But in the end, it is up to you.

些有意義的資訊,但是最後,隨你的便

 

 

Trace File Information(跟蹤檔案資訊)

 

All of the examples in this paper will generate trace files. Those trace files will be

這裡所有的例子都是為了生成跟蹤檔案。                    這些跟蹤檔案將會展現在

present in USER_DUMP_DEST for you to view. To determine the trace file

USER_DUMP_DEST檔案裡。                     為了確定跟蹤檔案的生成。

generated, use a query similar to the following:

            使用下面類似的查詢語句。

 

ORA9I SQL> select pa.value || '/' || i.instance_name || '_ora_'

  2         || pr.spid || '.trc' as trace_file

  3  from v$session s, v$process pr, v$parameter pa, v$instance i

  4  where s.username = user and s.paddr = pr.addr

  5* and pa.name='user_dump_dest';

 

TRACE_FILE

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

/edcsns14/pkg/oracle/admin/ora9i/udump/ora9i_ora_25199.trc

 

This query shows the full path and filename of the generated trace file for my

這個查詢語句將會顯示你的那個生成跟蹤檔案的全路徑和檔名(在你的session中)

session. This is the text file we look in to see the results of our dump.

         這是一個文字本件(我們可以在裡面看到我們dump的結果)

 

 

All trace files contain the same basic information at the beginning of the file.

所有跟蹤檔案都包含了一些開頭的基本資訊

 

Oracle9i Enterprise Edition Release 9.0.1.0.0 - Production

With the Partitioning option

JServer Release 9.0.1.0.0 - Production

ORACLE_HOME = /edcsns14/pkg/oracle/9.0.1

System name:    SunOS

Node name:      edcsns14

Release:        5.7

Version:        Generic_106541-11

Machine:        sun4u

Instance name: ora9i

Redo thread mounted by this instance: 1

Oracle process number: 11

Unix process pid: 653, image: oracle@edcsns14 (TNS V1-V3)

 

*** 2002-03-27 17:06:06.573

*** SESSION ID:(12.4240) 2002-03-27 17:06:06.535

 

Output similar to above is shown in each trace file. This output shows the

在每一個跟蹤檔案中上述的輸出都是類似的。            這個輸出都會展示資料庫的

database version, some platform. specific information such as host name and OS

版本,一些平臺特定的資訊例如host name(主機名)and OS(作業系統)等級,

level, the database instance name, the processes identifiers (Oracle and Unix)

資料庫例項名,生成跟蹤檔案會話的程式標示符(Oracle and Unix),

for the session that generated the trace file, and the date and time the file was

                                             和生成的時間和日期。

generated. We’ll skip this introductory information in examining our trace files.

            在檢測我們的跟蹤檔案時候,我們可以跳過這些引導資訊
 

Dumping A Table Block(dumping 一個資料塊)

 

To dump a block belonging to a table, you’ll need to know the file number and

為了dump所屬表的資料塊(block),             你必須瞭解那個資料塊的file號和

block number of that block. If you already know the file number and block, then

block號。                   如果你已經知道了file號和block號,然後你就都可以全部

you are all set. But for our example, we’ll want to figure that out.

設定。          但是針對我們的例子,我想去算出它來。

ORA9I SQL> select file_id,block_id,bytes,blocks

  2  from dba_extents

  3  where wner='PEASLAND' and segment_name='EMP';

 

FILE_ID   BLOCK_ID            BYTES   BLOCKS

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

      3          9           65,536        8

 

Here, I’ve queried the data dictionary to find out which file my EMP table resides

Here,我已經查詢了data dictionary來找出我的emp表屬於哪個檔案裡面。

in. The EMP table is in file# 3, starting at block# 9, and is eight blocks long. This

   emp表在檔案#3,開始於塊號#9,然後長度是8個資料塊的長度。             這個

query will return one row for each extent of the object. So this object is

查詢將會返回物件的每個區間(extent)的一行。            所以這個物件只包含了一

comprised of only one extent. We can verify which tablespace file# 3 belongs to

個區間(extent)。我們可以驗證通過下面的查詢語句知道檔案#3是屬於哪個表空間的

with the following query:

 

ORA9I SQL> select tablespace_name,file_name from dba_data_files

  2  where relative_fno = 3;

 

TABLESPACE_NAME                FILE_NAME

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

USER_DATA                      /edcsns14/oradata3/ora9i/user_data01.dbf

 

As I had expected, my table is in the USER_DATA tablespace

正如我所預料,我的表是在USER_DATA的表空間裡.

 

Now that we know which file and blocks hold our table, let’s dump a sample

現在我們知道哪個fileblocks控制著我們的表,             讓我們dump一個簡單的

block of the table. This is done as follows:

表的block.         以下是完成動作:

 

ORA9I SQL> alter system dump datafile 3 block 10;

 

System altered.

 

You can dump a range of blocks with the following command:

你可以dump 一個範圍的blocks通過下面的命令:

 

ORA9I SQL> alter system dump datafile 3 block min 10 block max 12;

 

System altered.

 

Let’s now look at the contents of dumping one block.

現在我們可以看看一個block的內容了。

 
tart dump data blocks tsn: 3 file#: 3 minblk 10 maxblk 10
buffer tsn: 3 rdba: 0x00c0000a (3/10)
scn: 0x0000.00046911 seq: 0x02 flg: 0x04 tail: 0x69110602
frmt: 0x02 chkval: 0x579d type: 0x06=trans data
Block header dump:  0x00c0000a
 Object id on Block? Y
 seg/obj: 0x6d9c  csc: 0x00.46911  itc: 2  flg: O  typ: 1 - DATA
     fsl: 0  fnx: 0x0 ver: 0x01
 
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   xid:  0x0005.02f.0000010c    uba: 0x00806f10.00ca.28  C---    0  scn 0x0000.00046900
 
 
                                
              以上翻譯都由晶晶小妹的技術貼的所引發的,從看到了晶晶小妹的第一個實驗貼,才發現,原來我學的oracle都不算oracle,一直聽得很迷糊的oracle體系結構的理論,沒想到一個dump就能進入到oracle的底層這麼深。才發現學習需身體力行,需持之以恆。
               由於,以上皆為自己學習總結用,所以排版和翻譯的字眼,均無考究。不足之處還望大牛指教。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26446098/viewspace-712395/,如需轉載,請註明出處,否則將追究法律責任。

相關文章