Monday, May 16, 2011

How to move a Oracle Datafile to another partition

1) Query and write down the current location of the datafiles from the V$DATAFILE view: SELECT name FROM v$datafile;

2) Connect to SQL Plus as sysdba

3) Run the following commands from SQL Plus:

* SHUTDOWN IMMEDIATE

* HOST MOVE <<original location file>> <<new location file>>

* STARTUP MOUNT

* ALTER DATABASE RENAME FILE <<original file location obtained from step 1>> - (press enter after the dash)
> TO <<new file location>>; (the semicolon is important)


* ALTER DATABASE OPEN;
4) Repeat the initial query so you can verify that the the datafile has been renamed in the data dictionary


Note: file locations must be between apostrophes '...............'

1 comment: