3.12.11.1.6 Exporting One or More Applications

Use SQLcl to export a single APEX application or all applications in a workspace.

3.12.11.1.6.1 Exporting an Application to a Single File

Export an APEX application to a single file.

To export an APEX application to a single file, use the apex export command and provide the application ID.

In this example, the application ID is 1234.

SQL> apex export -applicationid 1234

3.12.11.1.6.2 Exporting All Applications from a Workspace

Export all APEX applications in a workspace.

To export all applications in a workspace, use the apex export command and provide the workspace ID.

In this example, the workspace ID is 1908816359534887.

SQL> apex export -workspaceid 1908816359534887

Exporting Application 106:'Sample Interactive Grids'
Exporting Application 110:'Books with Tags'
Exporting Application 113:'List Examples'
Exporting Application 117:'HR App'

3.12.11.1.6.3 Exporting an Application Split into Multiple Files

Export an APEX APEX application as a directory which contains all the application components as separate files.

To export an application as a directory with each application component split into a separate file, use the apex export command and include the application ID and the -split option.

In this example, the application ID is 1234.

SQL> apex export -applicationid 1234 -split

The previous example would create the f1234 directory (in the current directory) containing the install.sql script and an application directory. This applcation directory contains all the application components organized into logical subdirectories. Each distinct component is exported to a separate file.

3.12.11.1.6.4 Why the Split Option is Preferable for Source Control

Learn about the advantages of using apex export with the -split option with source control.

Using apex export with -split option offers a more granular approach for exporting an application. This approach also makes source control change tracking tools more useful by enabling developers to see and review changes made to their application at the component level.

For example, suppose you add a new application feature on a new page (for example, page 11), modify the existing page 3, and modify an existing shared LOV named tags_lov. Exporting the application using the -split option enables your source control system to list the specific pages and LOV separately in its "what's changed?" report.

Then, suppose you are using the popular source control system Git. You could see what changes are pending using the git status command as shown in the the following example:

[./f1234]$ git status
On branch main
Changes to be committed:
        new file:   application/pages/page_00011.sql
        modified:   application/pages/page_00003.sql
        modified:   application/shared_components/user_interface/lovs/tags_lov.sql
        modified:   application/create_application.sql
        modified:   install.sql

Notice that the list of changed files indicates that page 11 was added, page 3 was modified, and the existing shared components LOV named tags_lov was also modified. Also notice that the install.sql file and create_application.sql file also were modified to reflect the addition of a new page to the application.

In contrast, if you export the application as a single file, the source control system can only list that one file as being modified, making it less clear what aspects of the application have changed. Similarly, reviewing changes made by colleagues becomes easier when you consider the changes in the context of a smaller amount of surrounding text and a meaningfully named subdirectory that explains the purpose of the file being reviewed.

3.12.11.1.6.5 Exporting Only Selected Application Components

Export some application components by specifically listing the components by type and ID.

You can perform a partial export of application components by specifically listing the component by type and ID.

The following example demonstrates how to list the components changed in application 1234 made on or after January 22, 2022 and then export only those components split into separate files using the -expComponents option.

SQL> apex export -applicationid 1234 -list -changesSince 2022-01-22
Date             ID                                      Name
---------------- --------------------------------------- -----------------------
2022-01-22 14:59 LOV:23618973754424510000                TAGS_LOV
2022-01-22 14:59 PAGE:3                                  3. Book
2022-01-22 15:00 PAGE:11                                 11. Library Search

SQL> apex export -applicationid 1234 -expComponents LOV:23618973754424510000 PAGE:3 PAGE:11
Exporting Application 1234

The previous example produces a single f1234.sql file containing only the necessary contents to install the three indicated components.

You can also use the -split option as shown in the following example:

SQL> apex export -applicationid 1234 -split -expComponents LOV:23618973754424510000 PAGE:3 PAGE:11
Exporting Application 1234

This produces the f1234 directory and just the necessary files to install these three components. Notice that in this example the main SQL script is named install_component.sql instead of install.sql.

[./f1234]$ find . | grep \.sql
./application/pages/page_00003.sql
./application/pages/page_00011.sql
./application/shared_components/user_interface/lovs/tags_lov.sql
./application/pages/delete_00003.sql
./application/pages/delete_00011.sql
./application/set_environment.sql
./application/end_environment.sql
./install_component.sql

3.12.11.1.6.6 Additional Options for Controlling APEX Application Export

Learn about additional apex export command options.

Use the following apex export command options to adjust what gets exported along with your application.

Table 3-6 apex export Command Options

Option Description

-expFiles

Export all workspace files identified by -workspaceid

-expType

Comma delimited list of export types: APPLICATION_SOURCE (default), READABLE_YAML, READABLE_JSON, EMBEDDED_CODE, CHECKSUM-SH1 or CHECKSUM-SH256

-skipExportDate

Exclude export date from application export files

-expPubReports

Export all user saved public interactive reports

-expSavedReports

Export all user saved interactive reports

-expIRNotif

Export all interactive report notifications

-expTranslations

Export the translation mappings and all text from the translation repository

-expOriginalIds

Export will emit IDs as they were when the application was imported

-expNoSubscriptions

Do not export references to subscribed components

-expComments

Export developer comments

-expSupportingObjects

Pass Y for yes, N for no, or the letter I to export and automatically install supporting objects on import

-dir

Save all files in the given directory, e.g. -dir some/sub/directory

-expComponents

Export application components. All remaining parameters must be of form TYPE:ID

-debug

Print debug output

-nochecksum

Overwrite existing files even if the contents have not changed

-split

Split applications into multiple files