• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Upgrading to Oracle 12c using RMAN DUPLICATE with “NOOPEN” clause and “BACKUP LOCATION”

by admin

When cloning (duplicating) a database to a higher version, traditionally (prior to 12c), you must use restore/recover of an RMAN backup. This is because the database in the destination must be opened with UPGRADE option. Therefore, the RMAN duplicate could not be used because RMAN automatically opens the auxiliary database with resetlogs. This would fail with error ‘ORA-39700: database must be opened with UPGRADE option’.

In RMAN 12c, a new option is available “NOOPEN” requesting RMAN to complete the duplicate activity but NOT open the auxiliary database. This would allow for the ‘open upgrade’ option to be manually executed when going between versions.

Steps to duplicate a database to 12c

1. Execute Preupgrade script (preupgrd.sql) at 11g database. This script will validate 11g database for upgrade and provide recommendations. This script is available in the 12c $ORACLE_HOME/rdbms/admin directory. Note, both preupgrd.sql and utluppkg.sql (called by preupgrd.sql) must be copied from 12c.

Note: This method performs duplicate using backup. The database backup should be taken after performing pre-upgrade steps of target database version. Suppose we are going to upgrade to 12.2, then database backup should be taken after performing pre-upgrade tasks of 12.2 version.

To upgrade to 12.1 the minimum required version in each release are:

Release Minimum require version
10g 10.2.0.5.0
11gR1 11.1.0.7.0
11gR2 11.2.0.2.0
12cR1 12.1.0.1.0 

To upgrade to 12.2 the minimum required version in each release are:

Release Minimum require version
11gR2 11.2.0.3 / 11.2.0.4
12c 12.1.0.1 / 12.1.0.2

2. Once Preupgrade checks are complete, take complete backup of 11g database:

RMAN> connect target / catalog [catalog_schema]/[password]@[catalog database]
RMAN> backup database format '/u01/source_backup/db_%U' plus archivelog format '/u01/source_backup/arch_%U';
RMAN> backup current controlfile format '/u01/source_backup/cf_%U'; 

This will generate a set of backupsets in /u01/source_backup directory.

3. Move these backup and pfile to 12c host. Using OS command like scp, we can copy the backup pieces to Destination server. For Example:

$ scp -p [backup-piece] user@[host]:/u01/dest_backup/

4. Create password file for 12c database. We can choose new name for 12c database using duplicate method:

$ORACLE_HOME/bin/orapwd file=orapw[sid] password=[password]

5. Edit copied pfile and make necessary changes. Set necessary values like:

db_name =   
controfile_name =
db_file_name_convert and log_file_name_convert ( if source and destination locations are different ) 

6. startup the Auxiliary instance in NOMOUNT:

Sql> connect / as sysdba
Sql> startup nomount

7. From RMAN connect this instance as AUXILIARY. For Example:

$ export ORACLE_SID=[12cdbxxx]
rman > connect auxiliary /

8. Using RMAN 12c, execute the duplicate command. In this example, ‘/u01/backup’ denotes RMAN backup location on destination. Note, “NOOPEN” option is specified.

RMAN> DUPLICATE DATABASE TO [new_DB] NOOPEN  BACKUP LOCATION '/u01/dest_backup/' ;

Once it completes exit from Rman.

Rman> exit

9. Once RMAN duplication completes, the auxiliary database remains in MOUNT mode. With sqlplus, you can open the database with UPGRADE option:

SQL> alter database open resetlogs upgrade;

Ensure the tempfiles have got created.

sql> Select * from v$tempfile ;

Also, check the files exist physically on disk.

10. Execute Manual upgrade scripts. In 12c manual upgrade can be done parallel using perl utility catctl.pl.

$ cd $ORACLE_HOME/rdbms/admin
$ ORACLE_HOME/perl/bin/perl  catctl.pl –n 4 –l /u01/upgrade/logs catupgrd.sql

Here,
n – number of parallel process to execute catupgrd.sql.
l – log location for catupgrd.sql. Based on number of process log files gets created (catupgrd.log to catupgrd0.log).

11. Execute post upgrade scripts depending on the version 12.1/12.2.

$ORACLE_HOME/perl/bin/perl  catctl.pl –n 4 –l /u01/upgrade/logs catuppst.sql

12. Check the database component status to confirm upgrade completion. Connect as SYS user to the database:

col comp_id format a10
col comp_name format a30
col version format a10
col status format a8
select substr(comp_id,1,15) comp_id,substr(comp_name,1,30) comp_name,substr(version,1,10) version,status from dba_registry;
NOTE: If you are using this method to upgrade an existing database, be aware that once the auxiliary database is created and opened, no further recovery is allowed from the source.

Filed Under: oracle, oracle 12c, RMAN

Some more articles you might also be interested in …

  1. Oracle Scheduler 12c New Features and Enhancements
  2. Connecting PDB in Oracle 12c and 19c
  3. Oracle ASM 12c – New Features with examples
  4. Understanding Oracle Database Recyclebin Features and How to Disable it
  5. Oracle – How To Check if Autoextensible Datafiles Set To Maxsize Unlimited
  6. Oracle Multitenant: How to Create CDB and PDB
  7. How to Merge Multiple Partitions in Oracle 12c
  8. Common Init.ora Parameters and Unix, Linux Kernel Parameters and Relationship Between Them
  9. How to startup an Oracle Database Instance using spfile or pfile(init.ora) parameter file
  10. Oracle ASM – How ASM Disk Resync Works

You May Also Like

Primary Sidebar

Recent Posts

  • qsub Command Examples in Linux
  • qsub: command not found
  • qrcp Command Examples in Linux
  • qmrestore Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright