环境:windows 2003,ORACLE 10.2.0.1
现象:SQL*Plus无法连接,显示以下错误: ORA-01033 : ORACLE initialization or shutdown in progress
sqlplus **
ORA-01033 :ORACLE正在初始化或者关闭
这个报错的原因多种多样,但这个错误的提示意味着数据库没正常打开
查看alert日志:
Errors in file d:/oracle/admin/lik/udump/lik_ora_3092.trc:
ORA-00600: ?????????: [2252], [2481], [3763688818], [], [], [], [], []
ORA-600 signalled during: alter database open...
ORA-600 [2252] Occurs During Alter Database Open [ID 253977.1]
Symptom(s)
~~~~~~~~~~
After shutdown of the database you receive the following error during
alter database open: ora-600 [2252]
You did not restore the database before receiving this error.
Cause
~~~~~~~
The system date is lower than the date of the shutdown.
While opening the database, Oracle compares the given SCN value
with the reasonable upper limit value calculated based on the
system date. If Oracle detects the provided scn is too large,
ORA-600[2252] would be raised.
Fix
~~~~
Set the system date equal or higher the date of the shutdown.
根据以上给出的方法,检查操作系统时间,是2011年06月20日。提前了1年。
之前由于长时间断电,导致数据库掉电关闭,今天重启数据库时无法打开
将操作系统时间改为当前时间,成功启动数据库。
解释:
当数据库系统的时间被调整,回到历史状态时,数据库可能出现ORA-600 2252错误。
这个错误指,数据库的SCN被认为是错误和不合理的,Oracle内部控制每秒产生的SCN数量小于 16K 个,然后以1988年1月1日,0点0分0秒开始,可以计算出一个SCN可能的合理最大值。
如果当前SCN的指标超过了这个合理值,则系统就会出现ORA-600 2252错误。如果确实因为调整系统时间导致,则可以将时间调整回正确日期,如果系统SCN真的非法跃迁,则可以等候一定时间,等候SCN合理值可以容纳该跃迁或不一致。
扩展:
1、(11g测试环境未发现该情况)以上结果意味着如果数据库非正常关闭的情况下,即open数据库时需要做recover的过程,不能将操作系统时间提前过大。正常关闭数据库(shutdown immediate)可以更改操作系统时间。
2、对于正在运行的10g数据库(11g测试无此现象),将操作系统时间提前1年,在第一次sqlplus / as sysdba会连不进数据库,报ORA-01075: you are currently logged on,同时alert一直报ORA-600:[2252]错误或者也有可能数据库报完2552错误后直接down。
Sat Jan 21 20:13:57 CST 2012
Errors in file /oracle/admin/trff/bdump/trff_dbw0_22851.trc:
ORA-00600: internal error code, arguments: [2252], [2990], [209412280], [], [], [], [], []
Sat Jan 21 20:13:57 CST 2012
DBW0: terminating instance due to error 471
Instance terminated by DBW0, pid = 22851
oracle的两个函数scn_to_timestamp和timestamp_to_scn
SQL> select timestamp_to_scn(sysdate) from dual;
TIMESTAMP_TO_SCN(SYSDATE)
-------------------------
3289230
SQL> select to_char(scn_to_timestamp(3289211),'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SCN_TO_TIMESTAMP(3289211),'YYY
--------------------------------------
2012-02-29 04:06:14
附上修改session显示格式的语句
alter session set nls_date_format ='yyyy-mm-dd hh24:mi:ss';
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24005010/viewspace-733532/,如需转载,请注明出处,否则将追究法律责任。