Trying to create a script to export my apex application. Using sqlcl, you can do apex export 100
. Is there a way to do this using plain sql or pl/sql which are the ones that the Script Editor in Oracle Apex accepts?
I agree with the script part, but not (PL/)SQL - create an operating system batch script . I'm on MS Windows, here's an example of what you might do:
REM Go to UTILITIES directory of your Apex installation directory
D:
cd D:\apex_4.2_instalacija\utilities
REM List of all applications you'll be exporting
REM Predmeti
java oracle.apex.APEXExport -db db_orcl:1521:orcl -user pred -password urb9xyz -applicationid 126
REM Naljepnice
java oracle.apex.APEXExport -db db_orcl:1521:orcl -user naljep -password stiwzf -applicationid 139
REM -----------------------------
REM Oracle schema username/password,
REM not Apex developer's or workspace or ...
REM Today's date in YYYY_MM_DD format
for /F "tokens=1-4 delims=. " %%i in ('date /t') do set yyyy_mm_dd=%%l_%%k_%%j
REM ZIP filename: APEX_YYYY_MM_DD.ZIP
set ime_zipa=apex_%yyyy_mm_dd%.zip
REM ZIP all exported applications (i.e. .SQL files)
"C:\Program Files\7-Zip\7z" a -tzip %ime_zipa% D:\apex_backup\f*.sql
REM Keep the ZIP, delete SQL files
del f*.sql
That's contents of my my_apex_export.bat
file. Schedule it using "Task Scheduler"; I'm running it every day at 21:00 o'clock and keep daily exports since March 2012.
The solution in the answer by Littlefoot works perfect, but just wanted to add that this can also be achieved in sqlcl natively. Using the SCRIPT
command in sqlcl you can invoke a script written in nashhorn javascript code. Search google for "sqlcl scripting" for a ton of examples.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.