近期學習oracle基礎知識,練習過程中,無意刪除數據文件,引起一些錯誤如:ORA-01033。後經總結,特此記錄一下解決方法,方便查看。
Oracle不提供如刪除表、視圖一樣刪除數據文件的方法,數據文件是表空間的一部分,所以不能“移走”表空間。
正常情況下,刪除表空間的正確方法是:
drop tablespace tablespace_name including contents and datafiles;
如果沒有通過以上命令刪除而直接刪除了數據文件,會導致數據庫無法打開。
一般用戶登錄時提示:ORA-01033 : ORACLE initialization or shutdown in progress
遇到此種情況,解決方法:
ORA-故障描述:因爲移動/修改數據庫文件,導致數據庫連接出現ORA-01033錯誤。
處理步驟:
1.在‘開始’-->'運行' cmd
2.輸入:sqlplus "/as sysdba"
應該提示如下信息:
SQL*plus:Release 9.2.0.1.0-production on 星期五 10月16 22:07:45 2012
Copyright(c) 1982,2002,Oracle Corporation. All rights reserved.
連接到:
Oracle9i Enterprise Edition Release 9.2.0.1.0-Production
With the Partitioning,OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0-Production
3.輸入:shutdown immediate
應提示如下信息:
ORA-01109:數據庫未打開
已經卸載數據庫
4.輸入:startup
應該提示如下信息:
ORA-01157:無法標識/鎖定數據庫文件15-請參閱DBWR跟蹤文件
ORA-01110:數據文件15:‘D:test.dbf’
5.根據第4步信息輸入:alter database datafile 'D:test.dbf' offline drop
應該提示如下信息:
數據庫已更改。
6.重複第3、4、5步驟,直到第4步不再出現ORA-01157、ORA-01110錯誤信息,即解決問題。