Oracle某个数据文件损坏,如何打开数据库

某个数据文件损坏,如何打开数据库?

  • 系统环境:
    1、操作系统:Windows 2000 Server,机器内存128M
    2、数据库: Oracle 8i R2 (8.1.6) for NT 企业版
    3、安装路径:C:\ORACLE

  • 错误现象:
    因误操作,数据库中某一数据文件被误删,
    控制面板的Oracle相关服务显示已启动,但用SQL*Plus无法连接,
    显示以下错误
    ORA-01033: ORACLE initialization or shutdown in progress

  • 模拟现象:

    create tablespace test datafile  
    'c:\test.ora' size 5M  
    AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED  
    default storage (initial 128K next 1M pctincrease 0)  
    /  
    
    关闭所有服务stop.bat  
    
    net stop "OracleWebAssistant0"  
    net stop "OracleOraHome81TNSListener"  
    net stop "OracleServiceORADB"  
    
    shutdown  
    
    在操作系统中删除test.ora文件  
    
    重新启动服务start.bat  
    
    net start "OracleWebAssistant0"  
    net start "OracleOraHome81TNSListener"  
    net start "OracleServiceORADB"  
    
    服务里OracleServiceORADB显示已启动,但用SQL*Plus无法连接,  
    显示ORA-01033: ORACLE initialization or shutdown in progress  
    
    
    解决方法:  
    
    先让该数据文件脱机,就可以打开数据库  
    C:\>svrmgrl  
    svrmgrl>connect internal  
    svrmgrl>shutdown  
    svrmgrl>startup mount  
    
    --ARCHIVELOG模式命令,文件名要大写  
    svrmgrl>alter database datafile 'C:\TEST.ORA' offline;  
    
    --NOARCHIVELOG模式命令  
    svrmgrl>alter database datafile 'C:\TEST.ORA' offline drop;  
    
    svrmgrl>alter database open;  
    
    
    --查询数据文件联、脱机状态  
    SQL> select file#,name,status from v$datafile;  
    
    SQL> drop tablespace test;  
    
    表空间已丢弃。
Published At
Categories with 数据库类
Tagged with
comments powered by Disqus