Question: I've got a corrupted data file, and Oracle won't start. I don't need the data so how do I open the database and drop data file? 
==================================================================
Ans:
If you are running in Noarchivelog mode1. mount the database - startup mount
2. drop the datafile - alter database datafile xxx offline drop
3. open the database - alter database open 
4. check all objects belong to that tablespace: 
       select owner, segment_name, segment_type
       from dba_segments
       where tablespace_name='tbs_name'
5. export out all the objects in that tablespace
6. drop the tablespace - drop tablespace tbs_name including contents
7. Delete the physical datafiles belonging to the tablespace
8. Recreate the tablespace, import back the objects  
If you are running in Archivelog mode1. mount the database - startup mount 
2. drop the datafile - alter database datafile xxx offline(Note: the datafile is still part of the database and is ed only as offline in the controlfile. Just make sure you don't use the same data file name again)3. Remove the physical data file at OS level 
4. open the database - alter database open
5. At the right time, you can 
export the objects belong to this tablespace, 
drop the tablespace, 
create back the tablespace with appropriate datafiles and 
import the objects back.

解决方案 »

  1.   

    erickleung说的不错
    先用ORACLE命令逻辑删除,再用OS命令物理删除
      

  2.   

    1  alter database datafile 'dev/dev1' offline drop命令将裸设备(数据文件)offline了
    2  ALTER TABLESPACE tablespace1 OFFLINE;
     DROP TABLESPACE tablespace1 INCLUDING CONTENTS CASCADE CONSTRAINTS
    假设你的表空间为tablespace1,往两个裸设备上写数据'dev/dev1' 和'dev/dev2',删除'dev/dev1' 想上面那样可以,但要重建表空间,这个方法主要使用于某一裸设备硬盘故障下。 表空间重包含多个数据文件,不同的数据文件建在不同的裸设备上时,删除一个datafile就比较危险,因为offline后会被recovery,所以再这种情况下,offline drop只能顶一阵子。
      

  3.   

    同意BILLLLIU的说法,的确是这样!
      

  4.   

    还有什么疑问吗??顺便再说一句,oracle是在NT环境下,还是在UNIX下
      

  5.   

    多谢各位捧场,结帐&汇总
    1、export数据;
    2、删除表空间+删除数据文件(OS)
    3、重建表空间;
    4、import数据;
    5、all over!