0

I would like to run a sqlcl command that exports every application and not just one.

Apex export # works just fine but if I try apex export -instance which is stated to "Export all applications", it says that Application export requires an application id(numeric).

Same error occurs when I try any other form of apex export instead of just the basic one.

Also, it seems that it doesn't export packages, tables, scripts, etc under SQL Workshop. Is there a different command I can use to do that?

My end goal is to import it all from a different workspace, in case that changes how I should import it.

J.H
  • 1
  • 1
  • 2

2 Answers2

1

It's possible to write scripts in sqlcl and invoke them using the SCRIPT keyword. Here is an example to export some apps from workspace 'TEST':

ctx.write("Export for apex apps\n\n");
ctx.write("start\n\n");

var binds = {};
var exportstmt;

var objects = util.executeReturnList(
  "SELECT application_id FROM apex_applications WHERE workspace = 'TEST' and rownum < 3"
    ,binds);
for (i = 0; i < objects.length; i++) {
    ctx.write( objects[i].APPLICATION_ID  + "\n");
    exportstmt =  'apex export ' + objects[i].APPLICATION_ID;
    ctx.write( exportstmt  + "\n");
    sqlcl.setStmt(exportstmt);
    sqlcl.run();
}
ctx.write("end\n\n");

Save the code above in a file (for example "export_apps.js") and invoke it in sqlcl with the command SCRIPT export_apps.js.

Koen Lostrie
  • 14,938
  • 2
  • 13
  • 19
-1
sql scott/tiger -- scott is the schema owner of apex workspace 
select to_char(workspace_id) from apex_workspaces where workspace = 'MYWORKSPACE'; -- the id will be used to export


apex export -workspaceid 1234567890 -- export all application in the workspace

https://docs.oracle.com/en/database/oracle/sql-developer-command-line/21.3/sqcug/working-sqlcl.html

https://docs.oracle.com/en/database/oracle/application-express/20.1/aeadm/exporting-from-a-command-line.html

zaki
  • 1