某個數據文件損壞,如何打開資料庫? (for Linux)
PuJiang Science Park Of ShangHai 、 jccz_zys_zhouys
最近做開發時不小心刪除了創建的資料庫表空間文件,導致伺服器重新啟動時普通用戶
不能夠正常登陸.網上有一篇此類文章是針對winnt和oracle8i的.我通過簡單的嘗試即解決了此問題,過程如下:
系統環境:
1、操作系統:RedHat Advanced Server,機器內存512M
2、資料庫: Oracle 9i Release 9.2.0.1.0 for linux
3、安裝路徑:/home/oracle/ora
錯誤現象:
因誤操作,資料庫中某一數據文件被誤刪,
Oracle相關服務顯示已啟動,用SQL*Plus可以連接sys DBA用戶,但普通用戶無法連接,
顯示以下錯誤
ORA-01033: ORACLE initialization or shutdown in progress
模擬現象:
create tablespace tablespace_ecms
datafile '/home/oracle/ora/products/9.2.0/oradata/ora9i/tablespace_ecms.dbf'
size 512M extent management local autoallocate
--default storage (initial 128k next 2M pctincrease 0)
online;
shutdown
在操作系統中刪除tablespace_ecms.dbf文件
[oracle@js-oracle oracle]$ sudo - oracle -c "dbstart" >> /var/log/oracle
[oracle@js-oracle oracle]$ sudo - oracle -c "lsnrctl start" >> /var/log/oracle
在客戶端PL/SQL工具中正常連接sys DBA用戶,但資料庫沒有打開,同時普通用戶無法連接,
顯示以下錯誤
ORA-01033: ORACLE initialization or shutdown in progress
解決方法:
先讓該數據文件離線,就可以打開資料庫
--NOARCHIVELOG模式命令
[oracle@js-oracle oracle]$ sqlplus /NOLOG
SQL> connect sys/wellhope as sysdba
SQL> alter database datafile '/home/oracle/ora/products/9.2.0/oradata/ora9i/tablespace_ecms.dbf' offline drop;
SQL> alter database open; --則資料庫正常打開
SQL> select file#,name,status from v$datafile;
SQL> drop tablespace tablespace_ecms INCLUDing contents;
表空間已丟棄.
如有不足,請指正.
jccz_zys@163.net