ORA-65047: Object is invalid or was compiled with errors in the root.

If you have unplugged your PDB from 19c and plugged it back on 23ai/26ai, and open it, this will automatically trigger the Replay Upgrade. This method of upgrading a database is basically “replaying” all the captured changes that would bring a database from 19c to 23ai/26ai release.

However, sometimes objects are changed in the database, and you may end up with an error like this:

SQL> create pluggable database PDB01 using '/u01/app/oradata/PDB01.xml' file_name_convert=('/cdb1/pdb01/','/cdb2/pdb01/');

Pluggable database created.

SQL> alter pluggable database PDB01 open;
alter pluggable database PDB01 open
*
ERROR at line 1:
ORA-60510: encountered error  ORA-65047  during Replay Upgrade
ORA-65047: Object SYS.CDB_SYNC_CAPTURE_TABLES is invalid or was compiled with
errors in the root.
Help: https://docs.oracle.com/error-help/db/ora-60510/

In this example, I was upgrading from 19.29.0 to 23.26.0.

The upgrade to 23ai/26ai is hitting ORA-65047 with actions on top of %_SYNC_CAPTURE_TABLES views, which is an object that no longer exists because it was dropped by previous 23 RUs.

Checking the error:

SQL> alter session set container=PDB01;

Session altered.

SQL> select statement_id, statement from dba_replay_upgrade_errors where errormsg like '%ORA-65047%SYS.CDB_SYNC_CAPTURE_TABLES%';

STATEMENT_ID STATEMENT
____________ ______________________________________________________________
       57228 grant select on CDB_SYNC_CAPTURE_TABLES to select_catalog_role

The Replay Upgrade process loads the statements from a table called pdb_sync$, in CDB$ROOT. Unfortunately, it is only populated when you first create the database and is not refreshed after you apply an RUs. This is a design problem that is being corrected in the future. In my case, this database was created at 23.5 and later patched to 23.26.0, but the contents of pdb_sync$ are not refreshed to reflect objects that were removed.

To solve this problem, you can either:

  1. Use the AutoUpgrade tool to upgrade your PDB instead, which I recommend, or
  2. Fix the pdb_sync$ reloading it with the right data, or
  3. Create a new empty and dummy CDB using dbca and plug/upgrade to this CDB instead.

Please note you will have to start from the beginning. So always keep a backup of your unplugged PDB before trying those methods.

1 – Using AutoUpgrade

In this post I show how to run the final upgrade processes using AutoUpgrade: https://www.dbarj.com.br/en/2026/01/upgrade-from-oracle-19c-to-26ai-between-two-different

2 – Reloading pdb_sync$

To reload the pdb_sync$ table with the new and updated data, you have to call @?/rdbms/admin/catcaptabupg.sql once connected to the CDB$ROOT:

$ sqlplus / as sysdba

SQL*Plus: Release 23.26.0.0.0 - for Oracle Cloud and Engineered Systems on Wed Jan 14 19:29:06 2026
Version 23.26.0.0.0

Copyright (c) 1982, 2025, Oracle.  All rights reserved.

Connected to:
Oracle AI Database 26ai Enterprise Edition Release 23.26.0.0.0 - for Oracle Cloud and Engineered Systems
Version 23.26.0.0.0

SQL> @?/rdbms/admin/catcaptabupg.sql

Session altered.

no rows selected

old   4:   vsns CONSTANT vsns_t := vsns_t &vsns;
new   4:   vsns CONSTANT vsns_t := vsns_t ('19200');

PL/SQL procedure successfully completed.

Session altered.

Table created.

3 rows deleted.

0 rows deleted.

504 rows deleted.

0 rows deleted.

85192 rows deleted.

0 rows deleted.

0 rows deleted.

0 rows deleted.

1 row deleted.

Commit complete.

Table dropped.

System altered.

System altered.

Procedure created.

old   3:   vsns CONSTANT vsns_t := vsns_t &1;
new   3:   vsns CONSTANT vsns_t := vsns_t ('19200');
19200: COMPLETED

PL/SQL procedure successfully completed.

Procedure dropped.

    APPID# APP_NAME
---------- --------------------------------
4294967291 APP$CDB$CATALOG

no rows selected

System altered.

System altered.

Session altered.

old   3:   vsns CONSTANT vsns_t := vsns_t &vsns;
new   3:   vsns CONSTANT vsns_t := vsns_t ('19200');

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

Session altered.

SQL>

After the table is reloaded, try again to plug/upgrade the PDB:

SQL> create pluggable database PDB01 using '/u01/app/oradata/PDB01.xml' file_name_convert=('/cdb1/pdb01/','/cdb2/pdb01/');

Pluggable database created.

SQL> alter pluggable database PDB01 open;

Warning: PDB altered with errors.

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         4 PDB01                          READ WRITE YES

Notice that PDB is open but in restricted mode.

We need to finish the process by calling datapatch:

$ $ORACLE_HOME/OPatch/datapatch
SQL Patching tool version 23.26.0.0.0 Lim on Wed Jan 14 14:46:51 2026
Copyright (c) 2012, 2025, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/product/database/dbhome_1/cfgtoollogs/sqlpatch/sqlpatch_sid_orcl_ts_2026_01_14_14_46_51_pid_959636/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done

Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)

Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of interim SQL patches:
  No interim patches found

Current state of release update SQL patches:
  Binary registry:
    23.26.0.0.0 Release_Update 250927052030: Installed
  PDB CDB$ROOT:
    Applied 23.26.0.0.0 Release_Update 250927052030 successfully on 14-JAN-26 02.13.41.925667 PM
  PDB PDB$SEED:
    Applied 23.26.0.0.0 Release_Update 250927052030 successfully on 14-JAN-26 02.13.42.033770 PM
  PDB PDB01:
    Applied 23.26.0.0.0 Release_Update 250927052030 successfully

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED
    No interim patches need to be rolled back
    No release update patches need to be installed
    No interim patches need to be applied
  For the following PDBs: PDB01
    No interim patches need to be rolled back
    No release update patches need to be installed
    No interim patches need to be applied

Bypass install queue:
  For the following PDBs: PDB01
    No interim rollbacks will bypass install
    Patch 38404116 (Database Release Update : 23.26.0.0.0 (38404116) Gold Image): will bypass install
      Apply from 23.26.0.0.0 Release_Update 250927052030 to 23.26.0.0.0 Release_Update 250927052030
    No interim applys will bypass install


Installation queue after removing bypass entries...
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED
    No interim patches need to be rolled back
    No release update patches need to be installed
    No interim patches need to be applied
  For the following PDBs: PDB01
    No interim patches need to be rolled back
    No release update patches need to be installed
    No interim patches need to be applied


Processing bypass install queue:
  Patch 38404116 apply (pdb PDB01): SUCCESS (bypass_install)

SQL Patching tool complete on Wed Jan 14 14:47:01 2026

Finally, let’s reopen the PDB:

SQL> alter pluggable database PDB01 close;

Pluggable database altered.

SQL> alter pluggable database PDB01 open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         4 PDB01                          READ WRITE NO

The last step would be to:

3 – Using the dummy CDB

First, I will create a new dummy CDB in 23.26.0 with dbca:

$ dbca -silent -createDatabase \
-gdbName orcl \
-templateName General_Purpose.dbc \
-characterSet AL32UTF8 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbAdminPassword "Rodrigo.123" \
-pdbName PDB01 \
-useLocalUndoForPDBs true \
-databaseConfigType SINGLE \
-databaseType MULTIPURPOSE \
-datafileDestination /u01/app/oradata \
-dvConfiguration false \
-emConfiguration NONE \
-enableArchive false \
-memoryMgmtType AUTO_SGA \
-totalMemory 4000 \
-nationalCharacterSet AL16UTF16 \
-olsConfiguration false \
-recoveryAreaDestination /u01/app/fra \
-sampleSchema false \
-sid orcl \
-storageType FS \
-useOMF false \
-sysPassword "Rodrigo.123" \
-systemPassword "Rodrigo.123"

After the CDB is created, connect to it and just try the same steps from the previous method:

  • Create the PDB.
  • Open it and wait for the upgrade to complete.
  • Call Datapatch.
  • Reopen it and check if restricted mode has gone.

The last steps would be to:

  • Unplug the PDB from this dummy CDB.
  • Plug it back into your production CDB.
  • Drop the dummy CDB.

Conclusion

Needless to repeat, just use AutoUpgrade and avoid some headaches.

Have you enjoyed? Please leave a comment or give a 👍!

Leave a Reply

Your email address will not be published.