Monday, June 3, 2013

How to drop a lost TEMPFILE

If you lost your tempfile due to drive fails or un-proper cloning:

SQL> select file#,status,name from v$tempfile;

     FILE# STATUS NAME    
--------------------------------------------------------
     1 ONLINE  E:\TEMP02.DBF
     2 ONLINE  E:\TEMP00

but when it comes to the dba_temp_files

SQL> select file_name,status from dba_temp_files;
select file_name,status from dba_temp_files
                             *
ERROR at line 1:
ORA-01187: cannot read from file  because it failed verification tests
ORA-01110: data file 201: 'E:\TEMP02.DBF'

Simply drope TEMP02.DBF as follow:

SQL> alter database tempfile  'E:\TEMP02.DBF' drop;

Database altered.

SQL> select file_name,status from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
STATUS
-------
E:\TEMP00
ONLINE


Problem Solved !!!

No comments:

Post a Comment