我想运行一个sqlcl命令,导出每个应用程序,而不仅仅是一个。
Apex export#工作得很好,但如果我尝试Apex export-instance;导出所有应用程序";,它说应用程序导出需要一个应用程序id(数字(。
当我尝试任何其他形式的顶点导出而不仅仅是基本的顶点导出时,也会出现同样的错误。
此外,它似乎不导出SQL Workshop下的包、表、脚本等。有什么不同的命令可以让我这么做吗?
我的最终目标是从不同的工作区导入所有内容,以防更改导入方式
可以在sqlcl中编写脚本,并使用SCRIPT
关键字调用它们。以下是从工作区"TEST"导出一些应用程序的示例:
ctx.write("Export for apex appsnn");
ctx.write("startnn");
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("endnn");
将上面的代码保存在一个文件中(例如"export_apps.js"(,并在sqlcl中使用命令SCRIPT export_apps.js
调用它。
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