ORA-01207: old control file完全解决方案
这个错误是oracle db最常见的错误了,引起的原因很多,但是最主要的一个原因是数据库服务器突然掉电,然后重启启动数据库报错。
究其这个问题产生的原因,其实就是控制文件中记录的db信息太老,导致数据库在启动检测时出现不一致。
控制文件中记录了整个数据库的全部信息,具体包括数据文件的,日志文件等等。
那么为什么会出现控制文件记录的数据库信息太老呢,原因很简单:根据oracle db运行原理,数据库在运行期间,由于检查点发生等原因会不断的更新控制文件,同时数据库在关闭和重启过程中都会更新控制文件的内容,但是数据库服务器突然的掉电,会导致当前的db信息无法适时更新到控制文件中,再次启动数据库后,当oracle检测控制文件和其它文件信息是否一致时,就出现了这个错误。
那么解决这个问题的方法有两个:
方法1:
u 主导思想:创建控制文件,然后open数据库。
u 具体步骤:
1.startup mount
2.alter database backup controlfile to trace
3.create a control file creation script. from the trace file,
and use the noresetlogs option
4.shutdown
5.startup nomount
Use the script. generated by the 'backup controlfile to trace' command above
creaet the control file
6.recover database
7.alter database open
u 步骤演示:
[oracle@localhost orcl]$ sqlplus "/as sysdba"
SQL*Plus: Release10.2.0.1.0 - Production on Sun Nov 19 15:26:07 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database10gEnterpriseEdition Release10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
添加测试数据:
SQL> create table gaojf as select * from all_objects;
Table created.
SQL> insert into gaojf select * from gaojf;
49390 rows created.
SQL> /
98780 rows created.
…………………………………
1580480 rows created.
SQL> commit;
Commit complete.
SQL> shutdown abort
ORACLE instance shut down.
SQL> quit
Disconnected from Oracle Database10gEnterpriseEdition Release10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
模拟ORA-01207错误(将控制文件删除一个,启动之后再copy到原位置)很简单,这里不再说明,然后接着如下:
[oracle@localhost orcl]$ sqlplus "/as sysdba"
SQL*Plus: Release10.2.0.1.0 - Production on Sun Nov 19 15:26:47 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 71305460 bytes
Database Buffers 92274688 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/free/oracle/oradata/orcl/system01.dbf'
ORA-01207: file is more recent than control file - old control file
出现了ORA-01207错误:
SQL> shutdown abort
ORACLE instance shut down.
SQL> quit
Disconnected from Oracle Database10gEnterpriseEdition Release10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
首先删除old control file,其实也可以不删除,个人习惯,然后重建控制文件。
重建控制文件可以在数据库到mount状态下执行alter database backup controlfile to trace生成sql文件,具体操作很简单,不再描述。
[oracle@localhost orcl]$ rm -rf control0*
[oracle@localhost orcl]$ vi create.sql
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/free/oracle/oradata/orcl/redo01.log' SIZE50M,
GROUP 2 '/free/oracle/oradata/orcl/redo02.log' SIZE50M,
GROUP 3 '/free/oracle/oradata/orcl/redo03.log' SIZE50M
-- STANDBY LOGFILE
DATAFILE
'/free/oracle/oradata/orcl/system01.dbf',
'/free/oracle/oradata/orcl/undotbs01.dbf',
'/free/oracle/oradata/orcl/sysaux01.dbf',
'/free/oracle/oradata/orcl/users01.dbf',
'/free/oracle/oradata/orcl/gaojfdb.dbf'
CHARACTER SET AL32UTF8
;
[oracle@localhost orcl]$ sqlplus "/as sysdba"
SQL*Plus: Release10.2.0.1.0 - Production on Sun Nov 19 15:28:00 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> @create
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23033727/viewspace-629666/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23033727/viewspace-629666/
本文详细介绍了Oracle数据库中ORA-01207错误的产生原因及两种解决方法,一种是通过创建新的控制文件并打开数据库来解决,另一种则是通过恢复数据库的方式。
1427

被折叠的 条评论
为什么被折叠?



