Friday, March 24, 2023

Oracle 19c Database Upgrade Using Auto Upgrade

Introduction

To automate the database upgrade process, both before and after starting upgrades, during upgrade deployments, post-upgrade checks, and configuration migration, Oracle has introduced a command-line tool called Autoupgrade Utility.

What is Auto Upgrade Utility? 

The Oracle Database AutoUpgrade utility is a new command-line tool that allows you to upgrade your databases in an unattended way.  The idea of the tool is to run the prechecks against multiple databases, fix 99% of the potential issues, set a restore point in case something goes wrong – and then upgrade your databases. And of course, do the post-upgrade, recompilation, and time zone adjustment.

Benefits of Auto Upgrade Utility 

       Enables customers to upgrade one or many Oracle databases at the command-line with a single command and a single configuration file.

   •    Will run the pre-upgrade tasks, perform automated fixups where needed, execute the database upgrade, and finish by taking care of post-upgrade tasks.

   •    Includes automatic retry and fallback, the possibility to schedule upgrades for future points in time, and the ability to set, change or remove initialization parameters as desired.

   •    Saves time and money by upgrading hundreds of databases with one command and replacing bespoke high maintenance upgrade solutions.

Auto Upgrade Workflow

   •    The AutoUpgrade utility is a Java 8 release JAR file which is available by default in Oracle Database homes from release 12.1.0.2 and latest.

   •    The path to the Java version in the Oracle home is $ORACLE_HOME/JDK/bin/java -version where the $ORACLE_HOME is the old database home that you are going to upgrade.

Four AutoUpgrade processing modes characterize the actions that AutoUpgrade performs as it runs. For each mode, AutoUpgrade steps are performed in sequence.

   •    Analyze Mode: Setup–>Prechecks.

   •    Fixups Mode: Setup, Prechecks, and Prefixups.

   •    Deploy Mode: Setup, Pre upgrade, Prechecks, guaranteed to restore point (GRP), Prefixups, Drain, DB Upgrade, Post checks, and Post upgrade. You can run your own scripts before the upgrade or after the upgrade, or both before and after the upgrade.

     Upgrade Mode: Setup, DB Upgrade, Post checks, and Postfixups.

High-level Steps for Auto-Upgrade 

    1. Install Oracle 19.3.0.0 binaries

    2. Prerequisite for Auto upgrade

    3. Create the config file

    4. Analyze the database

    5. Deploy the upgrade

    6. Post upgrade task

AutoUpgrade – Step-by-Step

    1. Install Oracle 19.3.0.0 binaries 

I have already completed the installation of 19c

    2. Prerequisite for Autoupgrade

Download the latest file of autoupgrade.jar

         The autoupgrade.jar file exists by default, In Oracle Database 19c (19.3) and the later target Oracle homes.

         The autoupgrade. jar file is available in the Oracle 19c database software in the $ORACLE_HOME/rdbms/admin directory.

         Before you use AutoUpgrade, Oracle recommends that you download the latest Autoupgrade version available from MOS Note: 2485457.1 – AutoUpgrade Tool.

Replace the autoupgrade.jar with the latest version downloaded.

Java version

Java version should be 8 or later, which is available by default in Oracle Database homes from release 12.1.0.2 and latest.

    3. Create the config file

Create a directory to hold all upgrade config and log files.

Create the sample config file

 We can upgrade multiple pdb in one go, as of now we are doing just 1 DB

    4. Analyze the database 

Autoupgrade Analyze mode checks your database to see if it is ready for the upgrade. This will read data from the database and does not perform any updates.

Execute autoupgrade in analyze mode with the below syntax,

Set 19c home and path

export ORACLE_HOME=/home/oracle/app/oracle/product/19c

export PATH=$PATH:$ORACLE_HOME/jdk/bin 

run below command

$ORACLE_HOME/jdk/bin/java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config cecil1_config.cfg -mode ANALYZE

We can monitor, manage and control the jobs from the autoupgrade console. For example,

lsj – to list the jobs

status – to show the job status

tasks – shows the tasks executing

All the Analyze logs are created under autoupg_log_dir

If you get any error , kindly fix and proceed further

Make sure FRA enabled and enough size set , else in between you might face error , 

We can resume the job anytime that good thing here.

    5. Deploy the upgrade 

Auto upgrade Deploy mode performs the actual upgrade of the database from pre-upgrade source database analysis to post-upgrade checks.

Note: Before deploying the upgrade, you must have a backup plan in place.

Execute the auto-upgrade in DEPLOY mode using the below syntax,

$ORACLE_HOME/jdk/bin/java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config cecil1_config.cfg -mode DEPLOY

I got below error because my DB was not in arch log mode

 Once archive enabled and FRA set , resumed the job

 

Upgrade done

     6. Post-upgrade task 

Once the upgrade is successful and all testing is done, drop the restore point, post app team confirmation 

Drop the Guaranteed restore point

 

 

No comments:

Post a Comment