1、启动数据库主要报错如下:
ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: '/home/oracle/data/TRAFFIC_12C_3.DBF'
ORA-01207: file is more recent than control file - old control file
主要三由于ORA-01207:文件比控制文件更新-旧的控制文件导致的。
同时查看数据库状态为:MOUNTED:
SELECT NAME,OPEN_MODE FROM V$DATABASE;
SQL> SELECT NAME,OPEN_MODE FROM V$DATABASE;
NAME OPEN_MODE
--------- --------------------
XE MOUNTED
2、先使用 sqlplus sys/sys as sysdba 登陆,然后使用以下命令生成:controlfile 配置
alter database backup controlfile to trace as '/home/controlfile.sql';
打开controlfile.sql,可以查看到之前建立表空间等等的相关语句。
其中该文件只需要保留以下内容:
(该文件中有两大部分相似的控制语句,主要区别在于:NORESETLOGS 与 RESETLOGS,只需要保留 NORESETLOGS 那一部分(如下))
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "XE" NORESETLOGS NOARCHIVELOG
【省略。。。。】
RECOVER DATABASE
-- Database can now be opened normally.
ALTER DATABASE OPEN;
3、在 sqlplus中执行修改后的 controlfile.sql
SQL> @/home/controlfile.sql
如果提示以下错误,先运行:shutdown immediate; 先关闭
ORA-01081: cannot start already-running ORACLE - shut it down first
CREATE CONTROLFILE REUSE DATABASE "XE" NORESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01100: database already mounted
ORA-00283: recovery session canceled due to errors
ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: '/home/oracle/data/TRAFFIC_12C_3.DBF'
ORA-01207: file is more recent than control file - old control file
ALTER DATABASE OPEN
*
ERROR at line 1:
ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: '/home/oracle/data/TRAFFIC_12C_3.DBF'
ORA-01207: file is more recent than control file - old control file
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/xe/temp01.dbf' REUSE
*
ERROR at line 1:
ORA-01109: database not open
如果提示以下错误,但是,先不要慌,稳住:
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01100: database already mounted
4、遇到上面错误后,执行以下操作:
alter system set cluster_database=FALSE scope=spfile sid=’*’;
shutdown immediate;
SQL> alter system set cluster_database=FALSE scope=spfile sid='*';
System altered.
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
然后再看上面第三步,执行@/home/controlfile.sql
SQL> @/home/controlfile.sql
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2924928 bytes
Variable Size 1258294912 bytes
Database Buffers 335544320 bytes
Redo Buffers 13848576 bytes
Control file created.
Media recovery complete.
Database altered.
此时就可以成功登陆了。
参考:https://blog.csdn.net/u011478909/article/details/52027878