Anonymous
Anonymous

Reputation: 35

How to export files from Oracle Apex workspace using command line?

One simpler way is:

Go to https://apex.oraclecorp.com then login into the workspace using credentials.After that click on SQL scripts and proceed to download or export the SQL's.

But is there any way by which we can directly export/download all the sql files via command line ?

Upvotes: 1

Views: 2684

Answers (1)

Dominik
Dominik

Reputation: 1032

You can quickly export Apex applications through the command line, avoiding the Apex UI completely. To do this, Oracle has provided two java classes, which are included in the Apex download:

  • APEXExport.class
  • APEXExportSplitter.class

These classes are located in the apex/utilities/oracle/apex directory.

Before using these classes, you have to make sure that the following environment variables are set up correctly:

ORACLE_HOME should point to just that. Something like:

/u01/app/oracle11g/product/11.2.0/db1

APEX_HOME should point to the directory where you unzipped the Apex download. For example

/u01/downloads/apex

PATH needs to include $ORACLE_HOME/jdk/bin

CLASSPATH needs to include:

  • $ORACLE_HOME/jdbc/lib/ojdbc5.jar
  • $APEX_HOME/utilities

Note: You may also have to include the . path.

APEXExport

To execute the export use

$ java oracle.apex.APEXExport

You can get a list of the available arguments by executing the above command without arguments. For a basic application export use:

$ java oracle.apex.APEXExport -db localhost:1521:db1 -user scott -password tiger -applicationid 100

You’ll get a message saying: Exporting application 100.

Once the export is done you’ll see an *sql file in your current directory (e.g. f100.sql).

APEXExportSplitter

You can now take the export file and split it up into its various components. This is handy if, for example, you want to examine the SQL of an application page or two.

$ java oracle.apex.APEXExportSplitter f100.sql

This program creates a directory named after your application (e.g. f100) and multiple sub directories which contain the various components of the application.

Upvotes: 1

Related Questions