Oracle APEX Version control

I hear from many classic developers that APEX has a weakness of version control. Well, it depends how you see a version control. In side APEX installation, there a packaged application to zip your application and store it in the database as part of version controls.

I prefer to have this outside of APEX and to have the databaseĀ backed up as well as the application and versioned (in this case by time stamp).

I use linux, if you would like to have the same for window, let me know, I can create a bat file for you šŸ™‚

I have created a directory for APEX application and one for DB, this works with APEX 5.x.

Create a file and call itĀ appBackup.sh and put the below code to it. This exports the application just like you to inside APEX development environment.

#!/bin/sh

# Apex Install directory
APEX_HOME=/home/oracle/apex # Required Info
export APEX_HOME

BACKUP_DEST=/media/apexapp/ApexBackup/apex # APEX back up destinationĀ 
export BACKUP_DEST

ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1 # Oracle home
export ORACLE_HOME

# Export runs from here
cd $APEX_HOME/utilities

echo Running Export.......

JAVA_HOME=/home/oracle/app/oracle/product/12.1.0/dbhome_1/jdk/jre/bin
export JAVA_HOME

java oracle.apex.APEXExport -db localhost:1521/orcl -user <apexuser> -password <apexpwd> -applicationid 139

DATE=$(date +"%Y%m%d%H%M")

# Add timestamp to the application and move it the APEX folder
mv f139.sql $BACKUP_DEST/f139_$DATE.sql

echo removed
Create another file and call itĀ dbBackup.sh and add below to it. This exports the database parsing schema.
exp apexuser/apexpwd file=apexdmp.dmp

DATE=$(date +"%Y%m%d%H%M")

mv apexdmp.dmp db/apexdmp_$DATE.dmp

now create a shell file to run both together with versionAPEX.sh and put the below code to it.

sh appBackup.sh
sh dbBackup.sh

The apexuser is theĀ APPLICATION PARSING SCHEMA user.

Now every time you run versionAPEX.sh, you application is exported and backed up with data. you can revert anything anytime from your versioned app.

Notes: To keep the track on changes in the application, you should use the Comment property of the items/page.

Finally the APEX export a SQL file, it means you can use any software to compare the changes between versions.Ā