Find the answer to your Linux question:
Results 1 to 2 of 2
Help!!!! Ok, so here is the situation, we recently moved an Oracle 10g database off of our PowerSystem (AS/400) to an OEL box running on top of Oracle VM. Now ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    2

    Help with back job running in cron


    Help!!!!

    Ok, so here is the situation, we recently moved an Oracle 10g database off of our PowerSystem (AS/400) to an OEL box running on top of Oracle VM. Now when this was running on the PowerSystem, the Linux partition would be shutdown, and the flat "LUN" file would be backed up with the rest of the IFS data on the box. Now, we need to back this up on it's own, and I really don't want to use an agent based backup solution with a backup provider. Ideally I would do this backup from the OracleVM box itself as the image files (obviously the system would be shutdown for this), but am having difficulties finding the command line options I would need to clone the box, start it back up, and then backup the cloned disk files. Ah, how I wish Veeam supported OracleVM... Anyhow, this is an easy enough process to do manually, but since I don't want to have to give up part of my Sat. night to do it...

    The applications team still shuts down the Oracle database during the AS/400 backup, not sure why, but they want to do that for some reason. Ok, so this gives me a window to do a tar on the box and write the backup to a network share for off loading to tape. Great! I can run the backup no problem manually, and wrote a script to run it as well. (see below for script) Running the script manually works like a dream; however, when it is triggered from cron, it only writes 1mb to the tar file and completes. I'm sure this is going to be a simple one, I just can't seem to nail it down. This job only runs once per week, or on demand if there are any system changes. Oracle dumps capture the database data on a nightly basis.

    Crontab entry -
    Code:
    30 18 * * 6 root /etc/cron.tarbackup/bkup_ilwdgdb03.sh
    Script -
    Code:
    # Backup ILWDGDB03
    
    # Test to insure volume is mounted.
    if grep -qs '/mnt/bkup' /proc/mounts; then
      echo "Volume is already mounted." > volMounted.txt
    else
      mount -t cifs //###.###.###.###/LinuxBackup /mnt/bkup -o username=####,password=####,domain=####
      echo "Volume had to be mounted." > volMounted.txt
    fi
    
    # Change to backup directory
    cd /mnt/bkup/ilwdgdb03_bkup
    
    # Remove start/stop files for determining backup
    # duration.
    rm -f ilwdgdb03_start.txt
    rm -f ilwdgdb03_end.txt
    
    # Remove existing backup file.
    rm -f bkup_ilwdgdb03.tgz
    
    # Remove backup log file.
    # commented out 2/28/2012 saw - rm -f bkup_ilwdgdb3.log     --Removed due to date/time stamping the log.
    
    # Create file to show backup start time.
    touch ilwdgdb03_start.txt
    
    # Run backup
    #   c - Create tar file
    #   z - GZip the data
    #   p - Preserve permissions
    #   v - Verbose output
    #   exclude - folders to be excluded from backup.
    #   2> - Ouput errors to log file.
    tar -czpvf /mnt/bkup/ilwdgdb03_bkup/bkup_ilwdgdb03.tgz --exclude=proc --exclude=mnt --exclude=dev --exclude=tmp --exclude=sys --exclude=u01old --exclude=u01tmp --exclude=lost+found / 2>/mnt/bkup/ilwdgdb03_bkup/bkup_ilwdgdb03_`date +%Y%m%d`.log
    
    # Create file to show backup end time.
    touch ilwdgdb03_end.txt

  2. #2
    Just Joined!
    Join Date
    Jun 2007
    Posts
    17
    two things I would do: 1) add appropriate bash header line at top of script 2) put full path of tar command

Posting Permissions

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