Search This Blog

Tuesday, July 1, 2025

Oracle APEX Backup

 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.

  1. Log into Oracle APEX
    Navigate to your APEX workspace and sign in using your developer credentials.

  2. Go to App Builder
    From the main APEX dashboard, click on App Builder and locate the application you want to back up.

  3. 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.

  4. 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).

  5. 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.

  6. 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.

  7. 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

  1. Log into Oracle APEX and navigate to your workspace.

  2. Go to App Builder and select the application you want to back up.

  3. Click on Utilities > Export/Import > Export.

  4. 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).

  5. 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:

  1. Go to App Builder > Import.

  2. Select the previously exported .sql file.

  3. Click Next, then select Install Application.

  4. Choose Replace existing application if updating an app or Install as new application to create a separate copy.

  5. Click Install to restore your application.

Export an APEX Application Manually

  1. Go to APEX App Builder and open your application.

  2. Navigate to Utilities > Export/Import > Export.

  3. Choose Export Application Definition.

  4. Select Export Supporting Objects (if applicable).

  5. 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

  1. Go to APEX App Builder and open your application.

  2. Navigate to Utilities > Export/Import > Export.

  3. Choose Export Application Definition.

  4. Select Export Supporting Objects (if applicable).

  5. 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

  1. Go to APEX Administration.

  2. Navigate to Manage Workspaces > Export Workspace.

  3. Select the workspace and click Export.

  4. 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

  1. Using Oracle Data Pump (Preferred)

  2. 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.

  1. Using RMAN (For Full Database Backup)

  2. RMAN> BACKUP DATABASE FORMAT '/backup/apex_full_%U.bak';

This ensures a full database recovery in case of failure.


Backing up your Oracle APEX application is a quick yet vital task that supports stability, collaboration, and recovery. By regularly exporting your application and maintaining a secure archive, you reduce the risk of data loss and ensure that your project can always be restored or transferred when necessary.

No comments:

Post a Comment

How Do I Make a Faceted Search Map Page in Oracle APEX

Combining faceted search with a map region in Oracle APEX enables users to filter data visually and spatially at the same time. This design ...