dumping_oracle_blocks翻译(一)个人翻译,学习总结用

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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26446098/viewspace-712395/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值