When working with Oracle APEX, creating regular backups of your applications is a best practice that ensures your development work is protected. Whether you're preparing for a major update, safeguarding against accidental changes, or setting up version control, exporting your application provides a reliable way to preserve its current state. Oracle APEX makes this process straightforward with built-in tools that allow you to export your app as a SQL script, which can be stored, shared, or imported later as needed.
To back up an Oracle APEX application, follow these steps to export the application as a SQL script. This script contains the full definition of your app, including pages, logic, templates, and shared components. This file can be saved for versioning, restored in another workspace, or stored in source control.
-
Log into Oracle APEX
Navigate to your APEX workspace and sign in using your developer credentials. -
Go to App Builder
From the main APEX dashboard, click on App Builder and locate the application you want to back up. -
Open Export Options
Click the Export / Import button found in the App Builder toolbar.
If you're inside the application, you can also go to Utilities > Export/Import > Export Application. -
Choose Export Settings
On the Export Application page, you’ll see options:-
File Format: Choose
SQL
for a script-based backup (this is the most portable format). -
Export Options: Leave the default options selected unless you have specific needs (like excluding authentication schemes or feedback).
-
-
Generate Export File
Click Export. A.sql
file will be generated and downloaded to your local machine. This file can be stored in a safe location or added to your source control system. -
Optional – Automate with SQL Developer or Command Line
If you prefer automation or need regular backups:-
Use SQL Developer, connect to the workspace schema, and export via
APEX_EXPORT
package. -
Use SQLcl (Oracle's SQL command-line tool) with
apex export
commands.
-
-
Restoring Your Application
To restore or move the app:-
Go to App Builder > Import
-
Upload the
.sql
file and follow the wizard to re-create the application.
-
Backing up your APEX application is a crucial habit for safe development. It ensures that your work is protected, can be rolled back if needed, and allows for collaboration and versioning.
APEX allows you to export your application as a backup file, which you can later import if needed.
Best Practice: Schedule Frequent Backups
Regularly export APEX applications and store them securely.
Use versioned file names (e.g., app_100_backup_20240310.sql) for tracking.
Maintain daily, weekly, and monthly backups depending on update frequency.
HOW DO I Back Up An APEX Application – Example 1
Step 1: Exporting an APEX Application
Log into Oracle APEX and navigate to your workspace.
Go to App Builder and select the application you want to back up.
Click on Utilities > Export/Import > Export.
Under Export options:
Export Application Definition: Select this to back up the entire application.
Export Supporting Objects: Choose this if you also need related files.
Include Application Export Compatibility Mode (choose the latest APEX version).
Click Export and download the .sql file.
This file contains all components of your application and can be used to restore or move it to another instance.
Step 2: Importing a Backup to Restore an APEX Application
If you need to restore your application from a backup:
Go to App Builder > Import.
Select the previously exported .sql file.
Click Next, then select Install Application.
Choose Replace existing application if updating an app or Install as new application to create a separate copy.
Click Install to restore your application.
Export an APEX Application Manually
Go to APEX App Builder and open your application.
Navigate to Utilities > Export/Import > Export.
Choose Export Application Definition.
Select Export Supporting Objects (if applicable).
Click Export, then download and store the .sql file securely.
Automate Export Using SQL Command
For scheduling backups via SQL, use:
sql
Copy
BEGIN
APEX_EXPORT.GET_APPLICATION (
p_application_id => 100,
p_filename => 'app_100_backup.sql'
);
END;
This can be automated using Oracle Scheduler.
Oracle APEX Best Practices for Backing Up Applications
Best Practice: Schedule Frequent Backups
Regularly export APEX applications and store them securely.
Use versioned file names (e.g., app_100_backup_20240310.sql) for tracking.
Maintain daily, weekly, and monthly backups depending on update frequency.
Export an APEX Application Manually
Go to APEX App Builder and open your application.
Navigate to Utilities > Export/Import > Export.
Choose Export Application Definition.
Select Export Supporting Objects (if applicable).
Click Export, then download and store the .sql file securely.
Automated Export Using SQL Command
For scheduling backups via SQL, use:
BEGIN
APEX_EXPORT.GET_APPLICATION (
p_application_id => 100,
p_filename => 'app_100_backup.sql'
);
END;
This can be automated using Oracle Scheduler.
Backup the Entire APEX Workspace
Best Practice: Backup Everything, Not Just the App
While application backups include pages and logic, a full workspace backup includes:
Users & Authentication Settings
RESTful Web Services
Workspace-Level Configurations
How to Export an APEX Workspace
Go to APEX Administration.
Navigate to Manage Workspaces > Export Workspace.
Select the workspace and click Export.
Download the .sql file.
Backup the Underlying Database
Best Practice: Full Database Backup
Since APEX apps rely on Oracle Database objects (tables, views, packages, etc.), always back up the APEX schema and associated database objects.
Methods to Backup the Database
Using Oracle Data Pump (Preferred)
expdp username/password@db schemas=APEX_SCHEMA dumpfile=apex_backup.dmp logfile=apex_backup.log
This method captures all APEX-related tables, PL/SQL, and configurations.
Using RMAN (For Full Database Backup)
RMAN> BACKUP DATABASE FORMAT '/backup/apex_full_%U.bak';
This ensures a full database recovery in case of failure.
No comments:
Post a Comment