Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle Newbie - backup question 2

Status
Not open for further replies.

dpu

IS-IT--Management
Jan 24, 2005
179
US
I am new to Oracle - mostly work with MS SQL - I am trying to set up a job that would create a nightly backup job of the database. Much in the same way MSSQL creates a .bak file.
Also how many archive logs do I need to keep to restore a database. I only keep 2-3 weeks worth of archive logs in addition to the redo log files.
 
dpu,
If your database is running in archive log mode, you can use RMAN to create hotbackups via the following script. I use cron to run it. I'm running Oracle 10G.

DAT=`date +%a`
HOY=`date`
LOGf=/tmp/backuplog.txt
case ${DAT} in
Sun)
echo "Starting backup at ${HOY}" >> ${LOGf}
su - oracle -c "rman target=backup_acct/password log=${LOGf}" <<!
crosscheck backupset;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt expired archivelog all;
delete noprompt obsolete;
backup as compressed backupset incremental level=0 TAG
= WeeklyFull database plus archivelog delete all input;
backup validate database archivelog all;
list backup summary;
exit
!
;;
Wed)
echo "Starting backup at ${HOY}" >> ${LOGf}
su - oracle -c "rman target=backup_acct/password log=${LOGf}" <<!
crosscheck backupset;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt expired archivelog all;
delete noprompt obsolete;
backup as compressed backupset incremental level=1 TAG = DailyL1 database plus archivelog delete all input;
list backup summary;
exit
!
;;
*)
echo "Starting backup at ${HOY}" >> ${LOGf}
su - oracle -c "rman target=backup_acct/password log=${LOGf}" <<!
crosscheck backupset;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt expired archivelog all;
delete noprompt obsolete;
backup as compressed backupset incremental level=2 TAG = DailyL2 database plus archivelog delete all input;
list backup summary;
exit
!
;;
esac
 
TheKidd,

I think your script may work for my 10g database.

What is cron and how do you start it?

Thanks, John
 
cron is used in UNIX to schedule jobs. If the RMAN script is called backup.sh you could schedule it to run at 4:30AM daily with the following:

30 4 * * * /home/oracle/backup.sh

Use "crontab -e" to add the job.
 
I assumed UNIX, sorry. You can use the Windows task scheduler or you can use the job scheduler provided by Oracle Enterprise Mgr to schedule a backup job.
 
You should be able to create & schedule the entire backup job via Oracle Enterprise Manager. I've never done it that way so I don't know the process.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top