cancel
Showing results for 
Search instead for 
Did you mean: 

moving oracle database

Jade Bulante
Frequent Advisor

moving oracle database

I created an Oracle database but it defaulted to the /u01/oracle/oradata directory. I would like to move it under a different directory
/u02/oradata. Is there an easy way to do it without having to reinstall??

Need help.
4 REPLIES
Shannon Petry
Honored Contributor

Re: moving oracle database

There are alot of possibilities with this question! Please be more specific on the install If I can not cover it here...

1. I'll assume you used standard UNIX file system, and not raw lvm as oracle would recommend. If this is the case, you may be able to....

2. If you did use a raw lv, then you will have to dump the database (cold backup) and then recover from the cold backup afterwards...

3. If your not too worried about performance, you can simply move the old stuff, and link it to the current location.
I.E (home dirs)
mv /home /nfsdata1/home
ln -s /nfsdata1/home /home

Since I have never done this, I can not tell you what to expect from performance.

4. Move the data, and hand modify all of the references in the oracle configs to the new location...This could be a nightmare...

For all intents and purposes, the best bet is to dump the database, and then install oracle clean..then import the database. Trying to shortcut this may leave you crippled on a system which is built to perform!

Regards,
Shannon
Microsoft. When do you want a virus today?
Laurent Paumier
Trusted Contributor

Re: moving oracle database

From what I remember (I'm not moving databases that often...), you'll have to :
- shutdown the instance,
- move control files to new location,
- edit init.ora file to reflect the change,
- copy datafiles to new location,
- startup mount the instance,
- enter commands "alter tablespace xxx rename datafile yyy to zzz" command for each datafile,
- purge old datafiles.

Check the exact syntax in your oracle manual.
Steve Slade
Frequent Advisor

Re: moving oracle database

For moving the database - as per Laurent's reply.

though, I tend to bring up the database in mount then check the views
v$datafile - name field for tablespaces
v$logfile - member field for redo logfiles

use the syntax :
alter database rename file 'old file' to 'new file';

for all of the above
and then startup mount. (You could use spool to create script if there are a large number of files.)

Afterwards its a good idea to backup your control file to trace to ensure that you cope with any problems in their new layout. (alter database backup control file to trace; look in background dump location for trace file)
If at first you do not succeed. Destroy all evidence that you even attempted.
Steve Slade
Frequent Advisor

Re: moving oracle database

oops still asleep. After renaming all the files, open the database (alter database open), not startup mount

Doh!!!
If at first you do not succeed. Destroy all evidence that you even attempted.