1752794 Members
7374 Online
108789 Solutions
New Discussion юеВ

Re: oracle backup

 
sh5490
Frequent Advisor

oracle backup

hi
thanks all

we are running the rman script for backup
for full and incremental backup.
every time we have to run manually the script

like run {execute script full_backup:}

how we can automate this on OS level
or there is any other script available which will help

thanks
shabir


23 REPLIES 23
Yogeeraj_1
Honored Contributor

Re: oracle backup

hi,

You can automate this in two ways.

1. Using the OEM database control
2. Using the cron

For 1. goto http://:1158/em
then to the "Maintenance" tab, configure the RMAN settings in the "Backup/Recovery" and "Backup/Recovery Settings" sections.

(if you need any further assitance, please let us know)

For 2. create a crontab entry as follows:
#*******************************************************************************
# min|hour |day |month|day | |script
# | |of mo| |of wk| |
#----|-----|-----|-----|-----|-------|-----------------------------------
#*******************************************************************************
59 23 * * * echo "/home/yogeeraj/admin/scripts/oracle/rman/rman_full.sh;exit"|su - oracle 1>/home/yogeeraj/admin/logfiles/oracle/output-rman_full.crn 2>/home/yogeeraj/admin/logfiles/oracle/error-rman_full.crn
#
#*******************************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#*******************************************************************************

The above example is for the crontab of the superuser (root) and assuming that your rman script works correctly when run under the Oracle user.

Hope this helps!

kind regards
yogeeraj

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
sh5490
Frequent Advisor

Re: oracle backup

hi yogeeraj,

thanks lot

we are using folowing rman script

12] % rman catalog=rman/rman target=sys/redhat

Recovery Manager: Release 10.2.0.3.0 - Production on Wed Mar 26 16:50:16 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: CIEHO (DBID=103616347)
connected to recovery catalog database

RMAN> print script full_backup
2> ;

printing stored script: full_backup
{configure channel device type 'sbt_tape' clear;
configure controlfile autobackup on;
configure backup optimization on;
configure retention policy to recovery window of 7 days;
backup
format 'bk_%d_%u_%s_%p'
incremental level 0 tag ='FULL_BACKUP' database filesperset 2;
sql 'alter system switch logfile';
sql 'alter system archive log current';
backup
format 'arc_%d_%u_%s_%p'
archivelog all;
DELETE ARCHIVELOG UNTIL TIME 'SYSDATE-7';
}


How this script BE scheduled throgh cron tab
thanks
shabir
Yogeeraj_1
Honored Contributor

Re: oracle backup

hi Shabir,

First of all you will need to create a shell script that you can later schedule using the CRON.

e.g. rman_full.sh

#!/bin/sh
#Script Name: rman_full.sh
#Description: Incremental backup of database and archived redolog files
messagelog="/home/yogeeraj/scripts/oracle/rman/logfiles/rman_full-$(date +%d%m%y-%H%M).log"
export NLS_DATE_FORMAT='dd-Mon-yyyy HH24:mi:ss'
rman target target sys/redhat rcvcat rman/rman@catdb.mydb.mu msglog $messagelog </dev/null
run {
full_backup;
}
exit;
EOF

Question: What is the size of your database?


revert
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: oracle backup

hi Shabir,

First of all you will need to create a shell script that you can later schedule using the CRON.

e.g. rman_full.sh

#!/bin/sh
#Script Name: rman_full.sh
#Description: Incremental backup of database and archived redolog files
messagelog="/home/yogeeraj/scripts/oracle/rman/logfiles/rman_full-$(date +%d%m%y-%H%M).log"
export NLS_DATE_FORMAT='dd-Mon-yyyy HH24:mi:ss'
rman target target sys/redhat rcvcat rman/rman@catdb.mydb.mu msglog $messagelog </dev/null
run {
full_backup;
}
exit;
EOF

Question: What is the size of your database?


revert
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
sh5490
Frequent Advisor

Re: oracle backup

hi
thanks lot

We copy u script and created .sh file like
/script/rman_full.sh

#!/bin/sh
#Script Name: rman_full.sh
#Description: Incremental backup of database and archived redolog files
messagelog="/home/shabir/scripts/oracle/rman/logfiles/rman_full-$(date +%d%m%y-%H%M).log"
setenv NLS_DATE_FORMAT='dd-Mon-yyyy HH24:mi:ss'
rman catalog=rman/rman target sys/redhat msglog $messagelog
</dev/null
run {
execute script full_backup;
}
exit;
EOF

* kindly see if there is any changes required

pls confirm we have to run this script under oracle user
and what should be the ownership and permission to script file.

* total size of database is 300gb

thanks

shabir

sh5490
Frequent Advisor

Re: oracle backup

hi yogeeraj,


pls waiting u update
thanks
shabir
Yogeeraj_1
Honored Contributor

Re: oracle backup

hi Shabir,

>Your script
Looks ok. You can as well try to run it manually (using the oracle user) before scheduling it.

> pls confirm we have to run this script under oracle user and what should be the ownership and permission to script file.

The Oracle user should have execute permissions. You may as well change the file ownership to oracle:dba

e.g. (chown oracle:dba /script/rman_full.sh)
# ll /script/rman_full.sh
-rwxr-xr-x 1 oracle dba 1383 Mar 6 14:24 /script/rman_full.sh
#

>total size of database is 300gb
have you considered doing an increamental merge backup? I think it would be more efficient for you.

What about the nice RMAN compression features?

revert.

kind regards
yogeeraj


No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: oracle backup

hi again Shabir,

Note that RMAN (10G) now allows Fast Incremental Backups.

It backups up only those blocks that have changed since a previous backup.

Obviously, this brings along the following benefits:

i. Reduced disk space usage (since smaller backup-pieces generated)

ii. Faster backup

Also, note that Oracle 10g offers a new feature, called block "Change Tracking".
This feature allows for faster incremental backups.

With the help of a "tracking file", the database level block changes are tracked and Oracle logs changes to the blocks in this tracking file. And then during the incremental backup, RMAN reads the tracking
file to determine changed blocks. This obviates the need to read each and every block in a datafile and thus results in faster incremental backups.

hope this helps too!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
sh5490
Frequent Advisor

Re: oracle backup

hi yoograj,

thanks for u valuable inputs

pls find below the script
#!/bin/sh
#Script Name: rman_full.sh
#Description: Incremental backup of database and archived redolog files
messagelog=" +%d%m%y-%
H%M).log"
setenv NLS_DATE_FORMAT 'dd-Mon-yyyy HH24:mi:ss'
rman catalog=rman/rman target sys/redhat msglog $messagelog
</dev/null
run {
execute script full_backup;
}
exit;
EOF

out put executing under oracle user

#!/bin/sh
#Script Name: rman_full.sh
#Description: Incremental backup of database and archived redolog files
messagelog="/home/shabir/scripts/oracle/rman/logfiles/rman_full-$(date +%d%m%y-%
H%M).log"
setenv NLS_DATE_FORMAT 'dd-Mon-yyyy HH24:mi:ss'
rman catalog=rman/rman target sys/redhat msglog $messagelog
</dev/null
run {
execute script full_backup;
}
exit;
EOF

which steps fails this script

what should be permission of
/home/shabir/scripts/oracle/rman/logfiles/rman_full-$(date

thanks
shabir