ORA-01033: ORACLE initialization or shutdown in progress

连数据库报ORA-01033错误。

错误信息:
C:\Users\TianPan>sqlplus system/welcome

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 26 16:59:10 2015

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0


Enter user-name:

尝试解决:
对于ORA-01033错误,有人说重启数据库或者recover database一下既可以解决,但此方法没有解决我的问题,不过可以看出真正的问题应该在ORA-01157上。

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.

Total System Global Area 1071333376 bytes
Fixed Size                  1375792 bytes
Variable Size             629146064 bytes
Database Buffers          436207616 bytes
Redo Buffers                4603904 bytes
SQL> alter database mount;

Database altered.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: 'E:\APP\TIANPAN\ORADATA\EMP\PART01.DBF'



SQL> recover datafile 6
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 6: 'E:\APP\TIANPAN\ORADATA\EMP\PART01.DBF'
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: 'E:\APP\TIANPAN\ORADATA\EMP\PART01.DBF'



解决方法:
可以看到问题聚焦到了ORA-01157上,先看下ORA-01157是什么错误:
ORA-01157: cannot identify/lock data file string - see DBWR trace file

Cause: The background process was either unable to find one of the data files or failed to lock it because the file was already in use.
The database will prohibit access to this file but other files will be unaffected. However the first instance to open the database will need to access all online data files. Accompanying error from the operating system describes why the file could not be identified.

Action: Have operating system make file available to database. Then either open the database or do ALTER SYSTEM CHECK DATAFILES.
这个错误应该是数据库mount后,open数据库文件时失败引起的,需要检查数据库文件的情况。这个数据库是我本地的测试库,我只需要能启动即可,参考:ora-01033:oracle initialization or shutdown in progress 解决办法 ,把数据文件置成离线状态,再尝试启动即可。

操作详细步骤:
SQL> alter database datafile 6 offline drop;

Database altered.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: 'E:\APP\TIANPAN\ORADATA\EMP\PART02.DBF'


SQL> alter database datafile 7 offline drop;

Database altered.
....
....
SQL> alter database datafile 22 offline drop;

Database altered.

SQL> alter database open;

Database altered.

SQL>
也就是不断的重复的把损坏文件置成离线状态,然后系统就能启动起来了。
SQL> alter database datafile 6 offline drop;

Database altered.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: 'E:\APP\TIANPAN\ORADATA\EMP\PART02.DBF'


SQL> alter database datafile 7 offline drop;

Database altered.
....
....
SQL> alter database datafile 22 offline drop;

Database altered.

SQL> alter database open;

Database altered.

SQL>

关于alter database datafile 'file_name' offline drop
该命令不会删除数据文件,只是将数据文件的状态更改为recover。 offline drop命令相当于把一个数据文件至于离线状态,并且需要恢复,并非删除数据文件。 数据文件的相关信息还会存在数据字典和控制文件中。 



你可能感兴趣的:(ORA-01033: ORACLE initialization or shutdown in progress)