关于数据文件头内容与oracle启动

可以通过一个内部事件来转储数据文件头信息,这个常用的命令是:

alter session set events 'immediate trace name file_hdrs level 10';

那么我们来看一下这个命令得到的trace文件及内容。
immediate
关闭数据库,在mount状态下执行该命令

 

SQL> startup mount;
ORACLE instance started.

Total System Global Area  139531744 bytes
Fixed Size                   452064 bytes
Variable Size             121634816 bytes
Database Buffers           16777216 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL> alter session set events 'immediate trace name file_hdrs level 10';

Session altered.

 

选取一个文件的信息,这里选择myoracle01.dbf文件,我们注意,以下就是trace文件摘录的信息:

 

DATA FILE #4:
  (name #4) /opt/oracle/oradata/myoracle/myoracle01.dbf
creation size=0 block size=8192 status=0xe head=4 tail=4 dup=1
 tablespace 4, index=4 krfil=4 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:53 scn: 0x 0000.002ac5f9 08/10/2006 20:58:21
 Stop scn: 0x0000.002ac5f9 08/10/2006 20:58:21
 Creation Checkpointed at scn:  0x0000.0015078d 06/06/2006 09:41:54
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
 Offline scn: 0x0000.00000000 prev_range: 0
 Online Checkpointed at scn:  0x0000.00000000
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
 Hot Backup end marker scn: 0x0000.00000000
 aux_file is NOT DEFINED
 FILE HEADER:
        Software vsn=153092096=0x9200000, Compatibility Vsn=134217728=0x8000000
        Db ID=1407686520=0x53e79778, Db Name='MYORACLE'
        Activation ID=0=0x0
        Control Seq=973=0x3cd, File size=1280=0x500
        File Number=4, Blksiz=8192, File Type=3 DATA
Tablespace #4 - MYORACLE  rel_fn:4
Creation   at   scn: 0x0000.0015078d 06/06/2006 09:41:54
Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00 thread:0
 reset logs count:0x232bee1f scn: 0x0000.0007c781 recovered at 08/10/2006 20:57:53
 status:0x0 root dba:0x00000000 chkpt cnt: 53 ctl cnt:52
begin-hot-backup file size: 0
Checkpointed at scn:  0x0000.002ac5f9 08/10/2006 20:58:21
 thread:1 rba:(0x35.1275.10)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
Backup Checkpointed at scn:  0x0000.00000000
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
External cache id: 0x0 0x0 0x0 0x0
Absolute fuzzy scn: 0x0000.00000000
Recovery fuzzy scn: 0x0000.00000000 08/10/2006 10:46:03
Terminal Recovery Stamp scn: 0x0000.00000000 01/01/1988 00:00:00

 

注意,这其中"FILE HEADER"开始的信息就是来自数据文件头,之前的相关内容来自控制文件。

我们可以在mount状态下将myoracle01.dbf文件移除:

 

[oracle@jumper myoracle]$ mv myoracle01.dbf myoracle01.dbf.n
[oracle@jumper myoracle]$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Thu Aug 10 21:44:10 2006

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production

SQL> alter session set events 'immediate trace name file_hdrs level 10';

Session altered.

SQL> !

 

"FILE HEADER"部分信息将无法获得。

 

DATA FILE #4:
  (name #4) /opt/oracle/oradata/myoracle/myoracle01.dbf
creation size=0 block size=8192 status=0xe head=4 tail=4 dup=1
 tablespace 4, index=4 krfil=4 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:53 scn: 0x0000.002ac5f9 08/10/2006 20:58:21
 Stop scn: 0x0000.002ac5f9 08/10/2006 20:58:21
 Creation Checkpointed at scn:  0x0000.0015078d 06/06/2006 09:41:54
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
 Offline scn: 0x0000.00000000 prev_range: 0
 Online Checkpointed at scn:  0x0000.00000000
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000
 Hot Backup end marker scn: 0x0000.00000000
 aux_file is NOT DEFINED
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/opt/oracle/oradata/myoracle/myoracle01.dbf'
*** Error 1157 in open/read file # 4 ***
DUMP OF TEMP FILES: 0 files in database

 

此时报出的错误是,文件无法找到,也就是说当我们执行trace file_hdrs时需要读取数据文件头,获得相关信息。

 

 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值