- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Databse backup automated through Crontab
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
Discussions
Discussions
Discussions
Forums
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
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
тАО09-22-2005 04:09 PM
тАО09-22-2005 04:09 PM
I want to make this automated using the crontab, but i'm not sure how to create a script to run this databse backup daily through crontab.
Can someone assist me on how to create this script???
pleaseeee.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 04:30 PM
тАО09-22-2005 04:30 PM
Re: Databse backup automated through Crontab
Put all your database related commands in
# crontab -e
# Will execute the
15 1 * * *
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 04:33 PM
тАО09-22-2005 04:33 PM
Re: Databse backup automated through Crontab
logged in as root, run
crontab -e
and add this line
00 02 * * * /oracle/backup_database.sh
and save and exit.
this line will let your system run the /oracle/backup_database.sh script every day at 2:00 AM in the morning.
the hard part of the question answer is what will be inside the /oracle/backup_database.sh script ?
The answer is : it all depends. Depends on what ? Well, first it depends on how your database container(s) are structured ? Is it a filesystem structure or raw disk ? Do you have any backup software to use (like veritas netbackup or HP Data Protector) ? Or you would like to use fbackup ?
If you can tell more details, I am sure you will get better tailored answers.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 06:02 PM
тАО09-22-2005 06:02 PM
Re: Databse backup automated through Crontab
Can you tell us what your environment looks like (Unix version, Database software and version)?
Cheers,
Renarios
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 06:06 PM
тАО09-22-2005 06:06 PM
Re: Databse backup automated through Crontab
Make a script to use configuration for database name, date of backup. Based on that backup, you can start executing backup script with cron tab.
First create your user configuration file that will get user entry for data. Read that configuration file from your script as,
.
in the backup script. Execute cron based on your need.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 06:52 PM
тАО09-22-2005 06:52 PM
Re: Databse backup automated through Crontab
According to Mel's solution,yes I know that the command for crontab is crontab -e.
What I don't know is what to put in the /oracle/backup_database.sh script .
Information about my system:-
-It is a Unix server
-Oracle database
-I log in into the server
-I come to a page where I have a few options
-From the options I choose database backup
-A user prompt comes out asking me what is the database name for backup....so I key in the database name
-Another user prompt comes out asking me for table name for backup...so I key in table name
-Backup will be in process...and is stored in a directory cd /u01/backup/exp
I don't know how to create the script...
Please help...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 08:00 PM
тАО09-22-2005 08:00 PM
Re: Databse backup automated through Crontab
Since you are running Oracle Database, you should be using RMAN for backup. This is the easiest way.
see the url below on how you would go about configuring rman (if you have not already done so, of course):
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96566/toc.htm
the rest is to create the script to do the backup then schedule the script as described above.
if you need any further help, do let us know.
regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 08:54 PM
тАО09-22-2005 08:54 PM
Re: Databse backup automated through Crontab
a typical backup script for your full database backup would be:
#!/bin/sh
##############################################################################
#Script name: rman_full.sh
#Description: RMAN full backup script
#last Modified: Yogeeraj-10/01/2003
##############################################################################
messagelog="/backup/rman/logfiles/rman_full-`date +%d%m%y-%H%M`"
rman target xxx/xxx@mydb rcvcat rman/rman@catalog msglog $message
log </dev/null
run {
allocate channel fs1 type disk format '/backup/rman/full/fs1/df_%u_%s_$t.%p';
allocate channel fs2 type disk format '/backup/rman/full/fs2/df_%u_%s_$t.%p';
set limit channel fs1 kbytes=750000;
set limit channel fs2 kbytes=750000;
#Backup the whole database
backup
tag Whole_database_hot
database;
#Switch out of the current logfile
sql 'alter system archive log current';
#Backup the archived logs
backup
archivelog all
format '/backup/rman/full/fs1/al_%u.%p';
#Backup a copy of the controlfile that contains records for the
#other backups just made
backup
current controlfile
tag = cf1
format '/backup/rman/full/fs1/cf_%u.%p';
}
exit;
EOF
#end of script
hope this helps too!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 09:02 PM
тАО09-22-2005 09:02 PM
Re: Databse backup automated through Crontab
sorry for the corrupted output!
script attached.
let us know it it helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 09:46 PM
тАО09-22-2005 09:46 PM
Re: Databse backup automated through Crontab
I am actually only doing a backup on a table in a database.So, i'm not sure if using the option "full databse" in RMAN will be a good choice....Can you let me know of that...
The script you sent me..I don't entirely understand it...is there any simpler code or something...
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 10:22 PM
тАО09-22-2005 10:22 PM
Re: Databse backup automated through Crontab
If you have Oracle backup scripts already , then you need to schedule it with crontab , to make it automated backup , and also to decide what kind of backup you want , hotbackup or a cold backup.
For cold backup you need to shutdown oracle and those scripts also need to put in crontab .
[ To start a oracle backup at 8 pm everyday , need to add in cron as follows:]
# crontab -e
00 20 * * * su - oracle -c /oracle_home/yourbkup.script
To check and verify crontab entry :
# crontab -l
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2005 03:37 PM
тАО09-23-2005 03:37 PM
Re: Databse backup automated through Crontab
The specification of my system, I have already mentioned in my previous post.
It is the script that i'm not sure of...
Thanks&Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2005 04:35 PM
тАО09-23-2005 04:35 PM
SolutionYou may wish to backup your table using a simple Oracle tool called EXP.
a simple script would look like: (backuptable.sh)
#!/bin/sh
LOG_PATH=/backup/oracle/logfiles
ORACLE_HOME=/u01/app/oracle/product/10g
DMP_PATH=/backup/oracle/export
ACC_PASS=schemaowner/*****
$ORACLE_HOME/bin/exp $ACC_PASS tables=(yourtable1, yourtable2) file=\($DMP_PATH1/tableexp.dmp\) buffer=409600 log=$LOG_PATH/tableexp.log rows=Y grants=y compress=N direct=n
#end of script
then an easy way to schedule is (using root account), adding the following line into your crontab
00 18 * * * echo "/backup/scripts/oracle/backuptable.sh" | su - oracle 1>/backup/oracle/logfiles/output-export.crn 2>/backup/oracle/logfiles/error-export.crn
hope this helps!
if you have any other questions, do let us know.
NB. You should consider doing the backup of your whole database unless your organisation accepts to take the risk of your system crashing and not being able to recover any data.
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2005 12:47 PM
тАО09-24-2005 12:47 PM
Re: Databse backup automated through Crontab
The above example by Yogeeraj is a good one.
Well that will kepp the oracle backup in the system , i.e disk , if you want to create a tape backup for this , you can add another line in the crontab and tape backup also can be taken of the DMP export file.
crontab -e
00 20 * * * tapebkup.sh
#script tapebkup.sh
##########################################
# Assuming Tape is in the Drive.
# starting Tape backup of Oracle Export file.
TP_STATUS="`mt -f /dev/rmt/0mn status | grep BOT | awk '{print $3}' `"
if [ $TP_STATUS = "BOT" ]
then
echo " TAPE Present in the drive .."
else
echo " No Tape in the Drive !!!!exiting...Tape backup .."
exit 1
fi
cd /backup/oracle/export
tar -cvf /dev/rmt/0m /backup/oracle/export/* >>tapebkup.log
mt -f /dev/rmt/0m rew >> tapebkup.log
mt -f /dev/rmt/0m offl >> tapebkup.log
echo "Tape backup of oracle completed at: `date ` successfully ..." >> /dev/tapebkup.log
#########################################
Hope this will help ....plannig for a script..
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2005 03:47 PM
тАО09-25-2005 03:47 PM
Re: Databse backup automated through Crontab
Just another question..
If lets say, I decide to backup the entire database called ABC; from user abcadmin;
So, how can I modify the ACC_PASS??
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2005 05:28 PM
тАО09-25-2005 05:28 PM
Re: Databse backup automated through Crontab
two options are possible:
1. set ACC_PASS=abcuser/*****@ABC
2. set ACC_PASS=system/***@ABC
then add the clause owner=abcuser
hope this helps too!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2005 09:12 PM
тАО09-25-2005 09:12 PM
Re: Databse backup automated through Crontab
$ACC_PASS tables=(yourtable1, yourtable2) file=\($DMP_PATH1/tableexp.dmp\) buffer=409600 log=$LOG_PATH/tableexp.log rows=Y grants=y compress=N direct=n
I would also like to know what is the purpose of the command "rows=Y grants=y compress=N direct=n" as written above.
Thanks in advance...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-25-2005 09:24 PM
тАО09-25-2005 09:24 PM
Re: Databse backup automated through Crontab
you should change as follows:
$ACC_PASS full=y file=\($DMP_PATH1/tableexp.dmp\) buffer=409600 log=$LOG_PATH/fulldbexp.log rows=Y grants=y compress=N direct=n
How biig is your database?
(NB. the ACC_PASS should define a user with dba privilege on the database.)
ROWS=Y: export data rows
GRANTS=Y: export grants
DIRECT=N: Don't use direct path export. Export in direct path mode simply bypasses the SQL evaluation buffer (where clause processing, column formatting and such). The speedup of the direct path export can be large however. The 10% of the processing that it cuts out, accounts for a much larger percentage of the run-time. I don't recommend using DIRECT=Y because have had faced some bugs.
more detailed explanation is available at: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch01.htm
hope this helps too!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2005 03:37 PM
тАО10-02-2005 03:37 PM
Re: Databse backup automated through Crontab
Regarding the below:-
$ACC_PASS full=y file=\($DMP_PATH1/tableexp.dmp\) buffer=409600 log=$LOG_PATH/fulldbexp.log rows=Y grants=y compress=N direct=n
If I want the output to look like this;
ARAdmin_tm02_03102005-08:40:23.dmp
(where ARAdmin is the tablename and tm02 is the database name)
I should change the script(for line 2) to this;
file=\($DMP_PATH1/ARAdmin_tm02_"$dt".dmp\)
where dt=date (this is declared at the beginning of the scrpit)
Is it correct...Please correct me if i'm wrong...
Thanks