Quantcast
Channel: Cloud Training Program
Viewing all articles
Browse latest Browse all 1891

Oracle 19c Database Upgrade Using Auto Upgrade

$
0
0

Oracle 19c Database was introduced in EBS R 12.2 in September 2019 and updated several additional certifications with a lot of new features and enhanced services in September 2020. Customers who are using 11g or 12c databases are already upgrading the database to 19c as it provides new features such as

  • Automatic Indexing
  • Automated Testing of Query Plans
  • Active Data Guard DML Redirection
  • Easy Connect Enhancements
  • Previously chargeable features now offered free of charge

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. In this blog, in detail, we are going to cover,

19c Database Overview ^

Oracle introduced the multitenant architecture in 2013 with the Oracle Database 12c version release.  It consists of CDB(Container Database) and PDB (Pluggable Database).

With the release of Oracle Database 19c, Oracle allows you to create three user-created PDBs without any additional multitenant license. Applicable for both Standard Edition (SE2) and Enterprise Edition (EE). Multitenant architecture brings huge administration advantages, especially to minimize patching, upgrade, and cloning. This license change will help accelerate the adoption of the Container Database architecture.

Though the non-CDB architecture was “deprecated” since 12.1, it was available and supported to date. In 20c, the non-CDB architecture is “de-supported” and soon there will not be an option to create a non-CDB database.

To know more about the 19c database, Check Oracle Database 19c: Everything You Must Know 

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.

19c database auto upgrade

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.

AutoUpgrade workflow

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.

Also Check: Our blog post on EBS 12.2 Upgrade.

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, Refer here for step by step installation of Oracle 19.3.0.0 on Linux 7 64bit.

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.

Click here to download the latest version.

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

Modify the config file: Copy the sample config file and make the necessary changes as per the database environment.

Also Read: Our blog post on Oracle Apps DBA R12.

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,

export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/jdk/bin
cd /u01/19c-autoupg
$ORACLE_HOME/jdk/bin/java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config cdbdev_db_config.cfg -mode ANALYZE

Output

[oracle@new19c 19c-autoupg]$ $ORACLE_HOME/jdk/bin/java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config cdbdev_db_config.cfg -mode ANALYZE
AutoUpgrade tool launched with default options
Processing config file ...
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be analyzed
Type 'help' to list console commands
upg> lsdg
Unrecognized cmd: lsdg
upg> lsj
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|                     MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
| 100| cdbdev|PRECHECKS|PREPARING|RUNNING|20/11/19 03:27|03:27:28|Loading database information|
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
Total jobs 1

upg> Job 100 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

Jobs finished successfully     [1]
Jobs failed                    [0]
Jobs pending                   [0]
------------- JOBS FINISHED SUCCESSFULLY -------------
Job 100 for cdbdev

[oracle@new19c 19c-autoupg]$

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

[oracle@new19c 100]$ cd /u01/19c-autoupg/upg_logs/cdbdev/cdbdev/100/prechecks/
[oracle@new19c prechecks]$ ls -l
total 536
-rwx------. 1 oracle oinstall   5051 Nov 19 03:28 cdbdev_checklist.cfg
-rwx------. 1 oracle oinstall  18050 Nov 19 03:28 cdbdev_checklist.json
-rwx------. 1 oracle oinstall  17101 Nov 19 03:28 cdbdev_checklist.xml
-rwx------. 1 oracle oinstall  36704 Nov 19 03:28 cdbdev_preupgrade.html
-rwx------. 1 oracle oinstall  17649 Nov 19 03:28 cdbdev_preupgrade.log
-rwx------. 1 oracle oinstall 158030 Nov 19 03:28 prechecks_cdb_root.log
-rwx------. 1 oracle oinstall 140241 Nov 19 03:28 prechecks_pdbdev.log
-rwx------. 1 oracle oinstall 139243 Nov 19 03:28 prechecks_pdb_seed.log
[oracle@new19c prechecks]$

We can review the HTML file (cdbdev_preupgrade.html) which will list all precheck Errors, warnings & recommendations.cdbdev_preupgrade.html

Check Out: Our previous blog post on Oracle EBS Vision Instance.

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,

export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1export PATH=$PATH:$ORACLE_HOME/jdk/bincd /u01/19c-autoupg$ORACLE_HOME/jdk/bin/java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config cdbdev_db_config.cfg -mode DEPLOY

Once the upgrade process is started consider monitoring the logs to see the progress of the upgrade. Autoupgrade logs are available under,

/u01/19c-autoupg/upg_logs/cdbdev/cdbdev/101/dbupgrade

Output

[oracle@new19c 19c-autoupg]$ $ORACLE_HOME/jdk/bin/java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -config cdbdev_db_config.cfg -mode DEPLOY
AutoUpgrade tool launched with default options
Processing config file ...
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be processed
Type 'help' to list console commands

upg> tasks
+--+-------------+-------------+
|ID|         NAME|         Job#|
+--+-------------+-------------+
| 1|         main|      WAITING|
|35|     jobs_mon|      WAITING|
|36|      console|     RUNNABLE|
|37| queue_reader|      WAITING|
|38|        cmd-0|      WAITING|
|54|job_manager-0|      WAITING|
|56|   event_loop|TIMED_WAITING|
|57|   bqueue-101|      WAITING|
|61|     quickSQL|     RUNNABLE|
+--+-------------+-------------+
upg>
upg> logs
AutoUpgrade logs folder [/u01/19c-autoupg/upg_logs/cfgtoollogs/upgrade/auto]
logs folder [cdbdev][/u01/19c-autoupg/upg_logs/cdbdev/cdbdev]

upg> lsj
+----+-------+---------+---------+--------+--------------+--------+----------------------------+
|Job#|DB_NAME|    STAGE|OPERATION|  STATUS|    START_TIME| UPDATED|                     MESSAGE|
+----+-------+---------+---------+--------+--------------+--------+----------------------------+
| 101| cdbdev|PREFIXUPS|EXECUTING|FINISHED|20/11/19 03:46|03:48:44|Loading database information|
+----+-------+---------+---------+--------+--------------+--------+----------------------------+
Total jobs 1

upg> lsj
+----+-------+-----+---------+-------+--------------+--------+----------------------+
|Job#|DB_NAME|STAGE|OPERATION| STATUS|    START_TIME| UPDATED|               MESSAGE|
+----+-------+-----+---------+-------+--------------+--------+----------------------+
| 101| cdbdev|DRAIN|EXECUTING|RUNNING|20/11/19 03:46|03:48:52|Shutting down database|
+----+-------+-----+---------+-------+--------------+--------+----------------------+
Total jobs 1

upg> status
---------------- Config -------------------
User configuration file    [/u01/19c-autoupg/cdbdev_db_config.cfg]
General logs location      [/u01/19c-autoupg/upg_logs/cfgtoollogs/upgrade/auto]
Mode                       [DEPLOY]
DB upg fatal errors        ORA-00600,ORA-07445
DB Post upgrade abort time [60] minutes
DB upg abort time          [1440] minutes
DB restore abort time      [120] minutes
DB GRP abort time          [3] minutes
------------------------ Jobs ------------------------
Total databases in configuration file [1]
Total Non-CDB being processed         [0]
Total CDB being processed             [1]
Jobs finished successfully            [0]
Jobs finished/aborted                 [0]
Jobs in progress                      [1]
Jobs stage summary
    Job ID: 101
    DB name: cdbdev
        SETUP             <1 min
        GRP               <1 min
        PREUPGRADE        <1 min
        PRECHECKS         <1 min
        PREFIXUPS         1 min
        DRAIN             <1 min
        DBUPGRADE         12 min (IN PROGRESS)
------------ Resources ----------------
Threads in use                        [32]
JVM used memory                       [115] MB
CPU in use                            [13%]
Processes in use                      [18]

upg> lsj
+----+-------+---------+---------+-------+--------------+--------+--------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|             MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
| 101| cdbdev|DBUPGRADE|EXECUTING|RUNNING|20/11/19 03:46|04:38:42|70%Upgraded CDB$ROOT|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
Total jobs 1

upg> /
+----+-------+---------+---------+-------+--------------+--------+--------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|             MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
| 101| cdbdev|DBUPGRADE|EXECUTING|RUNNING|20/11/19 03:46|06:31:20|95%Upgraded PDB$SEED|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
Total jobs 1

upg> /
+----+-------+----------+---------+-------+--------------+--------+-------------+
|Job#|DB_NAME|     STAGE|OPERATION| STATUS|    START_TIME| UPDATED|      MESSAGE|
+----+-------+----------+---------+-------+--------------+--------+-------------+
| 101| cdbdev|POSTFIXUPS|EXECUTING|RUNNING|20/11/19 03:46|06:38:37|Remaining 1/9|
+----+-------+----------+---------+-------+--------------+--------+-------------+
Total jobs 1

upg> /
+----+-------+----------+---------+-------+--------------+--------+----------------------------+
|Job#|DB_NAME|     STAGE|OPERATION| STATUS|    START_TIME| UPDATED|                     MESSAGE|
+----+-------+----------+---------+-------+--------------+--------+----------------------------+
| 101| cdbdev|POSTFIXUPS|EXECUTING|RUNNING|20/11/19 03:46|06:43:37|Loading database information|
+----+-------+----------+---------+-------+--------------+--------+----------------------------+
Total jobs 1

upg> /
+----+-------+-----------+---------+-------+--------------+--------+---------------------+
|Job#|DB_NAME|      STAGE|OPERATION| STATUS|    START_TIME| UPDATED|              MESSAGE|
+----+-------+-----------+---------+-------+--------------+--------+---------------------+
| 101| cdbdev|POSTUPGRADE|EXECUTING|RUNNING|20/11/19 03:46|06:45:16|Creating final SPFILE|
+----+-------+-----------+---------+-------+--------------+--------+---------------------+
Total jobs 1

upg> /
+----+-------+-----------+---------+-------+--------------+--------+----------+
|Job#|DB_NAME|      STAGE|OPERATION| STATUS|    START_TIME| UPDATED|   MESSAGE|
+----+-------+-----------+---------+-------+--------------+--------+----------+
| 101| cdbdev|POSTUPGRADE|EXECUTING|RUNNING|20/11/19 03:46|06:46:01|Restarting|
+----+-------+-----------+---------+-------+--------------+--------+----------+
Total jobs 1

upg> Job 101 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

Jobs finished successfully     [1]
Jobs failed                    [0]
Jobs pending                   [0]
------------- JOBS FINISHED SUCCESSFULLY -------------
Job 101 for cdbdev

---- Drop GRP at your convenience once you consider it is no longer needed ----
Drop GRP from cdbdev: drop restore point AUTOUPGRADE_9212_CDBDEV122010
[oracle@new19c 19c-autoupg]$

Check the upg_summary.log

Oracle Database Release 19 Post-Upgrade Status Tool    11-19-2020 06:30:0
Container Database: CDBDEV
[CON_ID: 2 => PDB$SEED]

Component                               Current         Full     Elapsed Time
Name                                    Status          Version  HH:MM:SS

Oracle Server                             VALID      19.3.0.0.0  00:34:10
JServer JAVA Virtual Machine              VALID      19.3.0.0.0  00:02:25
Oracle XDK                                VALID      19.3.0.0.0  00:01:19
Oracle Database Java Packages             VALID      19.3.0.0.0  00:00:10
OLAP Analytic Workspace                   VALID      19.3.0.0.0  00:00:55
Oracle Label Security                     VALID      19.3.0.0.0  00:00:11
Oracle Database Vault                     VALID      19.3.0.0.0  00:03:00
Oracle Text                               VALID      19.3.0.0.0  00:00:42
Oracle Workspace Manager                  VALID      19.3.0.0.0  00:00:52
Oracle Real Application Clusters     OPTION OFF      19.3.0.0.0  00:00:00
Oracle XML Database                       VALID      19.3.0.0.0  00:03:32
Oracle Multimedia                         VALID      19.3.0.0.0  00:00:46
Spatial                                   VALID      19.3.0.0.0  00:09:15
Oracle OLAP API                           VALID      19.3.0.0.0  00:00:26
Datapatch                                                        00:04:50
Final Actions                                                    00:05:11
Post Upgrade                                                     00:02:06
Post Compile                                                     00:11:29

Total Upgrade Time: 01:17:50 [CON_ID: 2 => PDB$SEED * ]
Asterisks denotes compilation time has been included during the upgrade process.

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.

Upgrade Times Sorted In Descending Order

Total Upgrade Time: 01:17:50 [CON_ID: 2 => PDB$SEED * ]
Total Upgrade Time: 01:06:31 [CON_ID: 1 => CDB$ROOT]
Total Upgrade Time: 01:06:12 [CON_ID: 3 => PDBDEV]
Grand Total Upgrade Time:    [0d:2h:42m:43s]
[oracle@new19c dbupgrade]$

Timezone file upgrade and database recompilation has already completed by the auto-upgrade utility as the below values are adjusted as “yes” in the config file,

upg1.run_utlrp=yes =yes  # yes(default) to run utlrp as part of upgrade
upg1.timezone_upg=yes # yes(default) to upgrade timezone if needed

Check the Timezone version

SQL> SELECT VERSION FROM V$TIMEZONE_FILE;
   VERSION
----------
        32
SQL>

Check the DB details

SQL> select name, open_mode, version, status from v$database, v$instance;

NAME      OPEN_MODE            VERSION           STATUS
--------- -------------------- ----------------- ------------
CDBDEV    READ WRITE           19.0.0.0.0        OPEN

SQL>

Also Check: Our blog post on Oracle EBS 12.2 Upgrade.

6. Post-upgrade task ^

Once the upgrade is successful and all testing is done, drop the restore point.

Drop the Guaranteed restore point

SQL> select name from v$restore_point;
NAME
------------------------------
AUTOUPGRADE_9212_CDBDEV122010
SQL>
SQL> drop restore point AUTOUPGRADE_9212_CDBDEV122010;
Restore point dropped.
SQL>

Change the compatible parameter

Note: After the upgrade, the database has to be tested properly before updating the compatible parameter. Once the parameter is updated database cannot be downgraded.

show parameter compatible
alter system set compatible='19.0.0' scope=spfile;
shutdown immediate;
startup;
show parameter compatible

--output
SQL> show parameter compatible

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
compatible                           string      12.2.0
noncdb_compatible                    boolean     FALSE
SQL> alter system set compatible='19.0.0' scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1560278096 bytes
Fixed Size                  9135184 bytes
Variable Size             973078528 bytes
Database Buffers          570425344 bytes
Redo Buffers                7639040 bytes
Database mounted.
Database opened.
SQL> 
SQL> show parameter compatible

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
compatible                           string      19.0.0
noncdb_compatible                    boolean     FALSE
SQL>

The database is successfully upgraded from 12c to 19c.

Related/Further Readings

Next Task For You

We cover Oracle E-Business R12.2 Architecture & concepts in our Oracle Apps DBA For Beginners Training along with the Installation, Patching, Cloning, and Troubleshooting and also, Database upgrade to 19c  and much more including the hands-on labs you must perform to upgrade your skills and get a good job with a high package.

Begin your journey towards becoming an Apps DBA by joining our FREE Masterclass on How To Learn Oracle Apps DBA (R12) & It’s New Features.

The post Oracle 19c Database Upgrade Using Auto Upgrade appeared first on Cloud Training Program.


Viewing all articles
Browse latest Browse all 1891

Trending Articles