通常服务器在突然断电或者频繁关机的情况下很容易造成数据库损坏,然后启动不了数据库,针对这种情况出现最多的有两种,
其一:启动的时候数据文件损坏
这种情况比较简单,
1、 首先关闭数据库
sql>shutdown immediate;
2、 其次启动数据库,
sql>startup;
此时启动数据库会报错,
data file 12: '/u01/app/oracle/oradata/csc/tmp.dbf'
3、恢复数据文件
sql>recover datafile 12;
4、重复1、2、3步骤,直到能够正常启动!
其二:数据库版本号不一致
这种情况比较复杂
1、关闭数据库
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
2、启动数据库报如下错误
SQL> startup mount
ORACLE instance started.
Total System Global Area 188743680 bytes
Fixed Size 778036 bytes
Variable Size 162275532 bytes
Database Buffers 25165824 bytes
Redo Buffers 524288 bytes
ORA-00214: controlfile '/home/oracle/oradata/csc/control01.ctl' version 9190435 inconsistent with file
'/home/oracle/oradata/csc/control02.ctl' version 9190433
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning and Data Mining options
[uniread] Saved history (2163 lines)
3、创建初始化启动文件
SQL> create pfile='/home/oracle/init.ora' from spfile;
File created.
4、编辑该文件,把低版本的控制文件去掉,保留高版本的
编辑init.ora,把'/home/oracle/oradata/csc/control02.ctl'去掉,然后再重启数据库
5、关闭数据库
SQL> shutdown immediate
6、指定启动文件
SQL> create spfile from pfile='/home/oracle/init.ora';
7、通过nomount 方式启动数据库
SQL> startup nomount
ORACLE instance started.
Total System Global Area 188743680 bytes
Fixed Size 778036 bytes
Variable Size 162275532 bytes
Database Buffers 25165824 bytes
Redo Buffers 524288 bytes
SQL> alter database mount;