Thursday, February 16, 2023

Upgrade Oracle Database using AutoUpgrade Utility

Autoupgrade is used to upgrade one or more databases using command line. Using the tool, you can run pre-upgrade tasks that will provide the fixups, all recommended fixups must be executed before upgrading the database and finish the upgrade by running the post-upgrade tasks. By using this utility you can upgrade hundreds of databases with one command.

It is always recommending that you run AutoUpgrade in Analyze mode before running in Fixup mode. Note that fixup mode can make changes to the source database. The Autoupgrade includes automatic retry and fallback, schedule upgrades and modify or remove the initialization parameters which are deprecated.

AutoUpgrade utility can be used on upgrading databases from 12c R2 release (12.2 + DBJAN2019RU and newer)

You need to download AutoUpgrade utility for Databases 12c R2 and 18c. From 19.3 (19c) and later the autoupgrade.jar file exists by default.

Oracle home must contain JAVA to use AutoUpgrade Tool. Always download latest AutoUpgrade.jar file

Create a sample config.txt file for database ugrade

upgrade1.sid=TESTDB                       # ORACLE_SID of source DB
upgrade1.run_utlrp=no                       # Optional. To run utlrp after upgrade select YES
upgrade1.timezone_upg=no                # Optional. To run the timezone upgrade select YES
upgrade1.start_time=now                    # Optional Use “NOW” or specify future upgrade time and date [+XhYm (X hours, Y minutes) | dd/mm/yyyy hh:mm:ss]      
upgrade1.upgrade_node=localhost    # Optional. Default is 'localhost'
upgrade1.target_version=19               # Only required if target database version is 12.2
upgrade1.log_dir= /home/oracle/cfgtoollogs/autoupgrade/TESTDB # Log dir path for the upgrade job
upgrade1.source_home=/home/oracle/product/  # Source ORACLE_HOME Path 
upgrade1.target_home=/home/oracle/product/   # Target ORACLE_HOME Path 

AutoUpgrade with source and Target Database on same server
  • Run below command to start AutoUpgrade Analyze
$ORACLE_HOME/jdk/bin/java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar – config /home/oracle/autoupgrade/config.txt -mode analyze
AutoUpgrade utility launched with default options
Processing config file ...
| Starting AutoUpgrade execution |
1 databases will be analyzed
Type 'help' to list console commands
upg> Job 100 completed
------------------- Final Summary --------------------
Number of databases [ 1 ]
Jobs finished [1]
Jobs failed [0]
Jobs pending [0]
------------------- JOBS FINISHED SUCCESSFULLY --------------------
Job 100 for TESTDB

All the logs are under the job id . Pls review all the logs for any errors and information.

You can see the warnings and errors in html file.


  • Run below command to start deployment of upgrade on same server
$ORACLE_HOME/jdk/bin/java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar – config /home/oracle/autoupgrade/config.txt -mode deploy

AutoUpgrade utility launched with default options
Processing config file ...
| Starting AutoUpgrade execution |
1 databases will be processed
Type 'help' to list console commands

upg> lsj
| 102| TESTDB|DBUPGRADE|EXECUTING|RUNNING|21/05/12 15:03|15:35:22|95% Upgraded |
Total jobs 1

Once upgrade is completed verify upg_summary.log for any errors

/u01/home/oracle:DBA>cat upg_summary.log
Oracle Database Release 19 Post-Upgrade Status Utility 04-30-2021 11:07:0
Database Name: TESTDB
Component Current Full Elapsed Time
Name Status Version HH:MM:SS
Oracle Server UPGRADED 00:09:54
JServer JAVA Virtual Machine VALID 00:01:12
Oracle XDK UPGRADED 00:00:38
Oracle Database Java Packages UPGRADED 00:00:05
Oracle Text UPGRADED 00:00:23
Oracle Workspace Manager UPGRADED 00:00:22
Oracle Real Application Clusters OPTION OFF 00:00:00
Oracle XML Database UPGRADED 00:00:51
Oracle Multimedia UPGRADED 00:01:47
Datapatch 00:01:41
Final Actions 00:01:44
Post Upgrade 00:00:16

Total Upgrade Time: 00:17:31

Database time zone version is 26. It is older than current release time
          zone version 32. Time zone upgrade is needed using the DBMS_DST package.

          Grand Total Upgrade Time: [0d:0h:20m:20s]

If you select upgrade1.timezone_upg=YES then Time zone will be upgraded as part of the Database upgrade. 

AutoUpgrade Stages

AutoUpgrade utility go through series of steps called stages but the actions performed during every stage defined by the “processing mode”. For AutoUpgrade we have Analyze, Fixups, Deploy, and Upgrade processing modes.

AutoUpgrade has the following stages: 
  • SETUP: The initial stage in which it starts the job.
  • PREUPGRADE: The stage in which it performs readiness for upgrade such as sufficient space
  • PRECHECKS: The stage in which it performs pre-checks on source Oracle home to meet requirements for upgrade.
  • GRP: Backup database using guaranteed restore point (GRP) before upgrade, this option only available in Enterprise Edition only
  • PREFIXUPS: The stage in which it performs preupgrade fixups before upgrade
  • DRAIN: The stage during which it shuts down the database to release resources.
  • DBUPGRADE: The stage in which it performs the actual upgrade.
  • POSTCHECKS: The stage in which it performs post upgrade checks on the target Oracle home before executing any postupgrade fixups.
  • POSTFIXUPS: The stage in which it performs processing of postupgrade fixups, timezone upgrade is part of this step.
  • POSTUPGRADE: The stage in which in copies or merges the required files from to the target Oracle home for ex:- listener, tns files
There are 2 operational modes during Autoupgrade, i.e. PREPARING and EXECUTING

There are 4 state messages
  • RUNNING – AutoUpgrade is still running
  • FINISHED - AutoUpgrade is successfully completed
  • ERROR – AutoUpgrade has some Errors
  • ABORTED - AutoUpgrade aborted response to user request.
Refer useful oracle support notes
Thanks & Regards,, Oracle ACE

No comments:

Post a Comment