RENAME TEMPFILE ORACLE 10G
If the file is the default temporary tablespace then you need perform the below from step 1,
Else if you want to move a datafile of a normal temporary tablespace then perform the below from step 2.
1]. First of all you have to create another default temporary tablespace.
2]. Take the tablespace in offline position
3]. Use os command to move or copy the files.
4]. Then perform:
SQL> alter database rename file '\' to '\';
5]. Bring the tablespace online.
EXAMPLE:
STEP 1:
------
SQL> alter database default temporary tablespace pr_temp;
Database altered.
SQL> select PROPERTY_NAME,PROPERTY_VALUE from database_properties
where PROPERTY_NAME like '%DEFAULT%';
PROPERTY_NAME PROPERTY_VALUE
------------------------------ -----------------
DEFAULT_TEMP_TABLESPACE PR_TEMP
STEP 2:
-----
SQL> alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\ ORADATA\TEMP1.DBF' offline;
Database altered.
STEP 3:
------
SQL> select file_name from dba_temp_files where tablespace_name='TEMP';
FILE_NAME
------------------------------ -------------------
D:\ORACLE\PRODUCT\10.2.0\ ORADATA\TEST\TEMP01.DBF
+++ Use os command to move or copy the files.
STEP 4:
------
SQL> alter database rename file 'D:\ORACLE\PRODUCT\10.2.0\ ORADATA\TEST\TEMP01.dbf'
to 'D:\ORACLE\PRODUCT\10.2.0\ ORADATA\TEMP1.dbf';
Database altered.
Now we can check if the file is move and renamed as below,
SQL> select file_name from dba_temp_files where tablespace_name='TEMP';
FILE_NAME
------------------------------ ------------
D:\ORACLE\PRODUCT\10.2.0\ ORADATA\TEMP1.DBF
STEP 5:
------
SQL> alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\ ORADATA\TEMP1.DBF' online;
Database altered.
If the file is the default temporary tablespace then you need perform the below from step 1,
Else if you want to move a datafile of a normal temporary tablespace then perform the below from step 2.
1]. First of all you have to create another default temporary tablespace.
2]. Take the tablespace in offline position
3]. Use os command to move or copy the files.
4]. Then perform:
SQL> alter database rename file '\' to '\';
5]. Bring the tablespace online.
EXAMPLE:
STEP 1:
------
SQL> alter database default temporary tablespace pr_temp;
Database altered.
SQL> select PROPERTY_NAME,PROPERTY_VALUE from database_properties
where PROPERTY_NAME like '%DEFAULT%';
PROPERTY_NAME PROPERTY_VALUE
------------------------------
DEFAULT_TEMP_TABLESPACE PR_TEMP
STEP 2:
-----
SQL> alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\
Database altered.
STEP 3:
------
SQL> select file_name from dba_temp_files where tablespace_name='TEMP';
FILE_NAME
------------------------------
D:\ORACLE\PRODUCT\10.2.0\
+++ Use os command to move or copy the files.
STEP 4:
------
SQL> alter database rename file 'D:\ORACLE\PRODUCT\10.2.0\
to 'D:\ORACLE\PRODUCT\10.2.0\
Database altered.
Now we can check if the file is move and renamed as below,
SQL> select file_name from dba_temp_files where tablespace_name='TEMP';
FILE_NAME
------------------------------
D:\ORACLE\PRODUCT\10.2.0\
STEP 5:
------
SQL> alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\
Database altered.
No comments:
Post a Comment