AutoUpgrade may fail when patch ID column is NULL

Monday morning – it’s time to write a new blog post. And actually I will set priorities based on what you reported to me in the past week. This way it may prevent others from hitting the same pitfall. The AutoUpgrade may fail when patch ID column is NULL in REGISTRY$HISTORY.

AutoUpgrade may fail when patch ID column is NULL

Photo by Etienne Boulanger on Unsplash

What is happening?

You start a database upgrade with autoupgrade. But the initial check will fail with a message like this:

AutoUpgrade tool launched with default options
There was an error initializing the patching information for entry upg2

The AutoUpgrade won’t kick off the database upgrade.

Why is it happening?

Actually you don’t hit an “upgrade” issue. Of course, it happens when you try to upgrade a database. But the root cause is a NULL value in the ID column in REGISTRY$HISTORY (visible also via DBA_REGISTRY_HISTORY).

Let me show you a quick example.

This is from my 11.2.0.4 database in the lab:

AutoUpgrade may fail when patch ID column is NULL

You see that the ID column is populated for each PSU I applied. Hence, there won’t be any issue when I attempt to upgrade this database. But what happens when I set the ID column to NULL for one of the entries?

update registry$history set ID = NULL where ID=160419;
commit;

When I invoke my recent version of autoupgrade (Oct 28, 2019), then I receive:

$ java -jar $OH19/rdbms/admin/autoupgrade.jar -config UP19.cfg -mode analyze
AutoUpgrade tool launched with default options
There was an error initializing the patching information for entry upg2

A quick look into the autoupgrade_err.log does tell me a bit more:

2019-11-25 11:18:29.201 ERROR 4 - UpgradeConfigDBValidator.findPatchInfo
java.lang.ArrayIndexOutOfBoundsException: 4
        at oracle.upgrade.autoupgrade.config.UpgradeConfigDBValidator.findContainerPatches(UpgradeConfigDBValidator.java:396)
        at oracle.upgrade.autoupgrade.config.UpgradeConfigDBValidator.findPatchInfo(UpgradeConfigDBValidator.java:329)
        at oracle.upgrade.autoupgrade.config.links.UpgradeConfigMaker.process(UpgradeConfigMaker.java:605)
        at oracle.upgrade.autoupgrade.config.CLILink.nextLink(CLILink.java:53)
        at oracle.upgrade.autoupgrade.config.links.InternalSettingsParser.process(InternalSettingsParser.java:124)
        at oracle.upgrade.autoupgrade.config.CLILink.nextLink(CLILink.java:53)
        at oracle.upgrade.autoupgrade.config.links.UserConfigFileParser.process(UserConfigFileParser.java:180)
        at oracle.upgrade.autoupgrade.config.CLILink.nextLink(CLILink.java:53)
        at oracle.upgrade.autoupgrade.config.links.ContextFinder.process(ContextFinder.java:133)
        at oracle.upgrade.autoupgrade.config.CLILink.nextLink(CLILink.java:53)
        at oracle.upgrade.autoupgrade.config.links.LoggerMaker.process(LoggerMaker.java:68)
        at oracle.upgrade.autoupgrade.config.CLILink.nextLink(CLILink.java:53)
        at oracle.upgrade.autoupgrade.config.links.AutoUpgradeLocker.process(AutoUpgradeLocker.java:73)

The tool does not like the NULL entry in the ID column.

Based on the number of people who reported this issue recently to me I guess, it may not be so uncommon to have a NULL value in the ID column for an older patch.

Simple workaround?

Of course in this case there are multiple workarounds. But the one I would recommend is to update the ID column with the correct value from the COMMENTS field. In my case this would be:

update registry$history set ID = 160419 where ID is NULL and COMMENTS like '%160419%';

But even if you have no useful information in the COMMENTS field, you could simply update the ID column with a value such as “1” – and then the tool will proceed.

Just don’t delete the entire row from REGISTRY$HISTORY please – even though this would work of course as well.

I’m pretty sure that my team mates added a workaround into a future version of the autoupgrade tool already.

Just in addition, I tested if this would fail with a normal database upgrade, too. It doesn’t as this check is not part of the preupgrade.jar checks but is only executed by AutoUpgrade. The same applies to the DBUA as it settles on our preupgrade.jar as well.

Further Information

Start here if you are seeking for more information about AutoUpgrade:

–Mike

 

Share this: