1748180 Members
4125 Online
108759 Solutions
New Discussion юеВ

Re: oracle backup online

 
Adrian_72
Advisor

oracle backup online

we have a two scripts for the execute backup :
First script the name is hotbk1.sh

# more hotbk1.sh
export ORACLE_SID=olap
sqlplus -s "/as sysdba" @/ora9i/admin/olap/scripts/hotbk1.sql

Second script is hotbk1.sql:
#more hotbk1.sql

alter tablespace SYSTEM begin backup;
alter tablespace UNDOTBS1 begin backup;
alter tablespace SIEBELDATA begin backup;
alter tablespace SIEBELINDEX begin backup;
alter tablespace TOOLS begin backup;
alter tablespace USERS begin backup;
!rm /oracle/backup/hot/control/crontrol_file.ctl
alter database backup controlfile to '/oracle/backup/hot/control/crontrol_file.c
tl';
alter database backup controlfile to trace;

alter system switch logfile;
alter system archive log stop;
!cp /ora9i/admin/olap/udump/* /oracle/backup/hot/udump
!cp /ora9i/dbs/spfileolap.ora /oracle/backup/hot/dbs
!cp /ora9i/dbs/orapwolap /oracle/backup/hot/dbs
exit
OLAP01 /ora9i/admin/olap/scripts

I need execute in the crontab the script for automatic execution, Do you know what is the sintaxis or what is the procedure for execute my backup online ?


Thank you
9 REPLIES 9
Rick Garland
Honored Contributor

Re: oracle backup online

Syntax for crontab entry is;

min hr month_day month wekkday

So you want you script to execute at 0100 daily,

00 01 * * *
Do man on cron and crontab.
TwoProc
Honored Contributor

Re: oracle backup online

look in the "Examples" section of manpage for cron on HPUX. It has full examples of how this works, and small discussions of what it means.
We are the people our parents warned us about --Jimmy Buffett
TwoProc
Honored Contributor

Re: oracle backup online

on HPUX the man page for cron has several examples and a good commented out "header" that is a good reference that I add to the head of all my crontab files.

On HPUX - "man cron" see section titled "EXAMPLES" a few pages down.
We are the people our parents warned us about --Jimmy Buffett
Sandman!
Honored Contributor

Re: oracle backup online

how often do you want to execute the script from cron i.e. daily, weekly, or monthly and what time of day do you want it to run?

With these details the question is easily answered.
Jean-Luc Oudart
Honored Contributor

Re: oracle backup online

Hi Adrian,

One issue that keeps coming back on these thread regarding crontab is that the environemnt is NOT set. Therefore, you must set all your (required) environment variables.

One option is to create a wrapper script that we source an initialisation script with all required variable. very usefull when you need the same functionality elsewhere.

Regards
Jean-Luc
fiat lux
Jean-Luc Oudart
Honored Contributor

Re: oracle backup online

Hi again

check this thread :
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=822683

Regards
Jean-Luc
fiat lux
Julio Yamawaki
Esteemed Contributor

Re: oracle backup online

Hi,

You can do this backup in some easy steps:
1. save your commands above in a file owned by oracle and with execute permission, like hotbk.sh
2. have an oracle account with all environment variables: ORACLE_HOME, ORACLE_SID and PATH with ORACLE_HOME/bin
3. make your crontab as root to execute at midnight/everyday:
0 0 * * * su - oracle -c /hotbk.sh
3.2 make your crontab as oracle (don├В┬┤t forget to put oracle in /var/adm/cron/cron.allow):
0 0 * * * /hotbk.sh

Regards
renarios
Trusted Contributor

Re: oracle backup online

Hi Adrian,

I suggest you to use RMAN for this. This is an excellent powerfull backup and recovery tool (free) from Oracle, which allows you to do (supported) online backups and point-in-time recoveries.
You initially have to do so reading, but it's worth-well.

Cheerio,

Renarios
Nothing is more successfull as failure
R. Allan Hicks
Trusted Contributor

Re: oracle backup online

I apologize for being off the thread, but in looking at your backup script......

Have you gotten it to work? The statements alter tablespace begin backup; puts the tablespace into hot backup mode, you need to copy the datafiles associated with the tablespace to tape or another disc and then return the tablespace to non hotbackup mode.

alter tablespace end backup;

If the begin backups and end backups don't match, you could have some problems.

-Just a heads up
"Only he who attempts the absurd is capable of achieving the impossible