Skip to Main Content

How use APEXExport command line utility on 10G XE database

In this example I did use 10g XE database installed on Debian Linux.
Steps should be the same in all Linux distributions.

In this guide we make assumptions:

  • You have privilege to use sudo.
  • You have upgraded APEX to version 3.2 or above.
  • ORACLE_HOME enviroment variable is set.
  • APEX install files zip is extracted to folder /tmp/

First give write permission to install files utility folder

sudo chmod a+w /tmp/apex/utilities

Next set Java CLASSPATH environment variable

export CLASSPATH=.:${ORACLE_HOME}/jdbc/lib/ojdbc14.jar

Change working directory

cd /tmp/apex/utilities

Then run APEXExport. Change user, password and application id accordingly

java oracle.apex.APEXExport -db localhost:1521:XE -user scott -password tiger -applicationid 31500

Now you can find application export file from /tmp/apex/utilities folder. File name is like f31500.sql, where 31500 is exported application id.

Read more about APEXExport options from readme.txt that you can find in installed files ../apex/utilities/ folder.

Check also John Scott great blog post about APEXExport utility Backing up your applications.

Comments

  • Jari Laine 6 Mar 2012

    Hi yannis_r,

    Instruction is for Linux and 10G XE database.

    Regards, Jari

  • yannis_r 6 Mar 2012
    Hi I tried it on a windows environment with XE11gR2 1. in the java lib directory I see r files: ojdbc5.jar ojdbc6.jar and ojdbc6_g.jar it failed and gere is the message: c:\apex\utilities>java oracle.apex.APEXExport -db localhost:1521:xe -user inv -password <PASS> -applicationid 104 Exporting application 104 Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 14: PLS-00306: wrong number or types of arguments in call to 'EXPORT_APPLICATION_TO_CLOB' ORA-06550: line 1, column 7: PL/SQL: Statement ignored     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:452)     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:400)     at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:884)     at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:471)     at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:199)     at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:535)     at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement. java:208)     at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableSta tement.java:1355)     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme nt.java:1709)     at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePrep aredStatement.java:4364)     at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat ement.java:4587)     at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStat ement.java:10100)     at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePrepa redStatementWrapper.java:5691)     at oracle.apex.APEXExport.ExportFile(APEXExport.java:336)     at oracle.apex.APEXExport.ExportFiles(APEXExport.java:162)     at oracle.apex.APEXExport.main(APEXExport.java:750) c:\apex\utilities> Any suggestions?
  • wattsup 27 Jan 2012

    I have created a workspace and schema from the admin instance.

    I tried SYS and SYSTEM but it sais invalid user/pass

    I would follow your instructions but I don't know what the correct sql commands are. I did find a solution though. I found other post saying to use the APEX_030500 user.

    I tried:

    ALTER USER APEX_030500 ACCOUNT UNLOCK;

    But it said user does not exist. Turns out that is the user for APEX 3.5. The user for APEX 4.1 is APEX_040100.

    So:

    ALTER USER APEX_040100 ACCOUNT UNLOCK;
    ALTER USER APEX_040100 IDENTIFIED BY password;
    

    Works! Now the APEXExport command completes. Thanks!

  • Jari Laine 25 Jan 2012

    Hi,

    OK. I assume you have then created workspace and schema from instance admin.

    You can

    1. Login to SQL*Plus as SYS and set schema password for schema that is assign to your workspace. Then use that schema and password in APEXExport.

    2. Create new schema to database. Grant APEX_INSTANCE_ADMIN role to schema.

    3. It might SYS or SYSTEM user works with APEXExport.

    Regards, Jari

  • wattsup 24 Jan 2012
    Thanks Jari, how do I determine the database user for my schema? I followed your guide "Installation of APEX 4.0 - TomCat - APEX Listener in Ubuntu 10.04" and never create any other users so I don't know what user/pass to use.
  • Jari Laine 24 Jan 2012

    Hi,

    User name for APEXExport  is database user not APEX user. Use application parsing schema name. APEX_PUBLIC_USER is database user, but it is used for DAD and have limited privileges and you can not use it for APEXExport.

    Regards, Jari

  • wattsup 23 Jan 2012

    Hi,

    APEXExport responds for me but always gives me "invalid username/password; logon denied" for any user/pass combination I can think of.

    Example:

    java oracle/apex/APEXExport -db localhost:1521:XE -user admin -password mypassword -workspaceid 1316703665945575

    It responds: Exception in thread "main" java.sql.SQLException: ORA-01017: invalid username/password; logon denied

    If I use:

    java oracle/apex/APEXExport -db localhost:1521:XE -user APEX_PUBLIC_USER -password oracle -workspaceid 1316703665945575

    It responds: Invalid Workspace ID '1316703665945575' for User 'APEX_PUBLIC_USER'

    Any suggestions?

    Thank you