oracle斷電重啟之ORA-01033和ORA-01172

xwdreamer發表於2014-06-09

參考文獻:

ORA-01033:解決方法

資料庫掉電後 ORA-01172 磁碟壞塊解決方法

 

--嘗試連線資料庫prjdb
C:\Documents and Settings\Administrator>sqlplus test/test@prjdb
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 9 17:23:08 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.

--報錯ORA01033
ERROR:
ORA-01033: ORACLE ????????
Process ID: 0
Session ID: 0 Serial number: 0

--查詢ORA-01033的根源是什麼,使用管理員身份登陸
C:\Documents and Settings\Administrator>SQLPLUS SYS/SYS AS SYSDBA
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 9 17:25:31 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

--關閉資料庫例項
SQL> SHUTDOWN
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

--嘗試啟動資料庫,如果啟動失敗會報錯,這樣就能夠找到問題根源。
SQL> STARTUP
ORACLE instance started.

Total System Global Area  778387456 bytes
Fixed Size                  1374808 bytes
Variable Size             469763496 bytes
Database Buffers          301989888 bytes
Redo Buffers                5259264 bytes
Database mounted.
--問題根源是ORA-01172和ORA-01151
ORA-01172: recovery of thread 1 stuck at block 651 of file 90
ORA-01151: use media recovery to recover block, restore backup if needed

--檢視file 90到底是哪一個檔案,此步驟非必需
SQL> select file#,name from v$datafile where file#=90;
     FILE#     NAME
     90        D:\ORACLE\ORADATA\PRJDB\TS_HIS18.DBF
     
--恢復file 90
SQL> recover datafile 90;
Media recovery complete.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Pr
oduction
With the Partitioning, OLAP, Data Mining and Real Application Testing options

--再次嘗試連線prjdb
C:\Documents and Settings\Administrator>sqlplus test/test@prjdb
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 9 17:46:33 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.

--依然失敗
ERROR:
ORA-01033: ORACLE ????????
Process ID: 0
Session ID: 0 Serial number: 0

--重複前面的操作
C:\Documents and Settings\Administrator>SQLPLUS SYS/SYS AS SYSDBA
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 9 17:46:46 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED

SQL> alter database open;
alter database open
*
ERROR at line 1:
--發現還有一個file 7也是有問題的
ORA-01172: recovery of thread 1 stuck at block 89361 of file 7
ORA-01151: use media recovery to recover block, restore backup if needed

--恢復file 7
SQL> recover datafile 7;
Media recovery complete.

--再次啟動資料庫
SQL> alter database open;

--資料庫啟動成功
Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Pr
oduction
With the Partitioning, OLAP, Data Mining and Real Application Testing options

--再次嘗試連線
C:\Documents and Settings\Administrator>sqlplus test/test@prjdb
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 9 17:48:33 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> 
--連線成功。

 

 

 

 

相關文章