Search: For:
Browsing Single Category
www.dbatoolz.com ORACLE DBA Forums Solutions › Topic Id: 1174 | Permalink

How to drop a lost TEMPFILE after failed drive

Topic ID: 1174
Created By: 2006-SEP-30 23:30:59 [Vitaliy]
Updated By: 2008-NOV-11 16:04:37 [Hank_Adp]
Status: Open
Severity: Normal
Read Only: No
4417
2006-SEP-30 23:30:59
Moderator
 
 
Registered On: Mar 2006
Total Posts: 289
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]
9646
2008-NOV-11 16:04:37
User
 
 
Registered On: Nov 2008
Total Posts: 2
You can drop and create the TEMPFILE:

ALTER DATABASE TEMPFILE  '/u04/oradata/SINAME/temp01.dbf' DROP;
-- this will not drop physical file

ALTER TABLESPACE BMC_TEMP ADD tempfile  '/u04/oradata/SINAME/temp01.dbf' SIZE 
48M REUSE;
-- this will add file; either reuse or without it.