5.4 Plugging in a PDB When Oracle APEX Is Installed in the Root Container

Learn about scenarios in which the target database has Oracle APEX installed into the root container, CDB$ROOT - the default installation option.

This section describes scenarios in which the target database has Oracle APEX installed into the root container, CDB$ROOT - the default installation option. Note there are multiple scenarios related to where the database being plugged in originated from and how Oracle APEX was configured in the originating database.

5.4.1 Scenario 1: Plug-in Non-CDB with Oracle APEX

Plug-in Non-CDB with Oracle APEX.

If you are upgrading from a previous Oracle Database release, then you first need to upgrade to a Oracle Database 12c non-CDB (or PDB with locally installed APEX) or and then plug the database into your CDB. Alternatively, if you have configured a non-CDB Oracle Database 12c or later (or PDB with locally installed APEX), you may now want to plug this database into a CDB. In both cases, the originating database has APEX installed and was not formerly a PDB.

As described in the Oracle Database Installation Guide for your operating system, when plugging in a standalone database you need to run the $ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql script. This script creates the necessary metadata linked objects, instead of local objects and recompiles the database objects for all common database options, including APEX.

After installing Oracle APEX, you need to configure the web server for the PDB.

If the version of Oracle APEX installed in the originating database (which is now a PDB) is different from what is installed into the root container of the target, an error will be raised when trying to open the PDB.

5.4.2 Scenario 2: Plug-in PDB with a Common APEX from Another CDB

Plug-in a PDB with APEX from another CDB.

If you are copying or moving a PDB from an existing Oracle Database 12c or later where the originating CDB had APEX installed in the root container, you will not need to perform any additional steps, other than configuring the web server for the PDB.

This scenario assumes APEX release 21.1 is installed and the APEX_220100 schema within the PDB being plugged in already has the metadata linked objects defined and will compile without error against the metadata linked objects within the target CDB.

If the version of APEX installed in the originating database is different from what is installed in the root container of the target an error is raised when trying to open the PDB.

5.4.3 Scenario 3: Plug-in PDB with a Local Oracle APEX from Another CDB

Plug-in a PDB with a local Oracle APEX from another CDB.

If you are copying or moving a PDB from an existing Oracle Database 12c or later where APEX was not installed in the root container but is installed locally, then you need to perform additional steps before the PDB can be opened without errors.

This scenario assumes APEX release 22.1 is installed and the APEX_220100 schema within the PDB being plugged in contains all of the APEX database objects and has no metadata linked objects. Therefore, you need to run $ORACLE_HOME/rdbms/admin/apex_to_common.sql to remove the common objects and create the metadata links for the packages, views and so forth.

To replace local objects with metadata links in the PDB:

  1. Change your working directory to $ORACLE_HOME/rdbms/admin.

  2. Start SQL*Plus and connect to the database where APEX is installed as SYS specifying the SYSDBA role. For example:

    • On Windows:

      SYSTEM_DRIVE:\ sqlplus /nolog
      SQL> CONNECT SYS as SYSDBA
      Enter password: SYS_password
      
    • On UNIX and Linux:

      $ sqlplus /nolog
      SQL> CONNECT SYS as SYSDBA
      Enter password: SYS_password
      
  3. Set the container to the PDB to be configured:

    ALTER SESSION SET CONTAINER = <PDB_name>;
    
  4. Run apex_to_common.sql. For example:

    @apex_to_common.sql 
    
    

If the version of Oracle APEX installed in the originating database is different from what is installed in the root container of the target an error is raised when trying to open the PDB.

5.4.4 Scenario 4: Plug-in Non-CDB or PDB with No Oracle APEX

Plug-in a Non-CDB or PDB if Oracle APEX is not installed.

In this scenario, the APEX schema, such as APEX_220100 for Oracle APEX release 22.1, will not be present in the originating database or the PDB being plugged in. In order to open the PDB without issue and be able to run APEX within the new PDB, you must install APEX into the originating database or PDB before attempting to plug in to the target database. You should install the same version of Oracle APEX into the originating database or PDB as the version installed into the target database.

5.4.5 Working with Incompatible Oracle APEX Versions

Learn how to work with the incompatible versions of Oracle APEX.

If the version of Oracle APEX in the root container, CDB$ROOT, is not the same as the Oracle APEX version in the PDB then an error is raised every time the PDB is opened preventing normal database operations within the PDB. The PDB can only be opened in restricted mode by users with RESTRICTED SESSION privilege, until the versions are compatible.

5.4.5.1 Patching or Upgrading Oracle APEX in a CDB

Learn how to patch or upgrade Oracle APEX in the root container.

If the version of Oracle APEX in the PDB is a later minor release version than the version of Oracle APEX in the root container (for example, the PDB contains Oracle APEX release 5.1.4 and the CDB contains Oracle APEX release 5.1.3) then you must patch the version of Oracle APEX in the root container to be able to open the PDB without error. If the major version of Oracle APEX in the PDB is higher than the version in the CDB (for example the PDB has Oracle APEX release 19.2 and the CDB has Oracle APEX release 18.1) then you must upgrade the version of Oracle APEX in the CDB to be able to open the PDB without error.

To patch Oracle APEX in the root container:

  1. Download the appropriate patch from My Oracle Support.
  2. Unzip and extract the installation files.
  3. Change your working directory to where the installation files were extracted
  4. Start SQL*Plus and connect to the database where Oracle APEX is installed as SYS specifying the SYSDBA role. For example:
    • On Windows:

      SYSTEM_DRIVE:\ sqlplus /nolog
      SQL> CONNECT SYS as SYSDBA
      Enter password: SYS_password
      
    • On UNIX and Linux:

      $ sqlplus /nolog
      SQL> CONNECT SYS as SYSDBA
      Enter password: SYS_password
      
  5. Run apxpatch_con.sql for example:
    @apxpatch_con.sql
    
  6. Follow the instructions outlined in the Patch Set Notes for updating the images directory.

5.4.5.2 Patching or Upgrading Oracle APEX in a PDB

Learn how to patch or upgrade Oracle APEX in a PDB.

If the minor version of Oracle APEX in the PDB is lower than the version of Oracle APEX in the root container (for example the PDB has APEX release 4.2.0 and the CDB has APEX release 4.2.6) then it will be necessary to patch the version of APEX in the PDB. If the major version of Oracle APEX in the PDB is lower than the version in the root container (for example, the PDB has APEX release 4.2 and the CDB has APEX release 19.2) then the version of APEX in the PDB will need to be upgraded.

5.4.5.2.1 Patching Oracle APEX in a PDB

Learn how to patch Oracle APEX in a PDB.

To patch Oracle APEX in a PDB:

  1. Download the appropriate patch from My Oracle Support.
  2. Unzip and extract the installation files.
  3. Change your working directory to where the installation files were extracted
  4. Start SQL*Plus and connect to the database where Oracle APEX is installed as SYS specifying the SYSDBA role. For example:
    • On Windows:

      SYSTEM_DRIVE:\ sqlplus /nolog
      SQL> CONNECT SYS as SYSDBA
      Enter password: SYS_password
      
    • On UNIX and Linux:

      $ sqlplus /nolog
      SQL> CONNECT SYS as SYSDBA
      Enter password: SYS_password
      
  5. Run apxpatch.sql using catcon.pl like the following example:
    host &OH_HOME/perl/bin/perl -I 
    
    &OH_HOME/rdbms/admin &OH_HOME/rdbms/admin/catcon.pl -b apxpatch -c '<PDB_name>'  apxpatch.sql  
    

    Where:

    • &OH_HOME represents the full path to the Oracle home

    • <PDB_name> is the name of the PDB you are patching

  6. Follow the instructions outlined in the patch set notes for updating the images directory.
5.4.5.2.2 Upgrading Oracle APEX in a PDB

Learn how to upgrade Oracle APEX in a PDB.

To upgrade Oracle APEX in a PDB:

  1. Unzip and extract the installation files.
  2. Change your working directory to where the installation files were extracted
  3. Start SQL*Plus and connect to the database where Oracle APEX is installed as SYS specifying the SYSDBA role. For example:
    • On Windows:

      SYSTEM_DRIVE:\ sqlplus /nolog
      SQL> CONNECT SYS as SYSDBA
      Enter password: SYS_password
      
    • On UNIX and Linux:

      $ sqlplus /nolog
      SQL> CONNECT SYS as SYSDBA
      Enter password: SYS_password
      
  4. Run apexins_nocdb.sql or apxrtins_nocdb.sql using catcon.pl like the following example:
    host &OH_HOME/perl/bin/perl -I 
    
    &OH_HOME/rdbms/admin &OH_HOME/rdbms/admin/catcon.pl -b apexins -c '<PDB_name>'  apexins_nocdb.sql --pSYSAUX --pSYSAUX --pTEMP --p/i/ --p1,2,3   
    

    Where:

    • &OH_HOME represents the full path to the Oracle home

    • <PDB_name> is the name of the PDB you are patching

  5. Follow the instructions outlined in the patch set notes for updating the images directory.