Move Oracle Datafiles

HashFlare

Move Oracle Datafiles

 

Move Oracle Datafiles in NOARCHIVE MODE

Stop the database:

SQL> shutdown immediate;

Copy the datafile to the new directory or disk:

$  cp /u01/data/datafile.dbf /u02/data/datafilenew.dbf

Mount database

SQL> startup mount;

Rename the datafile:

SQL> ALTER DATABASE RENAME FILE ‘/u01/data/datafile.dbf’ TO ‘/u02/data/datafilenew.dbf’;

Open the database:

SQL> ALTER DATABASE OPEN;

 

Move Oracle Datafiles in ARCHIVE MODE

Set the datafile offline:

SQL> ALTER DATABASE DATAFILE ‘/u01/data/datafile.dbf’ OFFLINE;

Copy the datafile to another directory or disk:

$ cp /u01/data/datafile.dbf /u02/data/datafilenew.dbf

Connect to the database and rename the datafile:

SQL> ALTER DATABASE RENAME FILE ‘/u01/data/datafile.dbf’ TO ‘/u02/data/datafilenew.dbf’;

Recover the datafile:

SQL> RECOVER DATAFILE ‘/u02/data/datafilenew.dbf’;

Set the datafile online :

SQL> ALTER DATABASE DATAFILE ‘/u02/data/datafilenew.dbf’ ONLINE;

 

Back to previous menu