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

来源:互联网 发布:辨析题 存在就是被告知 编辑:程序博客网 时间:2024/05/29 12:18

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

alter session set events 'immediate trace namefile_hdrs level 10';

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

 

SQL> startup mount;
ORACLE instance started.

Total System Global Area 139531744 bytes
FixedSize                  452064 bytes
VariableSize            121634816 bytes
DatabaseBuffers          16777216 bytes
RedoBuffers                667648 bytes
Database mounted.
SQL> alter session set events 'immediate trace namefile_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=4dup=1
 tablespace 4, index=4 krfil=4 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/198800:00:00
 Checkpoint cnt:53 scn: 0x0000.002ac5f9 08/10/2006 20:58:21
 Stop scn: 0x0000.002ac5f9 08/10/200620: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 0000000000000000 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 0000000000000000 00000000
  00000000 00000000
 Hot Backup end marker scn: 0x0000.00000000
 aux_file is NOT DEFINED
 FILE HEADER:
       Software vsn=153092096=0x9200000, CompatibilityVsn=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.0015078d06/06/2006 09:41:54
Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00thread:0
 reset logs count:0x232bee1f scn: 0x0000.0007c781recovered at 08/10/2006 20:57:53
 status:0x0 root dba:0x00000000 chkpt cnt: 53 ctlcnt:52
begin-hot-backup file size: 0
Checkpointed at scn:  0x0000.002ac5f9 08/10/200620:58:21
 thread:1 rba:(0x35.1275.10)
 enabled threads:  01000000 00000000 00000000 0000000000000000 00000000
  00000000 00000000
Backup Checkpointed at scn:  0x0000.00000000
 thread:0 rba:(0x0.0.0)
 enabled threads:  00000000 00000000 00000000 0000000000000000 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/198800:00:00

 

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

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

 

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

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

Copyright (c) 1982, 2002, OracleCorporation.  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> !

 

"FILEHEADER"部分信息将无法获得。

 

DATA FILE #4:
  (name #4)/opt/oracle/oradata/myoracle/myoracle01.dbf
creation size=0 block size=8192 status=0xe head=4 tail=4dup=1
 tablespace 4, index=4 krfil=4 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/198800:00:00
 Checkpoint cnt:53 scn: 0x0000.002ac5f9 08/10/200620:58:21
 Stop scn: 0x0000.002ac5f9 08/10/200620: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 0000000000000000 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 0000000000000000 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 tracefile
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

 

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

 

 


 

0 0
原创粉丝点击