Thursday, October 30, 2014

Migrate and upgrade oracle database using RMAN backupset

You can use various methods to perform database move and upgrade depending on the size of database and other constraints. If there are downtime constraints then you may probably like to consider Dataguard Rolling upgrade methods where physical standby can be created in advance and database can be upgraded using transient logical standby method. I have explained same here in my blog:
http://azharkoracle.blogspot.com/2014/08/dataguard-rolling-upgrade-using.html

For very large databases, you may also consider using Business Continuity Volumes (snapshot backups) or split mirror techniques for one time instantiation and then configure golden gate or oracle streams for replication. Refer my blog for configuring oracle streams replication:
http://azharkoracle.blogspot.com/2014/09/configuring-oracle-streams-replication.html

One other method for move and upgrade which DBA mostly considers for medium sized databases is cold backup and then upgrade the database on destination server after starting the same in upgrade mode. This time I have tried using RMAN backupsets rather than relying on cold backup for performing move and upgrade which worked absolutely fine. I moved RMAN backups sets of 11.2.0.1 for database TSTU and cloned it to TST_CFG database in 11.2.0.3 version.

Here are the high level steps for upgrade and cloning the database from one oracle version to another –
1.)    Move the backup pieces of source database to desired location (/oracle/data/ora01/TST_CFG/exports) on destination server.
2.)    Create instance with same name as that of source name (TSTU in our case) and start it in nomount mode.
3.)    Restore the control file from the backup piece. Provide exact location of backup piece where control file is lying for restoring same.
4.)    Mount the database.
5.)    Rename the redo files using alter database rename file commands.
E.g. alter database rename file '/oracle/data/ora01/TSTU/ora_log_01_01.rdo' to '/oracle/data/redo01/TST_CFG/ora_log_01_01.rdo';
6.)    Catalog the backup pieces using catalog start with <backup_location>.
7.)    Restore and recover it after setting the filename to new location –
run {
  allocate channel t1  type  disk;
  allocate channel t2  type  disk;
set newname for tempfile 1 to '/oracle/data/ora02/TST_CFG/temp_t01_01.dbf';
set newname for tempfile 2 to '/oracle/data/ora02/TST_CFG/temporary_data_t01_01.dbf';
set newname for datafile 1 to '/oracle/data/ora02/TST_CFG/system_01.dbf';
set newname for datafile 2 to '/oracle/data/ora02/TST_CFG/sysaux_01.dbf';
set newname for datafile 3 to '/oracle/data/ora02/TST_CFG/undo_t01_01.dbf';
set newname for datafile 4 to '/oracle/data/ora02/TST_CFG/tools_t01_01.dbf';
set newname for datafile 5 to '/oracle/data/ora02/TST_CFG/users_t01_01.dbf';
set newname for datafile 6 to '/oracle/data/ora02/TST_CFG/USER_DATA_01.dbf';
set newname for datafile 7 to '/oracle/data/ora02/TST_CFG/USER_DATA_02.dbf';
set newname for datafile 8 to '/oracle/data/ora02/TST_CFG/INDEX_DATA_01.dbf';
set newname for datafile 9 to '/oracle/data/ora02/TST_CFG/USER_DATA_03.dbf';
set newname for datafile 10 to '/oracle/data/ora02/TST_CFG/lob_data_t01_01.dbf';
restore database;
switch datafile all;
recover database;
release channel t1;
release channel t2;
}
8.)Open the database using reset log upgrade mode. Rename and Recreate tempfiles if not accessible.
9.) Run catupgrd.sql
10.) Run utlu112s.sql
11.) Run catuppst.sql
12.) Shut down the database and change database name using DBNID utility. Follow post steps and voila, you have just finished cloning from RMAN baseline backup of 11.2.0.3 database (TSTU) to 11.2.0.4  database (TST_CFG).

No comments:

Post a Comment