In this article, we are going to learn how to upgrade 12c to 19c using rman.
Read: Upgrade Oracle 11g to 19c Database
Table of Contents
Action on 12c Database
Follow all the below steps carefully on Oracle 12c to upgrade oracle database from 12c to 19c using RMAN backup.
Step 1: Check Database registry
Before start the upgradation activity, lets check database registry status using the below command. In our case all parameter is in Valid state.
SQL> set lines 400 pages 400
SQL> col comp_name for a60
SQL> select comp_name, status from dba_registry;
COMP_NAME STATUS
------------------------------------------------------------ --------------------------------------------
Oracle Database Catalog Views VALID
Oracle Database Packages and Types VALID
JServer JAVA Virtual Machine VALID
Oracle XDK VALID
Oracle Database Java Packages VALID
OLAP Analytic Workspace VALID
Oracle Real Application Clusters OPTION OFF
Oracle XML Database VALID
Oracle Workspace Manager VALID
Oracle Text VALID
Oracle Multimedia VALID
Spatial VALID
Oracle OLAP API VALID
Oracle Label Security VALID
Oracle Database Vault VALID
Step 2: Create Database Backup
At this point, we are going to take full database backup plus archive log and current controlfile backup using RMAN.
$ rman target /
RMAN> run
{
allocate channel c1 device type disk;
crosscheck backup;
crosscheck archivelog all;
backup as compressed backupset database format '/u01/RMAN_BKP/Fullback_%T_%U'
plus archivelog format '/u01/RMAN_BKP/Archive_%T_%U';
backup current controlfile format '/u01/RMAN_BKP/Controlback_%T_%U';
release channel c1;
}
.........
released channel: c1
Recovery Manager complete.
Step 3: Create pfile from spfile
Create pfile from spfile for 19c database.
$sqlplus / as sysdba
SQL> create pfile='/u01/initRIDER.in' from spfile;
File Created.
Step 4: Modify compatible parameter
Update pfile and change the compatible parameter from 12c to 19c.
$vi /u01/initRIDER.in
Replace *.compatible='12.2.0.1.0' to *.compatible='19.3.0.0.0'
Step 5: Copy Backup
Copy all backups with pfile from the source database (12c) to the target database (19c).
$cd /u01/RMAN_BKP/
$scp * oracle@192.168.1.20:/u02/rman_bkp/
Action on 19c Database | upgrade 12c to 19c using rman
After completing all the above steps, now we are going to perform upgrade steps on the oracle 19c machine.
Step 1: Create Required Directories
Create required directories as per pfile on 19c machine.
$ mkdir -p /u01/app/oracle/admin/RIDER/adump
$ mkdir -p /u01/app/oracle/oradata/RIDER
$ mkdir -p /u01/app/oracle/fast_recovery_area/RIDER
$ mkdir -p /u01/archive
Step 2: Start Database at Nomount
Start database at nomount stage using pfile.
SQL> startup nomount pfile='/u02/rman_bkp/initRIDER.ora';
Step 3: Restore Controlfile
After nomount now restore the controlfile from backup.
$ rman target /
RMAN> restore controlfile from '/u02/rman_bkp/Control_filebkp_02013_1';
Once the controlfile is restored, start the database at the mount stage.
RMAN> alter database mount;
Step 4: Rename Redo log files
Rename redo log files if the directory structure is not the same.
SQL> select member from v$logfile;
MEMBER
-----------------------------------------
/u01/app/oracle/oradata/RIDER/redo03.log
/u01/app/oracle/oradata/RIDER/redo02.log
/u01/app/oracle/oradata/RIDER/redo01.log
Use the below commands to rename the redo files, in my case the location is the same.
SQL> alter database rename file '/u01/app/oracle/oradata/RIDER/redo01.log' to '/u01/app/oracle/oradata/RIDER/redo01.log';
Statement processed
SQL> alter database rename file '/u01/app/oracle/oradata/RIDER/redo02.log' to '/u01/app/oracle/oradata/RIDER/redo02.log';
Statement processed
SQL> alter database rename file '/u01/app/oracle/oradata/RIDER/redo03.log' to '/u01/app/oracle/oradata/RIDER/redo03.log';
Step 5: Crosscheck the backupset and start the database restoration.
Crosscheck the backupset to update the rman repository and catalog the new location. (upgrade 12c to 19c using rman)
RMAN> crosscheck backupset;
RMAN> delete expired backupset;
RMAN> catalog start with '/u02/rman_bkp/';
Step 6: Start Backup Restoration
Using the below query, start database restoration and recovery.
RMAN> run
{
allocate channel c1 device type disk;
set newname for database to '/u01/app/oracle/oradata/RIDER/%U';
set newname for tempfile '/u01/app/oracle/oradata/RIDER/temp01.dbf' to '/u02/app/oracle/oradata/RIDER/temp01.dbf';
restore database;
switch datafile all;
switch tempfile all;
recover database;
release channel c1;
}
Step 7: Open the database
Once recovery is complete then try to open the database, that time you will face an error :
RMAN> alter database open resetlogs;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00601: fatal error in recovery manager
RMAN-03004: fatal error during execution of command
ORA-01092: ORACLE instance terminated. Disconnection forced
..
ORA-00603: ORACLE server session terminated by fatal error
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 3087294
Session ID: 260 Serial number: 6155
As you can see in the above output there is an error, we need to open the database in upgrade mode, don’t miss these steps, and do carefully upgrade 12c to 19c using rman.
SQL> startup upgrade;
Step 8: Run catupgrd.sql
Run the catupgrd.sql to upgrade the database from 12c to 19.
SQL> @$ORACLE_HOME/rdbms/admin/catupgrd.sql
DOC>######################################################################
DOC>######################################################################
DOC> ERROR
DOC>
DOC>
DOC> As of 12.2, customers must use the parallel upgrade utility, catctl.pl,
DOC> to invoke catupgrd.sql when upgrading the database dictionary.
DOC> Running catupgrd.sql directly from SQL*Plus is no longer supported.
DOC>
DOC> For Example:
DOC>
DOC> cd $ORACLE_HOME/rdbms/admin
DOC> catctl
DOC>
DOC> or
DOC>
DOC> cd $ORACLE_HOME/rdbms/admin
DOC> $ORACLE_HOME/perl/bin/perl catctl.pl catupgrd.sql
DOC>
DOC> Refer to the Oracle Database Upgrade Guide for more information.
DOC>
DOC>
DOC>######################################################################
DOC>######################################################################
DOC>#
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Run catupgrd.sql with parallel upgrade utility using the following command
$ $ORACLE_HOME/perl/bin/perl catctl.pl -n 2 catupgrd.sql
Step 9: shutdown and startup normally
Just shut down the database and startup normally, then check the database registry.
SQL> startup
SQL> set lines 200 pages 200
SQL> col comp_name for a40
SQL> select comp_name, status from dba_registry;
Output:
Step 10: Run utlrp.sql
Run utlrp.sql to validate the database registry. This is the last step to upgrade 12c to 19c using rman.
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
After completing the above query check the database registry again, this time you will see it is valid.
SQL> select comp_name, status from dba_registry;
So finally you have successfully upgraded 12c to 19c using rman backup.
- How to Add New Disk in ASM DiskGroup
- Ways of generating EXECUTION PLAN in Oracle Database
- Convert Physical Standby To Snapshot Standby Database
- ORA-00020: maximum number of processes exceeded
- Drop Database Manually in Oracle
- Solve ORA-12528