Oracle APEX application and workspace backup script
Jump to navigation
Jump to search
###################################################################### # The export files will be automatically placed at the location of the APEX utility scripts # Use the scripts from the APEX download with same version of the APEX installation. If not, some java run errors may be experienced. export APEX_UTIL_HOME=/u01/scripts/APEX/utilities # Export the CLASSPATH export ORACLE_HOME=/u01/oracle/product/11.2.0/db_1 #export CLASSPATH=.:${ORACLE_HOME}/jdbc/lib/ojdbc6.jar export CLASSPATH=.:${ORACLE_HOME}/jdbc/lib/ojdbc5.jar # Setup environment variables export BACKUP_LOC=/u01/${ORACLE_SID}/APEX/backups export CURRDATE=`date '+%Y''%m''%d''%H''%M'` echo =========================================== | tee -a ${LOGFILE} echo Start APEX applications export at `date` | tee -a ${LOGFILE} DBHOST="host:port:SID" DBHOST="(description=(address=(host=dbhost)(protocol=tcp)(port=1521))(connect_data=(service_name=DBSRV)))" USR="APEX_040200" PASSW="PWD" # Perform exports cd ${APEX_UTIL_HOME} java oracle.apex.APEXExport -db ${DBHOST} -user ${USR} -password ${PASSW} -instance 2>&1 | tee -a ${LOGFILE} java oracle/apex/APEXExport -db ${DBHOST} -user ${USR} -password ${PASSW} -expWorkspace 2>&1 | tee -a ${LOGFILE} # Archive and zip all fxxx.sql files generated from the APEX export. echo Compressing all .sql files to ${BACKUP_LOC}/${CURRDATE}.tar.gz cd ${APEX_UTIL_HOME} tar cvf - ./*.sql | gzip -c > ${BACKUP_LOC}/${CURRDATE}.tar.gz # Remove all fxxx.sql files rm -rf ${APEX_UTIL_HOME}/*.sql echo End APEX applications export at `date` | tee -a ${LOGFILE}