Automating Backups
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Automating Backups

  1. #1
    Join Date
    Apr 2004
    Posts
    14

    Automating Backups

    I am taking the backups by using the following files:

    Parameter file

    Userid = 'test/test@test'
    File = d:\testbackup\exp_test.dmp
    Log = d:\testbackup\exp_test.log

    Batch File

    exp parfile=d:\testbackup\test.par

    I have automated the task using the Windows scheduler.

    When ever i take the backups it overwrites the previous backup file.

    Now can i modify my script so that i can include date in the filenames.

    Also can i keep the backup for say 3 days and then delete the same modifying the script.

    I am using Windows 2000 Advanced Server and Oracle 9i.

    Any suggestions for the same.

    Regards

    Pradipta

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,095
    exp/imp is not a viable backup methodology for a production database.
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Apr 2004
    Posts
    14
    Well i agree its not a viable method for taking backups of production databases.
    But is there anyway to modify my script.

    Regards

    Pradipta

  4. #4
    Join Date
    Jan 2001
    Posts
    3,131
    Well, you can but it is a little tricky. Here is an example of what we do here.

    First you need to schedule your export, no problem right?

    Next you will need another .CMD file scheduled to generate compression. Something like this...

    **********************************************************************
    REM the script is for generating script for compressing export backups

    sqlplus export/export @D:\export\hanky\gen_code.sql
    D:\export\hanky\compress_dump.cmd
    *********************************************************************
    The above is loggin into SQLPLUS and calling gen_code.sql first, that .SQL file would look like this.

    *********************************************************************
    set echo off
    set pagesize 0
    spool d:\export\hanky\compress_dump.cmd
    select 'cd D:\export\hanky' from dual;
    select 'zip d:\export\arch_export\DB_NAME_'||to_char(sysdate,'MMDDYYYY')||
    '_backup.zip d:\export\*.dmp' from dual;
    select 'copy d:\export\*.log d:\export\arch_export\bkup_'||to_char(sysdate,'MMDDYYYY')||
    '.log' from dual;
    spool off
    exit
    *********************************************************************
    Now this is assuming you have a D:\export directory that your scheduled export writes to. This is timestamping the next .CMD file which will grab/zip and relocate your .DMP and .LOG files.

    The first .CMD file is also calling "compress_dump.cmd" that file would look like this.

    **********************************************************************
    cd D:\export\hanky

    zip d:\export\arch_export\DB_NAME_06142004_backup.zip d:\export\*.dmp

    copy d:\export\*.log d:\export\arch_export\bkup_06142004.log
    ********************************************************************
    As you can see the date has been filled in from the first command file.
    I think you will also need to copy the winzip .EXE into the D:\export\hanky directory, it is called Zip.exe

    Remember the ZIP command is zipping TO dir ----> FROM dir.

    Confusing?

    MH
    I remember when this place was cool.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width