Steps to relocate database files using RMAN in Oracle

Relocate database files using RMAN

In this example we will see how to relocate database files using RMAN from one location to another.In this blog we will see , how to relocate the entire database.

Existing Location /wysheid/mydb
Target  location  /data/mydb
  • Startup the database in mount stage
SQL> Shutdown immediate;
SQL> Startup Mount;
  • Make a copy of the database using RMAN
RMAN> BACKUP AS COPY DB_FILE_NAME_CONVERT ('/wysheid/mydb','/data/mydb/') database;
  • Switch to the datafile copy
RMAN> switch database  to copy;
  • Relocate the online redologs

Use  v$logfile data dictionary view  to see  the redo log file names.

  1. use the  OS commands to copy the online redologs to the target location as in the below example
    $ /wysheid/mydb/redo1.log /data/mydb/redo1.log
  2. Rename  the redolog files. Do this for each redo log files
SQL> alter database rename file '/wysheid/mydb/redo01.log' to '/data/mydb/redo01.log';
  • Relocate  the controlfiles
  1.  SQL> Shutdown immediate
  2. Copy the controlfile to the new location using OS command
  3. Update the parameter file
SQL> startup nomount;
SQL> show parameter control
SQL> alter system set control_files='/data/mydb/control01.ctl'scope=spfile;
  • Start the database
SQL> alter database mount;
RMAN> recover database;
RMAN> alter database open;
  • Recreate temporary tablespace
SQL> alter database drop temporary tablespace temp;
SQL> create temporary tablespace temp datafile '/data/mydb/temp01.dbf' size 1000m;

Leave a comment

Your email address will not be published. Required fields are marked *