Upgrading A Database Using Recovery Manager (RMAN) Duplicate Command In Oracle 12c

Comments 2

Share to social media

Introduction

For versions of Oracle 11g R2, Oracle Recovery Manager (RMAN) replicates a database to a different Oracle home and opens it with NORESET LOGS option. From Oracle 12cR1, database RMAN introduced an option called ‘NO OPEN’, which duplicates your database to a new location and keeps it in an unopened state. Using this feature we can duplicate a database to more recent target database version, allowing us to update our existing database to the most recent version.

RMAN duplicate command using backup:

Duplicate process can make use of an existing source database backup. All backup pieces should be kept in the same location and the location should be same for both source and destination.

Configuring the source server:

  • Switch the source database to archive log mode if it is not already:

In the mount state change the LOG mode of the database:

Execute the pre-upgrade script at source database server and make necessary changes for upgrade. Pre-upgrade script (Preupgrd.sql, utluppkg.sql) is located at: <Target Database server home>/rdbms/admin

  • Copy the file(s) to source Oracle home and execute it as ‘SYS’ user. This will validate the source database and provide recommendations for performing the upgrade process. This is a mandatory step for the upgrade process.
  • Take a full backup of the source database including archive logs. A RMAN full database backup has to be taken. Your database can be either in the OPEN or MOUNT state. Use following commands:

This will generate a backup set.

  • Create pfile from spfile:

Move your database backup and the backup of pfile to the target database server.

Configuring the Target Database Server

  • Create a password file for the database service
    • Orapwd file=<12c password file> password=<password for sys user>
  • Make the necessary changes to initialization file at target database server.

Change the compatible parameter value if it is recommended by pre-upgrade script.

  • Start the database in nomount state:

  • Ensure that you keep the backup pieces at same location as the source database server. This is required as catalog has recorded the backup location.
  • Execute the duplicate database command with the “No Open” option using backup location:

  • Start the database in upgrade mode with the reset logs option

  • Execute catupgrade script using catctl.pl script:

  • Check the database component status:

  • Make an entry in the listener file for database service.
  • Create tnsnames.ora entry for the newly-created database service.
  • Restart the listener.

Scenario: Upgrading an Oracle 10g database to an Oracle 12c database using the RMAN Duplicate method. The versions of source database and target database :

  1. Source database: DB10g (10.2.0.5.0)
  2. Target database: DB12c (12.1.0.1.0)

The Steps:

  1. Switch the source database from No Archive Log Mode to Archive Log Mode if it is not already that way:

  • Check the LOG Mode from v$database view

  • Check the LOG Mode after converting from v$database view

  1. Execute the pre-upgrade script at the source database server, review the output and make necessary changes for the upgrade.

Results of the checks are located at:

Pre-Upgrade Fixup Script (run in source database environment):

Post-Upgrade Fixup Script (run shortly after upgrade):

The following are Error level conditions that must be addressed prior to attempting your upgrade. Failure to do so will result in a failed upgrade:

  • Check Tag 1: COMPATIBLE_PARAMETER

You must resolve the above error prior to upgrade.

The Minimum Compatible parameter value for Oracle 12c database is 11.1.0.0.0. This needs to be modified in the parameter file. Check /u01/app/oracle/cfgtoollogs/DB10g/preupgrade/preupgrade.log for recommended changes to the database for performing the upgrade.

  1. Take full backup of the 10g database including archive logs:

  1. Created pfile from spfile:

  1. Move the Oracle 10g database backup and pfile to target database server.

Create a password file for database service. The database name can be different from the source database server.

  1. Make the necessary changes to the initialization file at target database server. Change the compatible parameter value if it is recommended by the Pre-upgrade script. For Oracle 12c, the minimum required compatible parameter value is 11.1.0.0.0.

  1. Start the database in NOMOUNT state using pfile.

  1. Specify the backup piece location while executing the Duplicate command, since this location is not cataloged in the database. Execute the duplicate database command with the “NOOPEN” option.

  1. Step-9: Start the database in upgrade mode with reset logs option

  1. Step-10: Execute the catupgrade script using catctl.pl script:

  1. The database upgrade will be executed in parallel using the Perl script “catctl.pl”. This is a new piece of functionality introduced in 12c. The database upgrade will be executed in phases. In case any particular phase fails, we can re-execute the upgrade from that particular phase using the command:

Once the upgrade completes successfully, check the database component status through dba_registry view.

Summary

This feature is possible only when Duplicate command performed with backup, it is not possible with the Active duplication option. It is an alternative for the RMAN backup restore and recovery method.

About the author

Ravi Kumar's contributions
Ravi Kumar's latest contributions: