ORACLE_PDB_SID and AutoUpgrade

Thanks to Rich for this one. I am not a fan of ORACLE_PDB_SID as it is highly error-prone. If you never heard about this environment variable, then stop reading here. You won’t need to learn about it. But in case you are aware of it, then please see what happens when you bring together ORACLE_PDB_SID and AutoUpgrade.

ORACLE_PDB_SID and AutoUpgrade

Photo by Taylor Brandon on Unsplash

ORACLE_PDB_SID?

A long while ago, I wrote two blog posts about Can you connext as SYSDBA without the password into a PDB directly? and Pitfalls: Connect to a PDB directly with ORACLE_PDB_SID. I tried to dig deep into the muddy grounds of this “workaround” which I believe had been created solely for EBS initially. But that is just my assumption. When you read the comments for both blog posts you’ll find out HOW many things really can go wrong with it.

The official Oracle documentation still does not list this variable anywhere. And we could say “What isn’t in the doc does not exist or isn’t supported!”. But it was at least in the EBS doc a long while ago. Not sure if it still is.

Anyhow, I labeled this environment variable as “Don’t use it” personally.

 

ORACLE_PDB_SID and AutoUpgrade?

Rich shared an interesting case with me when you set ORACLE_PDB_SID and call AutoUpgrade. His error looks like this:

$ java -jar autoupgrade.jar -config deploy.cfg -patch -mode deploy

AutoUpgrade Patching 26.6.260925 launched with default internal options
Processing config file ...
AutoUpgrade Patching is unable to connect or run queries on database /u01/app/oracle/product/26.0.0.0/dbhome_1. Possible reasons could be: 1. Database is shutdown 2. Database is opened with binari
es different than the ORACLE_HOME specified /u01/app/oracle/product/26.0.0.0/dbhome_1 in the config file 3. Configuration issues derived from environmental variables
(SQLPATH=/opt/autoupgrade/logs/cfgtoollogs/patch/auto/sql) (ORACLE_SID=prodcon) (ORACLE_PATH=/opt/autoupgrade/logs/cfgtoollogs/patch/auto/sql) (ORACLE_BASE=/u01/app/oracle) (TWO_TASK=) (TNS_ADMIN=
) (LANG=en_US.UTF-8) (LC_ALL=en_US.UTF-8) (LD_LIBRARY_PATH=/u01/app/oracle/product/26.0.0.0/dbhome_1/lib:/u01/app/oracle/product/26.0.0.0/dbhome_1/lib:) (ORACLE_HOME=/u01/app/oracle/product/26.0.0
.0/dbhome_1) (LDAP_ADMIN=) (PERL5LIB=/u01/app/oracle/product/26.0.0.0/dbhome_1/perl/lib)

$ unset ORACLE_PDB_SID

$ java -jar autoupgrade.jar -config deploy.cfg -patch -mode deploy

AutoUpgrade Patching 26.6.260925 launched with default internal options
Processing config file ...
+-----------------------------------------+
| Starting AutoUpgrade Patching execution |
+-----------------------------------------+
1 CDB(s) plus 2 PDB(s) will be processed
Type 'help' to list console commands
patch> lsj -a 60
+----+-------+---------+---------+-------+----------+----------+-----------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|START_TIME|   UPDATED|          MESSAGE|
+----+-------+---------+---------+-------+----------+----------+-----------------+
| 101|prodcon|PREFIXUPS|EXECUTING|RUNNING|  14:58:37|!!267s ago|Executing fixups|
+----+-------+---------+---------+-------+----------+----------+-----------------+
Total jobs 1

While my own tests lead to a different error:

[CDB19:oracle@holserv1:~]$ export ORACLE_PDB_SID=ORANGE

[CDB19:oracle@holserv1:~]$ java -jar autoupgrade.jar -config cdb.cfg -mode analyze

AutoUpgrade 26.5.260807 launched with default internal options
Processing config file ...
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 CDB(s) plus 1 PDB(s) will be analyzed
Type 'help' to list console commands
upg> 
-------------------------------------------------
Errors in database [CDB19]
Stage     [PRECHECKS]
Operation [STOPPED]
Status    [ERROR]
Info    [
Error: COM-112
java.sql.SQLException: Could not determine the database CON_ID CDB$ROOT
Cause: Loading the current state of the database failed
For further details, see the log file located at /home/oracle/logs/autoupgrade-UPGR/CDB19/101/autoupgrade_20261014_user.log]

-------------------------------------------------
Logs: [/home/oracle/logs/autoupgrade-UPGR/CDB19/101/autoupgrade_20261014_user.log]
-------------------------------------------------

But nevertheless, my recommendation generally remains: Don’t use ORACLE_PDB_SID anywhere.

Of course, the AU development team is evaluating whether we can forcefully unset the variable or do some additional error handling.

 

Fun fact

When I set ORACLE_PDB_SID intentionally to a non-existing PDB name, all works fine. Why? It then connects to the CDB$ROOT instead since the trigger the environment variable uses internally has zero error handling. The PDB “HUGO” does not exist in my test:

[CDB19:oracle@holserv1:~]$ export ORACLE_PDB_SID=HUGO

[CDB19:oracle@holserv1:~]$ java -jar autoupgrade.jar -config cdb.cfg -mode analyze

AutoUpgrade 26.5.260807 launched with default internal options
Processing config file ...
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 CDB(s) plus 3 PDB(s) will be analyzed
Type 'help' to list console commands
upg> lsj  
+----+-------+---------+---------+-------+----------+-------+----------------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|START_TIME|UPDATED|                     MESSAGE|
+----+-------+---------+---------+-------+----------+-------+----------------------------+
| 102|  CDB19|PRECHECKS|EXECUTING|RUNNING|  10:52:30| 7s ago|Loading database information|
+----+-------+---------+---------+-------+----------+-------+----------------------------+
Total jobs 1

Did I write that you shouldn’t use ORACLE_PDB_SID?

 

Further Links and Information

–Mike