DBAsupport.com Forums - Powered by vBulletin
Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Automating Backup

  1. #1
    Join Date
    Dec 2000
    Posts
    255
    Hi All

    I have written shell script which backs up the entire DB and checks the document in CVS (I used export). I run this script on Friday evening. Now I want to automate this backup task. How should I go ahead. Which utility I must use now. I have oracle 8i and Linux RH 6.2. I heard it can done using crontab or cron but don't know how to use it. The man page on cron also tells only description.

    Amol

  2. #2
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Hi,
    man crontab says more. I think there are examples as well.
    Ales

  3. #3
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    Originally Posted By: amolik
    I have written shell script which backs up the entire DB and checks the document in CVS (I used export).
    Again EXPORT is not a backup solution.
    In unix you can schedule the job using cron.
    man crontab will give you all the information.

    Sanjay

  4. #4
    Hi,

    Here the simple example that you can use in cron job:

    30 00 * * 1-6 /usr/backup > /dev/null 2>&1

    the syntax as follow:

    "minute" "hour" "dayofmonth" "monthofyear" "dayofweek" "fullpathscript"

    It will send email when it finish but if don't want to receive any error message from cronjob you could redirect to /dev/null as in example above.

    Hope this will help you.

    regards,
    feroz

  5. #5
    Join Date
    Dec 2000
    Posts
    255
    From the man page I have understood that I have to execute c'crontab -e' command and add a command linr to that.

    I have my script 'backup.sh' stored in /usr/local/localamol/bin/ and It stores the backup (.dmp file) in appropriate directory but I am not getting syntax correctly here. How should I place command line and the timer. I am trying like below.
    $crontab -e command="/usr/local/localamol/bin/backup.sh"

    Amol

  6. #6
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    You have to execute the crontab -e first. This invokes the editor and opens the file with scheduled jobs. Here write the line for your job, e.g. for executing the backup on Fridays, 20:30:
    Code:
    30 20 * * 5 /usr/local/localamol/bin/backup.sh
    Then save it.
    with crontab -l you can see the list of sheduled jobs.
    Check if you need any environment variables set. You have to set them in the backup.sh script or execute your profile to set them before executing backup.sh.

    This works in Solaris and AIX, no clue about RH.

    Ales

  7. #7
    Hi,

    It should works for RH as well. Let us know how are you getting on.

    regards,
    feroz

  8. #8
    Join Date
    Dec 2000
    Posts
    255
    Hi all

    I have entered crontab job as with following details

    30 20 * * 5 /usr/local/localamol/bin/backup.sh

    And now after saying $crontab -l. I get the following message.

    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/crontab.1021 installed on Mon Jun 17 10:28:39 2002)
    # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
    30 20 * * 5 /usr/local/localamol/bin/backup.sh

    Is there any way where in I can know that at what time this job will executed?

  9. #9
    Join Date
    Dec 2000
    Posts
    255
    At least Can I know meaning of this

    30 20 * * 5

    where I guess 30 is for days of month and 5 may be fifth day. But what is meant by 20 * * ? And why the order is like that what does that mean?

    Amol

  10. #10
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    man crontab
    Jeff Hunter

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