Beruflich Dokumente
Kultur Dokumente
Using the steps below one take cold backup using RMAN. As its a cold backup the database as the database is in
Step 3) Run rman and connect to target database and run rman to backup database and connection to
$ ./rman target /
RMAN>list backup;
RMAN command to create level 0 backup which is needed before running of incremental backup level 1
cumulative or differential backup. If a level 0 backup doesnt exists, when running INCREMENTAL backup
most recent Level 0 backup. If a level 0 backup doesnt exists, when running INCREMENTAL backup
Vi /u02/Backups/Script/alertlog_monotor.sh
#!/bin/bash
export ORACLE_SID=galaxy
export ORAENV_ASK=NO
. /home/oracle/.bash_profile
SERNAME=info@indoline.in
SERPUBIP=192.168.100.1
SERVER=`dbserver.indolne.in` #### Sets the server name for the email
WEEKDAY=`date '+%w%H%M'` #### Sets the number value of the day of the week
DATE_VAR=`date '+%Y_%m_%d'`
Alert_log_loc=/u01/DbServer/oracle/diag/rdbms/galaxy2/galaxy2/trace/
# Check for the existence of ORA- in the alert log and email/page on error
egrep 'ORA-|error|TNS' $Alert_log_loc/alert_$ORACLE_SID.log |sort -u
> $Alert_log_loc/$ORACLE_SID_OUT_ALERTLOG.txt #### Output file with ORA- errors
cat $Alert_log_loc/alert_$ORACLE_SID.log >> $Alert_log_loc/archived_alert_$ORACLE_SID.log
cat /dev/null > $Alert_log_loc/alert_$ORACLE_SID.log
if [ -s "$Alert_log_loc/$ORACLE_SID_OUT_ALERTLOG.txt" ] ; then
cat $Alert_log_loc/$ORACLE_SID_OUT_ALERTLOG.txt | mail -s "URGENT -ERROR in Oracle Alert Log
File for $SERNAME ($SERPUBIP) at `date` " sopan.sonar@gmail.com
fi
exit 0
crontab -l
*/15 * * * * /backups/alertlog_monotor.sh
Make sure database is in archivelog mode , if its not put it on archivelog mode.
#!/bin/bash
export ORACLE_SID=galaxy
export ORACLE_BASE=/u01/DbServer/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export path1=/u02/Backups/rman_backup/full_backup
date1=`date +%d%m%y_%H%M%S`
mkdir $path1/$date1
chown oracle:oinstall -R $path1/$date1
$ORACLE_HOME/bin/rman target / <<eof
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
report obsolete;
delete Noprompt obsolete;
configure CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'$path1/$date1/control_%d_%F';
run
{
backup incremental level 0 database FORMAT '$path1/$date1/full_%d_%T_%t_%s_%p';
backup archivelog all FORMAT '$path1/$date1/archive_%d_%T_%t_%s_%p' ;
}
eof
cd $path1
file1=`ls -ltrh | tail -1 | awk '{print $9}'`
tar -zcvf $file1.tar.gz $file1
Make sure database is in archivelog mode , if its not put it on archivelog mode.
#!/bin/bash
export PS1="`/bin/hostname s`> "
export ORACLE_SID=galaxy
export ORACLE_BASE=/u01/DbServer/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export path1=/u02/Backups/rman_backup/inc_level_1
date1=`date +%d%m%y_%H%M%S`
mkdir $path1/$date1
chown oracle:oinstall -R $path1/$date1
$ORACLE_HOME/bin/rman target / <<eof
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
report obsolete;
delete Noprompt obsolete;
configure CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$path1/$date1/control_%d_%F';
backup incremental level 1 database FORMAT '$path1/$date1/inc_level_1_%d_%T_%t_%s_%p';
eof
cd $path1
file1=`ls -ltrh | tail -1 | awk '{print $9}'`
tar -zcvf $file1.tar.gz $file1
How to take RMAN INCREMENTAL LEVEL 1 Cumulative Backup using Shell script
Create the following backup path:-
[oracle@server1 ~]$ mkdir -p /u02/Backups/rman_backup/inc_level_1_cum
[oracle@server1 ~]$ mkdir -p /u02/Backups/scripts/
Make sure database is in archivelog mode , if its not put it on archivelog mode.
#!/bin/bash
export PS1="`/bin/hostname s`> "
export ORACLE_SID=galaxy
export ORACLE_BASE=/u02/DbServer/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export path1=/u02/Backups/rman_backup/inc_level_1_cum
date1=`date +%d%m%y_%H%M%S`
mkdir $path1/$date1
chown oracle:oinstall -R $path1/$date1
su - oracle -c "$ORACLE_HOME/bin/rman target / " <<eof
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
report obsolete;
delete Noprompt obsolete;
configure CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$path1/$date1/control_%d_%F';
backup incremental level 1 cumulative database FORMAT '$path1/$date1/inc_level_1_cum_%d_%T_%t_%s_%p';
eof