Wednesday, May 16, 2012

Move Oracle XE oradata

I copied it from OTN discussion forum Florian W.

1.) Clear the folder that contains your user dump destination. Use show parameter get this folder.
 

show parameter user_dump_dest

2.) Create a tracecopy of your controlfile.
ALTER DATABASE
BACKUP CONTROLFILE TO TRACE;

You will find this tracefile in your user dump destination.
3.) Shutdown your database
shutdown immediate

4.) Move the oradatafolder to the new drive.
5.) Login to sqlplus and create a PFILE.
sqlplus / as sysdba
 
CREATE PFILE='/usr/lib/oracle/xe/initXE.ora'
FROM SPFILE;
exit

You will find the file initXE.ora in the folder /usr/lib/oracle/xe.
6.) Change the parameter CONTROL_FILES in initXE.ora so that it complies with the new location of your controlfiles. That's the new location of the oradata folder.
7.) Create a SPFILE from your PFILE
sqlplus / as sysdba
 
CREATE SPFILE
FROM PFILE='/usr/lib/oracle/xe/initXE.ora';

8.) Start your database in nomount mode.
sqlplus / as sysdba
 
startup nomount

9.) Change locations of the Redo Log and Datafiles in the tracecopy of your controlfile created in step 2. Do this with the first create controlfile statement (NORESETLOGS).
10.) Use the first CREATE CONTROLFILE statement (NORESETLOGS) in the tracecopy of your controlfile that you've changed in step number 9 to create a new controlfile that knows about the new locations of your oradata folder. If Oracle tells you that everything is OK then you have won otherwise there will be a lot of work to do to get your DB running again.

Please be very careful. This is a very tricky thing you want to do.

1 comment:

  1. thanks sharing such wonderful list found it very helpful and informative keep it up, see peoplesoft connections about the management and tech info.

    ReplyDelete