3.3 Plugging in a PDB When Application Express is Installed in the Root Container

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

This section describes scenarios in which the target database has Application Express 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 Application Express was configured in the originating database.

3.3.1 Scenario 1: Plug-in Non-CDB with Application Express

Plug-in a Non-CDB with Application Express.

If you are upgrading from a previous Oracle Database release, then you first need to upgrade to a Oracle Database 12c non-CDB (or standalone database) and then plug the database into your CDB. Alternatively, if you have configured a non-CDB Oracle Database 12c, you may now want to plug this database into a CDB. In both cases, the originating database has Application Express 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 Application Express.

After installing Application Express, you need to configure the Web listener for the PDB.

If the version of Application Express 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. .

3.3.2 Scenario 2: Plug-in PDB with a Common Application Express from Another CDB

Plug-in a PDB with Application Express from another CDB.

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

Assuming Application Express release 5.1 is installed, the APEX_050100 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 Application Express 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.

3.3.3 Scenario 3: Plug-in PDB with a Local Application Express from Another CDB

Plug-in a PDB with local Application Express from another CDB.

If you are copying or moving a PDB from an existing Oracle Database 12c where Application Express 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.

Assuming Application Express release 5.1 is installed, the APEX_050100 schema within the PDB being plugged in contains all of the Application Express 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 Application Express 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 Application Express 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.

3.3.4 Scenario 4: Plug-in Non-CDB or PDB with No Application Express

Plug-in a Non-CDB or PDB if the Application Express is not installed.

If you are plugging in a non-CDB, or copying or moving a PDB from another CDB, and Application Express is not installed in the originating database or PDB then a warning is raised in the alert log when opening the PDB in the target database.

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

3.3.5 Working with Incompatible Application Express Versions

Learn how to work with the incompatible versions of Application Express.

If the version of Application Express in the root container, CDB$ROOT, is not the same as the Application Express 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.

3.3.5.1 Patching or Upgrading Application Express in the CDB

Learn how to patch or upgrade Application Express in the root container.

If the version of Application Express in the PDB is a later minor release version than the version of Application Express in the root container (for example, the PDB contains Application Express release 4.2.6 and the CDB contains Application Express release 4.2.5) then you must patch the version of Application Express in the root container to be able to open the PDB without error. If the major version of Application Express in the PDB is higher than the version in the CDB (for example the PDB has Application Express release 5.1 and the CDB has Application Express release 4.2) then you must upgrade the version of Application Express in the CDB to be able to open the PDB without error.

To patch Application Express 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 Application Express 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 based on the Web Server you are using. If you are using the Embedded PL/SQL Gateway, run apxldimg_con.sql for example:
    @apxldimg_con.sql
    

Tip:

To upgrade Application Express in the root container, see Reinstalling Application Express into a CDB.

3.3.5.2 Patching or Upgrading Application Express in a PDB

Learn patch or upgrade Application Express in a PDB.

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

3.3.5.2.1 Patching Application Express in a PDB

Learn how to patch Application Express in a PDB.

To patch Application Express 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 Application Express 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 based on the Web Server you are using. If you are using the Embedded PL/SQL Gateway, run apex_epg_config.sql for example:
    ALTER SESSION SET CONTAINER = <PDB_name>;
    @apex_epg_config.sql
    

3.3.5.2.2 Upgrading Application Express in a PDB

Learn how to upgrade Application Express in a PDB.

To upgrade Application Express 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 Application Express 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 SYSAUX SYSAUX TEMP /i/ 
    

    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 based on the Web Server you are using.