DBA Hub

📋Steps in this guide1/3

Multitenant : Remove APEX Installations from the CDB in Oracle Database 12c Release 1 (12.1)

This article describes how to remove APEX from the CDB so you can install it directly in a PDB.

oracle 12cconfigurationintermediate
by OracleDba
16 views
1

12cR2 Update

From Oracle Database 12c Release 2 (12.2) onward APEX is not installed by default, so you no longer need to worry about uninstalling APEX before creating PDBs. The software is still shipped with the database ($ORACLE_HOME/apex), but not installed. In Oracle 12.2 you should always do the following. - Download the latest version of APEX ( here ), rather than using the version shipped with the database. - Install APEX locally in a PDB, rather than in the root container. You should not install APEX in the root container in Oracle 12.2.
2

Uninstall APEX from the Container Database (CDB)

Remember, you should only perform this on a CDB with no PDBs, so either drop existing PDBs, or unplug the PDBs and move them to another container before starting. Navigate to the "$ORACLE_HOME/apex" directory and connect to the root container. If you are using the default APEX shipped with the database run the "apxremov_con.sql" script to remove APEX from the CDB. If you are using a later version of APEX you should use the "apxremov.sql" script.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$ export ORACLE_SID=cdb1
$ cd $ORACLE_HOME/apex
$ sqlplus / as sysdba

SQL> [email protected]  --Later release of APEX.

SQL> @apxremov_con.sql

PL/SQL procedure successfully completed.

Performing installation in multitenant container database in the background.
The installation progress is spooled into apxremov*_con*.log files.

Please wait...

catcon: ALL catcon-related output will be written to apxremov1_con_catcon_22354.lst
catcon: See apxremov1_con*.log files for output generated by scripts
catcon: See apxremov1_con_*.lst files for spool files, if any
catcon.pl: completed successfully

catcon: ALL catcon-related output will be written to apxremov2_con_catcon_22436.lst
catcon: See apxremov2_con*.log files for output generated by scripts
catcon: See apxremov2_con_*.lst files for spool files, if any
catcon.pl: completed successfully


Installation completed. Log files for each container can be found in:

apxremov*_con*.log

You can quickly scan for ORA errors or compilation errors by using a utility
like grep:

grep ORA- *.log
grep PLS- *.log

SQL>
3

Install APEX into a Pluggable Database (PDB)

With APEX removed from the CDB, we are free to perform full APEX installations in each PDB. The installation process is almost the same as for previous database versions, but you must remember to connect to the PDB to perform the installation. The example below is a summary based on a more detailed APEX installation article here . This example does not cover all APEX installation options! Connect to the root container, create a new pluggable database and add a tablespace for the APEX components. Change directory to the directory holding the unzipped APEX software. All actions from this point are performed within the PDB. I've added a new connection for each command as a reminder, but this is not necessary. All the following actions can be performed in the same session. Connect to SQL*Plus as the SYS user and run the "apexins.sql" script, specifying the relevant tablespace names and image URL. Remember, you must connect to the specific PDB, not the CDB. Once complete, change the admin password by running the "apxchpwd.sql" scripts as the SYS user. Create the and users by running the "apex_rest_config.sql" script. Make sure the account is unlocked. If you are planning to use the Embedded PL/SQL Gateway (EPG), you will have to set it up, as described here . For more information see: Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
CONN / AS SYSDBA

CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdb_adm IDENTIFIED BY Password1;
ALTER PLUGGABLE DATABASE pdb1 OPEN;
ALTER PLUGGABLE DATABASE pdb1 SAVE STATE;

-- Switch to the new PDB.
ALTER SESSION SET CONTAINER=pdb1;

-- For Oracle Managed Files (OMF).
CREATE TABLESPACE apex DATAFILE SIZE 100M AUTOEXTEND ON NEXT 1M;

-- For non-OMF.
CREATE TABLESPACE apex DATAFILE '/path/to/datafiles/apex01.dbf' SIZE 100M AUTOEXTEND ON NEXT 1M;

$ cd /home/oracle/apex

CONN / AS SYSDBA
ALTER SESSION SET CONTAINER=pdb1;

-- @apexins.sql tablespace_apex tablespace_files tablespace_temp images

@apexins.sql APEX APEX TEMP /i/

CONN / AS SYSDBA
ALTER SESSION SET CONTAINER=pdb1;

@apxchpwd.sql

CONN / AS SYSDBA
ALTER SESSION SET CONTAINER=pdb1;

@apex_rest_config.sql

CONN / AS SYSDBA
ALTER SESSION SET CONTAINER=pdb1;

ALTER USER APEX_PUBLIC_USER IDENTIFIED BY Password1 ACCOUNT UNLOCK;

Comments (0)

Please to add comments

No comments yet. Be the first to comment!