Oracle控制文件的恢复

数据库 Oracle
从Oracle备份中可以恢复控制文件,如果控制文件是旧的。我们可以通过重建控制文件或者从旧的数据备份开始恢复。

如果Oracle控制文件是从备份中恢复的,下面就为您详细介绍Oracle控制文件的恢复,供您参考,希望对您学习Oracle控制文件能有所帮助。

那么数据库在open过程中又将如何呢?

首先备份Oracle控制文件控制文件,打开数据库,增进检查点:

  1. [oracle@jumper eygle]$ cp control01.ctl control01.ctl.bak  
  2. [oracle@jumper eygle]$ sqlplus "/ as sysdba"  
  3.  
  4. SQL*Plus: Release 9.2.0.4.0 - Production on Fri Aug 11 10:46:05 2006  
  5.  
  6. Copyright (c) 1982, 2002, Oracle Corporation.   All rights reserved.  
  7.  
  8. Connected to an idle instance.  
  9.  
  10. SQL> startup  
  11. ORACLE instance started.  
  12.  
  13. Total System Global Area   139531744 bytes  
  14. Fixed Size                    452064 bytes  
  15. Variable Size              121634816 bytes  
  16. Database Buffers            16777216 bytes  
  17. Redo Buffers                  667648 bytes  
  18. Database mounted.  
  19. Database opened.  
  20. SQL> alter system checkpoint;  
  21.  
  22. System altered.  
  23.  
  24. SQL> shutdown immediate;  
  25. Database closed.  
  26. Database dismounted.  
  27. ORACLE instance shut down.  
  28. SQL> exit  
  29. Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production  
  30. With the Partitioning option  
  31. JServer Release 9.2.0.4.0 - Production  
  32.  

然后恢复旧的控制文件,mount数据库,转储数据文件头:

  1. [oracle@jumper eygle]$ mv control01.ctl control01.ctl.n  
  2. [oracle@jumper eygle]$ mv control01.ctl.bak control01.ctl   
  3. [oracle@jumper eygle]$ sqlplus "/ as sysdba"  
  4.  
  5. SQL*Plus: Release 9.2.0.4.0 - Production on Fri Aug 11 10:46:50 2006  
  6.  
  7. Copyright (c) 1982, 2002, Oracle Corporation.   All rights reserved.  
  8.  
  9. Connected to an idle instance.  
  10.  
  11. SQL> startup mount;  
  12. ORACLE instance started.  
  13.  
  14. Total System Global Area   139531744 bytes  
  15. Fixed Size                    452064 bytes  
  16. Variable Size              121634816 bytes  
  17. Database Buffers            16777216 bytes  
  18. Redo Buffers                  667648 bytes  
  19. Database mounted.  
  20. SQL> alter session set events 'immediate trace name file_hdrs level 10';  
  21.  
  22. Session altered.  
  23.  
  24. SQL> !  
  25.  

我们看Oracle控制文件控制文件的信息(选择一个文件):

  1. DATA FILE #4:   
  2.    (name #4) /opt/oracle/oradata/eygle/eygle01.dbf  
  3. creation size=0 block size=8192 status=0xe head=4 tail=4 dup=1 
  4. tablespace 4, index=4 krfil=4 prev_file=0 
  5. unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00  
  6. Checkpoint cnt:61 scn: 0x0000.002acb1e 08/11/2006 10:44:38  
  7. Stop scn: 0x0000.002acb1e 08/11/2006 10:44:38  
  8. Creation Checkpointed at scn:   0x0000.0015078d 06/06/2006 09:41:54  
  9.  

再看数据文件头信息:

  1. FILE HEADER:  
  2.          Software vsn=153092096=0x9200000, Compatibility Vsn=134217728=0x8000000  
  3.          Db ID=1407686520=0x53e79778, Db Name='EYGLE' 
  4.          Activation ID=0=0x0  
  5.          Control Seq=989=0x3dd, File size=1280=0x500  
  6.          File Number=4Blksiz=8192, File Type=3 DATA  
  7. Tablespace #4 - EYGLE   rel_fn:4   
  8. Creation    at    scn: 0x0000.0015078d 06/06/2006 09:41:54  
  9. Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00 thread:0  
  10. reset logs count:0x232bee1f scn: 0x0000.0007c781 recovered at 08/11/2006 10:11:26  
  11. status:0x0 root dba:0x00000000 chkpt cnt: 64 ctl cnt:63  
  12. begin-hot-backup file size: 0  
  13. Checkpointed at scn:   0x0000.002acb98 08/11/2006 10:46:24  
  14.  

我们注意到数据文件的chkpt cnt: 64 要大约控制文件的Checkpoint cnt:61,也就是说控制文件是旧的。

此时尝试打开数据库就会出现如下错误:

  1. [oracle@jumper udump]$ sqlplus "/ as sysdba"  
  2.  
  3. SQL*Plus: Release 9.2.0.4.0 - Production on Fri Aug 11 10:51:20 2006  
  4.  
  5. Copyright (c) 1982, 2002, Oracle Corporation.   All rights reserved.  
  6.  
  7. Connected to:  
  8. Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production  
  9. With the Partitioning option  
  10. JServer Release 9.2.0.4.0 - Production  
  11.  
  12. SQL> alter database open;  
  13. alter database open  
  14. *  
  15. ERROR at line 1:  
  16. ORA-01122: database file 1 failed verification check  
  17. ORA-01110: data file 1: '/opt/oracle/oradata/eygle/system01.dbf'  
  18. ORA-01207: file is more recent than controlfile - old controlfile  
  19.  

Oracle告诉我们,控制文件是旧的。此时我们可以通过重建控制文件或者从旧的数据备份开始恢复。
 

 

 

【编辑推荐】

Oracle单行日期函数简介

Oracle bitand( )函数简介

oracle聚合函数的使用

oracle管道函数的用法

oracle自定义函数的使用

 

责任编辑:段燃 来源: 互联网
相关推荐

2011-08-02 08:59:52

Oracle控制文件

2010-10-29 14:20:54

Oracle移动控制文

2010-04-27 14:18:56

Oracle控制文件

2011-08-29 16:41:14

OracleRMAN恢复数据文件的恢复

2010-04-19 16:51:11

Oracle控制文件

2010-04-19 16:09:22

Oracle控制文件

2010-04-12 14:33:43

Oracle备份恢复

2011-05-26 15:27:08

Oracle数据库

2010-04-02 10:30:52

Oracle备份

2010-05-06 09:42:28

Oracle表空间

2009-06-29 18:09:12

多路复用Oracle

2011-05-24 10:26:12

Oracle数据库日志文件

2010-04-14 17:11:13

Oracle管理

2011-05-17 11:33:43

oracle数据库

2010-04-02 10:16:17

Oracle备份

2009-03-17 16:00:47

Oracle数据库备份

2011-05-20 09:35:24

Oracle数据库恢复备份

2010-04-01 11:21:51

Oracle备份

2017-06-14 21:31:39

数据库Oracleresetlogs

2010-08-13 14:08:45

Oracle
点赞
收藏

51CTO技术栈公众号