# set CLASSPATH
CLASSPATH=.:../lib/ojdbc6.jar:/Users/daust/Downloads/KEEP/apex/apex_5.0.3/apex/utilities/:$CLASSPATH
export CLASSPATH

# set variables for database and user
DB=vm1:1521:xe
USER=SYSTEM
PWD=oracle1

# export application 102
java oracle.apex.APEXExport -db $DB -user $USER -password $PWD -applicationid 102
mv f102.sql ./export-files-ws-training	

# export ALL applications in the APEX instance (all workspaces)
#java oracle.apex.APEXExport -db $DB -user $USER -password $PWD -instance

# export ALL workspaces (because workspace-id was not set)
#java oracle.apex.APEXExport -db $DB -user $USER -password $PWD -expWorkspace

# export workspace
# determine workspace id with : 
# select workspace_id, workspace, schemas, applications, files from apex_workspaces;
# export Workspace Dummy: 51646466283622323

# full ws-export
WS_ID=51646466283622323
java oracle.apex.APEXExport -db $DB -user $USER -password $PWD -expWorkspace -workspaceId $WS_ID
mv w$WS_ID.sql ./export-files-ws-dummy/ws-dummy-full.sql

# minimal ws-export
WS_ID=51646466283622323
java oracle.apex.APEXExport -db $DB -user $USER -password $PWD -expWorkspace -workspaceId $WS_ID -expMinimal
mv w$WS_ID.sql ./export-files-ws-dummy/ws-dummy-minimal.sql

# export workspace files
# ws TRAINING: 2742320859472150
WS_ID=2742320859472150
java oracle.apex.APEXExport -db $DB -user $USER -password $PWD -workspaceId $WS_ID -expFiles
mv files_$WS_ID.sql ./export-files-ws-training/ws-files.sql


# export all workspace files
#java oracle.apex.APEXExport -db $DB -user $USER -password $PWD -expFiles -workspaceid 2031917327559678  
#java oracle.apex.APEXExport -db $DB -user $USER -password $PWD -expFiles -workspaceid 2541800981839247  

