备份了control file后启动失败解决
1、 在数据库oracle10g中用冷备份备份了数据库中的所有的数据文件、控制文件、重做日志文件。
2、 原来的数据库的数据文件、控制文件、重做日志文件丢失了 ,把冷备份中的数据文件、控制文件、重做日志文件拷贝了 过来。
3、 重新启动数据库,出现以下错误:
SQL> startup
ORACLE instance started.
Total System Global Area 268435456 bytes
Fixed Size 1218868 bytes
Variable Size 88082124 bytes
Database Buffers 171966464 bytes
Redo Buffers 7168000 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 6: '/u01/app/oracle/orac/system01.bdf'
ORA-01207: file is more recent than control file - old control file
Oracle的控制文件是随着数据库的打开关闭动态更新的,所以发现目前的 控制文件不是最新的!
主导思想:创建控制文件,然后open数据库。
首先删除old control file,其实也可以不删除,个人习惯,然后重建控制文件。
重建控制文件可以在数据库到mount状态下执行alter database backup controlfile to trace生成sql文件,具体操作很简单,不再描述。
1) 删除控制文件
[oracle@mzl orcl]$ pwd
/u01/app/oracle/oradata/orac
[oracle@mzl orcl]$ rm *.ctl
2) 编写创建控制文件的脚本
[oracle@localhost orcl]$ vi create.sql
内容如下:
[oracle@mzl orcl]$ cat createctl.sql
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORAC" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'/u01/app/oracle/oradata/orac/redo01.log',
'/u01/app/oracle/oradata/orac/redo01a.log'
) SIZE 50M,
GROUP 2 (
'/u01/app/oracle/oradata/orac/redo02.log',
'/u01/app/oracle/oradata/orac/redo02a.log'
) SIZE 50M,
GROUP 3 (
'/u01/app/oracle/oradata/orac/redo03.log',
'/u01/app/oracle/oradata/orac/redo03a.log'
) SIZE 50M,
GROUP 4 (
'/u01/app/oracle/oradata/orac/redo04.log',
'/u01/app/oracle/oradata/orac/redo04a.log'
) SIZE 20M
-- STANDBY LOGFILE
DATAFILE
'/home/oracle/backup/system01.dbf',
'/u01/app/oracle/oradata/orac/undotbs01.dbf',
'/u01/app/oracle/oradata/orac/sysaux01.dbf',
'/home/oracle/backup/users01.dbf',
'/u01/app/oracle/oradata/orac/example01.dbf',
'/u01/app/oracle/data01.dbf',
'/home/oracle/backup/index01.dbf',
'/u01/app/oracle/oradata/qq/qq01.dbf',
'/u01/app/oracle/oradata/qq/qq02.dbf',
'/u01/app/oracle/oradata/qq/qq_undo.dbf',
'/u01/app/oracle/oradata/qq/qq_undo01.dbf',
'/u01/app/oracle/oradata/qq/qq03.dbf',
'/u01/app/oracle/oradata/orac/user02.dbf',
'/u01/app/oracle/oradata/tools01.dbf'
CHARACTER SET WE8ISO8859P1
;
4、创建control file 文件:
12:18:47 SQL> @createctl.sql
Control file created.
12:18:52 SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
12:19:11 SQL> alter database open resetlogs;
Database altered.
12:20:11 SQL> select * from v$controlfile;
STATUS
-------
NAME
------------------------------------------------------------------------------------------------------------------------
IS_ BLOCK_SIZE FILE_SIZE_BLKS
--- ---------- --------------
/u01/app/oracle/oradata/orac/control01.ctl
NO 16384 450
/u01/app/oracle/oradata/orac/control02.ctl
NO 16384 450
/u01/app/oracle/oradata/orac/control03.ctl
NO 16384 450
12:20:28 SQL> startup force;
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 83888372 bytes
Database Buffers 79691776 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lqx0405/archive/2010/08/17/5817764.aspx