- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Automate database backup procedure
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 07:09 PM
07-23-2003 07:09 PM
Automate database backup procedure
I want to automate the database backup procedure which auto run the backup script (Attached in the email) in the evening (I guess put it in the crontab). However, I concern that some problems may occur during the backup procedure:
- forget to put backup tape in DD3 tape drive
- Backup tape error
- Backup tape full
- Tape drive error
- System error
I am just a beginner writing unix script. Could you tell me how I can keep the different problems to different logs in the backup script and how can I know the problem occur immediately when I am at home? (For like Mobile phone, SMS, etc)
Also, the Day-end process has another script (For like startup databases after Database backup, etc) after the Database backup script, how can I handle the backup script if any problem happens?
Please give me some ideas. Thanks a lot.
Best Regards
Ajk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 07:16 PM
07-23-2003 07:16 PM
Re: Automate database backup procedure
Check the success of an operation right after you do it.
rc=$?
if [ $rc gt 0 ] then
mailx -s "Tape write failed...."
exit $rc
fi
Run your job in cron as follows:
at 10:05 p.m. monday thru fruday
5 20 * * * 1-5 su - oracle -c "backup command" 2>&1 | mailx -s "Oracle nightly backup" yourname@yourdomain.com
The key factor is to check for errors and take appropriate action. I can help you with the script. I work for points.
I even work in real time for bucks, but honestly I think you can handle it.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 07:23 PM
07-23-2003 07:23 PM
Re: Automate database backup procedure
Thanks.
Best Regards
Ajk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 07:29 PM
07-23-2003 07:29 PM
Re: Automate database backup procedure
There are various techique expert people do the check the tape.Simple guy like me I used simpler method :
mt -t /dev/rmt/0mn rew
to check whether the tape are loaded or not.
or simple check on whether tape are ok or not ,try to write something to tape :
fbackup ....
and check whether the command are successful with $?.
I agree with SEP , you can do it..
regards
mB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 07:56 PM
07-23-2003 07:56 PM
Re: Automate database backup procedure
I haven't noticed Michael Tully on the forums today, so I'll attach a link where he provides a backup script that may give you a few ideas!
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1d550ea029a2d711abdc0090277a778c,00.html
SEP & Twang have given you some good ideas. My advice for writing scripts is to keep everything seperated in functions as far as is possible.
For example you could have seperate functions to
1. Check the Tape (eg check its in the drive & writeable)
2. Check Oracle is down or in Hot backup prior to backup.
3. Perform the backup.
4. Check the logs after backup.
Cheers
Con
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 08:18 PM
07-23-2003 08:18 PM
Re: Automate database backup procedure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 11:55 PM
07-23-2003 11:55 PM
Re: Automate database backup procedure
Best Regards
Ajk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2003 11:57 PM
07-23-2003 11:57 PM
Re: Automate database backup procedure
STAT=`mt -f /dev/rmt/0m stat |awk '$4 == "online" {print 1}'`
if [ STAT -eq 1 ]
then
you can add the lines for backup
fi
for checking whether the backup was successfull
use the following
if [ $? -eq 0 ]
then
echo "backup completed " |tee -a $LOG_FILE
echo "Ejecting the media....."
sleep 10
mt -f $DEV offl #for ejecting media.
else
echo "Error during backup.."| tee -a $LOG_FILE
fi
You can send all the logs to a log file and then send that file as a mail.
make sure that sendmail is configured and running in your system.
-Rajesh