4 Replies Latest reply on Mar 15, 2012 8:46 AM by Sashio

    how to take back up in apex

      i have done a lot of changes in my application and i really need to take the back up.
      please help me out with this.

        • 1. Re: how to take back up in apex
          Export it (there's an "Export" button in Application Builder).

          The result is "fxxx.sql" file (where "xxx" represent application number); store it somewhere safe.

          If you want to export your application(s) regularly, you could utilize APEXExport which is ran from the operating system command prompt. It is rather easy to create a batch file you'd schedule with your operating system's scheduling utility. I do that (on MS Windows) and, if you are interested, I can share it.
          • 2. Re: how to take back up in apex
            yes it sounds interesting and easy, please share it.
            • 3. Re: how to take back up in apex
              There are also options to automate from the db

              • 4. Re: how to take back up in apex
                OK then, here you are.

                I'm keeping backup files in "D:\APEX|Apex_backup" directory. The way I chose is the following: I'm keeping daily applications' versions, and only the newest database export version (how come? Because I'm exporting only users I use in my applications. The whole database's daily exports are created elsewhere, stored onto tapes, etc. I'm keeping this "just in case" and, probably, it grows up - then I'll discard it).

                In order for APEXExport to work, you must be in Apex' UTILITIES directory (that's why I copy files from \utilities to \apex_backup).

                Application backup file format is (for example, for application 163): f163_YYYY_MM_DD.sql. By applying date to the file name, I'm rather sure that the newest file won't overwrite previous ones. Note that you might have to tweak date format, if it is different than mine.

                Finally, in order to preserve some space, I ZIP these files (using 7-zip).

                Here's the script:
                REM APEX export ---------------------------------------------------------------
                cd D:\APEX\APEX41\apex\utilities
                java oracle.apex.APEXExport -db localhost:1521:ora11 -user system -password pw -instance
                copy f????.sql D:\APEX\Apex_backup\f????_%date:~10,4%_%date:~7,2%_%date:~4,2%.sql
                del f????.sql
                cd D:\APEX\Apex_backup
                REM Schemas export ------------------------------------------------------------
                REM Today 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 file name: APEX_YYYY_MM_DD.ZIP
                set ime_zipa=apex_%yyyy_mm_dd%.zip
                expdp un/pw@ora11 directory=expdp_dir_apex dumpfile=apex_%yyyy_mm_dd%.dmp schemas=my_schema1,my_schema2,my_schema3 logfile=apex_export.log
                REM ZIP! ----------------------------------------------------------------------
                "C:\Program Files\7-Zip\7z" a -tzip %ime_zipa% d:\apex\apex_backup\f*%yyyy_mm_dd%*.sql apex_%yyyy_mm_dd%.dmp
                REM Delete export files (but keep the zipped file)
                del f*%yyyy_mm_dd%*.sql
                del apex_%yyyy_mm_dd%.dmp
                Finally, a batch file that calls the previous one (this one is scheduled with Task Scheduler). I'm sending myself log files (so that I know the result). I use a tiny BMAIL program to do that (unnecessary, really; you can use any other mailing utility, if you wish).
                @echo off
                cd d:\apex\apex_backup
                call apex_script_7z.bat > apex_backup.log
                bmail -s <info removed> -a "Apex Backup Log" -m apex_backup.log -c
                bmail -s <info removed> -a "Apex Backup Export Log - export log" -m apex_export.log -c