##### Move tempfile from location ‘/u01/data/temp01.dbf’ to ‘/u03/data/temp01.dbf’ #####
SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE# FILE_NAME STATUS
-----------------------------------------------
1 /u01/data/temp01.dbf ONLINE
2 /u02/data/temp02.dbf ONLINE
SQL> ALTER DATABASE TEMPFILE '/u01/data/temp01.dbf' OFFLINE;
Database altered.
SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE# FILE_NAME STATUS
----------------------------------------------------
1 /u01/data/temp01.dbf OFFLINE
2 /u02/data/temp02.dbf ONLINE
#Copy the old temp files to other location(/u03):
SQL> !cp -p /u01/data/temp01.dbf /u03/data/temp01.dbf;
SQL> ALTER DATABASE RENAME FILE '/u01/data/temp01.dbf' TO '/u03/data/temp01.dbf';
Database altered.
SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE# FILE_NAME STATUS
--------------------------------------------------------
1 /u03/data/temp01.dbf OFFLINE
2 /u02/data/temp02.dbf ONLINE
SQL> ALTER DATABASE TEMPFILE '/u03/data/temp01.dbf' ONLINE;
Database altered.
SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE# FILE_NAME STATUS
---------------------------------------------------------
1 /u03/data/temp01.dbf ONLINE
2 /u02/data/temp02.dbf ONLINE
#Remove the old temp file
SQL> !rm -rf /u01/data/temp01.dbf
SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE# FILE_NAME STATUS
-----------------------------------------------
1 /u01/data/temp01.dbf ONLINE
2 /u02/data/temp02.dbf ONLINE
SQL> ALTER DATABASE TEMPFILE '/u01/data/temp01.dbf' OFFLINE;
Database altered.
SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE# FILE_NAME STATUS
----------------------------------------------------
1 /u01/data/temp01.dbf OFFLINE
2 /u02/data/temp02.dbf ONLINE
#Copy the old temp files to other location(/u03):
SQL> !cp -p /u01/data/temp01.dbf /u03/data/temp01.dbf;
SQL> ALTER DATABASE RENAME FILE '/u01/data/temp01.dbf' TO '/u03/data/temp01.dbf';
Database altered.
SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE# FILE_NAME STATUS
--------------------------------------------------------
1 /u03/data/temp01.dbf OFFLINE
2 /u02/data/temp02.dbf ONLINE
SQL> ALTER DATABASE TEMPFILE '/u03/data/temp01.dbf' ONLINE;
Database altered.
SQL> SELECT v.file#, t.file_name, v.status from dba_temp_files t, v$tempfile v WHERE t.file_id = v.file#;
FILE# FILE_NAME STATUS
---------------------------------------------------------
1 /u03/data/temp01.dbf ONLINE
2 /u02/data/temp02.dbf ONLINE
#Remove the old temp file
SQL> !rm -rf /u01/data/temp01.dbf