Operating System - HP-UX
1847156 Members
5948 Online
110263 Solutions
New Discussion

Re: Error message when using tar for online backup

 
SOLVED
Go to solution
Simon Qu
Frequent Advisor

Error message when using tar for online backup

I have a script to run online backup for our oracle8i databse on hp-ux 11i. The script looks like:
.
.
if (tar -cvhf /dev/rmt/0m `cat datafiles.lst`)
then
echo "Database successfully backed up!!!" >> online_backup.log
else
echo "Database backup failed." >> online_backup.log
fi

tar -tvf /dev/rmt/0m >> online_backup.log

When I check the log file, I see all datafiles on the list. It seems to me all files are backuped fine, but I also see the "Database backup failed" in the log file. Why?

I appreciate any responses.

Thanks.
12 REPLIES 12
Mark Grant
Honored Contributor

Re: Error message when using tar for online backup


There isn't anything I can see wrong with this but in this script, the file is always appended to, are you quite sure you're not just seeing previous failed runs?

Why do you have brackets around your first tar command?

Never preceed any demonstration with anything more predictive than "watch this"
Patrick Wallek
Honored Contributor

Re: Error message when using tar for online backup

My guess would be that your backup is erroring out somewhere. Do you see any errors anywhere? Are you sure it is not needing a 2nd tape?

I would consider trying something like:

tar -cvhf /dev/rmt/0m $(cat datafiles.lst) > backup.log 2>&1
if [ $? = 0 ]
then
echo "Database successfully backup up!"
else
echo "It wasn't"
fi

The tar statement will still do your backup, but it will send all of its output, both standard out and standard error, to the backup.log file so you can see if you are getting any errors.
Sundar_7
Honored Contributor

Re: Error message when using tar for online backup


Would that be a better idea to check only the return value of tar ?

tar -cvhf /dev/rmt/0m `cat datafiles.lst` 1>/tmp/out 2>&1

if [[ $? -ne 0 ]]
then
echo "Database backup failed." >> online_backup.log
else
echo "Database successfully backed up!!!" >> online_backup.log
fi



Learn What to do ,How to do and more importantly When to do ?
Vitek Pepas
Valued Contributor

Re: Error message when using tar for online backup

Man page for tar does not mention returned values, so I don't think you can rely on them in 'if' statement.
Vitek Pepas
Valued Contributor

Re: Error message when using tar for online backup

Actually, I'm sure you can't rely on the value returned by tar. I had the same problem some time ago. I was running HP-UX 10.20 then, but it may be the same in 11.x.
I solved the problem by switching to fbackup.
Simon Qu
Frequent Advisor

Re: Error message when using tar for online backup

Thank you all.
I used the same script on hp-ux10.20 and it worked fine. Now we just moved to hp-ux11i. Does the "tar" have something specail on 11i ?
GK_5
Regular Advisor

Re: Error message when using tar for online backup

Try just running command tar -cvhf /dev/rmt/0m $(cat datafiles.lst) > backup.log 2>&1
And see if it works. Tar does return code 0 for successful command on 11i as well.

-GK-
IT is great!
Simon Qu
Frequent Advisor

Re: Error message when using tar for online backup

I got an error like this:
tar: Size of /db01/oracle/vis_sales_01.dbf > 2GB. Not dumped.

This datafile is greater than 2GB. Is there a way to backup this much big file?

Thanks.
Chris Vail
Honored Contributor

Re: Error message when using tar for online backup

If your data file is larger than 2 GB, the HPUX's standard tar command will barf and die. You can use the gnu version of tar and go up to 4GB (it may be 8GB now). You can't use the default version of gzip either, for the same reason. You can get a better version of either command from www.gnu.org.


Chris
Patrick Wallek
Honored Contributor
Solution

Re: Error message when using tar for online backup

Ahhh...Now we get to the real problem.

The native HP-UX tar can *NOT* handle large files (ie. larger than 2GB). There is a patch available for HP-UX 11i that will allow it to archive files up to 8GB.

NOTE -- If you install this patch then your tar archive will *ONLY* work on other HP-UX machines with this patch applied.

The patch you need to get this to work is PHCO_28992.
http://www1.itrc.hp.com/service/patch/patchDetail.do?patchid=PHCO_28992&context=hpux:800:11:11
Simon Qu
Frequent Advisor

Re: Error message when using tar for online backup

Thank all you guys.
I installed the patch Partick recommended. It worked fine.
Alzhy
Honored Contributor

Re: Error message when using tar for online backup

Simon,

Someday you will encounter files greater than 8GB.. I suggest you start using GNU tar which addresses some of the limitations of most Unix's bundled tar... Did you know that even Veritas uses it (GnuTar) in its NetBackup product?

Hakuna Matata.