April 06, 2012

Rename Data File Oracle

Step by step to rename the datafile into a new location

To move or rename a datafile do the following:

1. Shutdown the database. 
SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.


2. Rename the physical file on the OS
SQL> HOST MOVE C:\ORACLE\PRODUCT\10.1.0\ORADATA\DB10G\USERS01.DBF C:\ORACLE\PRODUCT\10.1.0\ORADATA\DB10G\RENAME_USERS01.DBF
or cp -R --force /u01/app/oracle/oradata/orcl/* /home/oradata

 
3. Start the database in mount mode.  
SQL> STARTUP MOUNT
ORACLE instance started.


Total System Global Area 167772160 bytes
Fixed Size 787968 bytes
Variable Size 61864448 bytes
Database Buffers 104857600 bytes
Redo Buffers 262144 bytes
Database mounted
 

4. Issue the ALTER DATABASE RENAME FILE command to rename the file within the Oracle dictionary. 
SQL> ALTER DATABASE RENAME FILE 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\DB10G\USERS01.DBF' TO 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\DB10G\RENAME_USERS01.DBF';

Database altered.

 
5. Open the database.
SQL> ALTER DATABASE OPEN;

Database altered.



Enjoy Sharing :)

No comments:

Post a Comment