Moving ORADATADirectory to another location in Oracle DataBase

Moving ORADATADirectory to another location in Oracle DataBase

Database files are stored in ORACLE_BASE\oradata\DB_NAME\ If you want to move the oradata directory to another location or directory then the minimum required steps are as follow

Step 1:


Creation of tracecopy of the Control file

SQL>ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

The Default location of tracecopy is USER DUMP destination. If you want to find the USER DUMP Destination then use
the following statement

SQL> SHOW PARAMETER USER_DUMP_DEST;

Step 2:

SQL>CREATE PFILE FROM SPFILE;

Step 3:

SQL>SHUTDOWN IMMEDIATE;

Step 4:

Move the ORADATA directory to another location or to the new drive.

Step 5:

SQL>SHUTDOWN IMMEDIATE;

Step 6:

Find the pfile (Default name is initSID.ora).Open the pfile and change the value of CONTROL_FILE parameter to the new location of oradata directory.

Step 7:

SQL>CREATE SPFILE FROM PFILE;

Step 8:

SQL>sqlplus / as sysdba SQL>stratupnomount;

Step 9:

Edit the trace copy of control file created in Step 1 and change the location of data files and Redo log files. Use this script in mount state to create new control file


CREATE CONTROLFILE REUSE DATABASE "SID_NAME" RESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u02/oradata/SID_NAME/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u02/oradata/SID_NAME/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u02/oradata/SID_NAME/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u02/oradata/SID_NAME/system01.dbf',
'/u02/oradata/SID_NAME/sysaux01.dbf',
'/u02/oradata/SID_NAME/undotbs01.dbf',
'/u02/oradata/SID_NAME/users01.dbf',
'/u02/oradata/SID_NAME/example01.dbf',
CHARACTER SET WE8MSWIN1252
;

Step 10:

Open the Database
SQL>ALTER DATABASE OPEN;

0 comments:

Post a Comment