Search: For:
Browsing Single Category

How to drop a lost TEMPFILE after failed drive

Topic ID: 1174
Created By: 2006-SEP-30 23:30:59 [Vitaliy]
Updated By: 2008-MAY-19 19:41:16 [Vitaliy]
Status: Open
Severity: Normal
Read Only: No
4417
2006-SEP-30 23:30:59
Moderator
 
 
Registered On: Mar 2006
Total Posts: 191
How to drop a lost TEMPFILE after failed drive

When a drive fails and you "lose" a tempfile the status in v$tempfile will show 
ONLINE:

   SQL> select file#,status,name from v$tempfile;
   
        FILE# STATUS  NAME
   ---------- ------- ---------------------------------------------
            1 ONLINE  /u04/oradata/SINAME/temp01.dbf
            2 ONLINE  /u02/oradata/SINAME/temp02.dbf

... but dba_temp_files will tell the "real" story:

   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 201 because it failed verification tests
   ORA-01110: data file 201: '/u04/oradata/SINAME/temp01.dbf'

to resolve this issue you can simply drop the missing tempfile without causing 
any trouble:

   SQL> alter database tempfile  '/u04/oradata/SINAME/temp01.dbf' drop;
   
   Database altered.

   SQL> select file_name,status from dba_temp_files;
   
   FILE_NAME
   ---------------------------------
   STATUS
   ---------
   /u02/oradata/SINAME/temp02.dbf
   AVAILABLE

you then simply add the file back and it gets created:

   ALTER TABLESPACE TEMP ADD TEMPFILE 
      '/u04/oradata/SINAME/temp01.dbf' SIZE 838860800  
   REUSE AUTOEXTEND OFF;
[edited by: Vitaliy at 19:41 (CST) on May. 19, 2008]