Reputation: 825
I'm using Oracle 21C and APEX 24.1 I'm converting a DOS backup script from oracle.apex.APEXExport to SQL.EXE (SQLcl). I would like to call SQLcl for a single-use so that it will return to the DOS script after the single function is executed. In DOS, I used to use:
:; Export application 104 - The Library App.
java oracle.apex.APEXExport -db localhost:1521/xepdb1 -user %APEX_user% -password %db_password% -applicationid 104
:; Prepend the exported file with %FileCore%
REN f104.sql %App104%
I understand how to log in to SQLcl. I use:
C:\app\product\sqlcl\bin\sql jdbc:oracle:thin:SYSTEM/my_password@localhost/XEPDB1
Also, I understand how to backup a single application. I use:
apex export -Applicationid 104
My question is how can I login in to SQLcl, execute the export function, and then exit SQLcl so that control is returned to DOS? Thanks for looking at this.
ANSWER: With someone else's help, I found the solution. The "apex export" commands have to be placed in a sql file and then called from a DOS command file. My code ended up as: Backup.CMD:
C:\app\product\sqlcl\bin\sql jdbc:oracle:thin:%APEX_user%/%db_password%@localhost/XEPDB1 @C:\SS_Library_Backups\apex_backup.sql
apex_backup.sql
apex export -Applicationid 104
exit
I hope this helps someone with a similar question.
Upvotes: 0
Views: 28