únor 03, 2006

quick oracle tip - how to move tablespaces

here it is a quick tip "how to move oracle tablespace datafile from one file to another". i've spent a while searching for this, so maybe someone will find this useful too. i needed to free up some space on my laptop disk drive by moving huge oracle data files (*.ora) to an external disk. (also thanks to dlabik for consultation).

ALTER TABLESPACE DATA02 OFFLINE;

ALTER TABLESPACE DATA02
RENAME DATAFILE 'D:\oracle\oradata\mboruvka\DATA021.ORA' TO 'G:\oracle\oradata\mboruvka\DATA021.ORA';

ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
ALTER TABLESPACE DATA02 ONLINE;

note: with this procedure it is not necessary to shutdown db.

3 comments:

  1. You're getting better :-)

    Just wondering - why do you need the recovery step??? It shouldn't be necessary at all. At the same time you're missing the last step - backup a controlfile ;-)

    OdpovědětVymazat
  2. I see, the backup control file is there but it should be at the end of the procedure.
    It whould reflect the offline status of the file beeing moved otherwise...

    OdpovědětVymazat