RMAN again... feedback needed

  • From: Janine Sisk <janine@xxxxxxxxxx>
  • To: oracle-l L <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 26 May 2010 22:50:56 -0700

Linux (CentOS 5.2)
Oracle 11g R2, Enterprise Edition

As you all advised, I am taking the RMAN plunge.  I don't really know what I'm 
doing yet, so I'm asking for a sanity check:

After spending a great deal of time sifting through documentation, I have done 
the following:

- tweaked the default RMAN configuration:
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;

- changed some of my other settings, mainly to move the flash recovery area 
onto its own drive and to move the archive logs back into it (I had previously 
moved them elsewhere).
SQL> alter system set db_recovery_file_dest='/export3/flash_recovery_area' 
scope=both;
(was /u01/app/oracle/flash_recovery_area)
SQL> alter system set db_recovery_file_dest_size = 45G scope=both;
SQL> alter system set log_archive_dest_1='' scope=both;
(was /export2/archivelogs)
SQL> alter database flashback on;
SQL> alter system set db_create_file_dest='/export3/block_change_tracking' 
scope=both;
SQL> alter database enable block change tracking;

After all that I restarted Oracle, just to make sure I hadn't committed any 
heinous crimes, and it seemed happy.

Then I took what I had gathered from the docs and wrote a backup script, based 
on the one that was posted here when I asked about this a few weeks ago.  The 
following is what I came up with... would anyone care to point out any glaring 
errors I may have made?  Be nice, please... :)

(yes, I know the tag 'incremental' isn't very creative - there is only one 
database on this server so it doesn't have to be!)

---- script start

#!/bin/bash

ORACLE_SID=afghan
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
PATH=$PATH:$ORACLE_HOME/bin
HOME=/export/home/oracle
SHELL=/bin/bash
BASH_ENV=/export/home/oracle/.bashrc
export ORACLE_SID LD_LIBRARY_PATH ORACLE_BASE PATH HOME SHELL BASH_ENV 
ORACLE_HOME

day=`date '+%d'`
OUTF=$HOME/backup/log/$day.$ORACLE_SID.log
RMAN=$ORACLE_HOME/bin/rman
$RMAN msglog $OUTF > /dev/null << END
 connect target;
 run {
   recover copy of database
     with tag 'incremental';
   backup
     incremental level 1
     for recover of copy with tag 'incremental'
     check logical database
     plus archivelog delete input;
 }
 delete noprompt obsolete;
 delete noprompt expired archivelog all;
 delete noprompt expired backup;
 delete noprompt expired copy;
 restore database validate;
 restore archivelog all validate;
 list backup;
 list copy;
 exit
END

# do this on the first of each month
if [ $day == 1 ]; then
  $RMAN > /dev/null << END2
    connect target;
    crosscheck archivelog all;
    crosscheck backup;
    exit
END2
fi

if [ `egrep -ic 'RMAN-|error|fail' $OUTF` != 0 ]; then
 mailx -s "FAILED: $ORACLE_SID" janine@xxxxxxxxxx < $OUTF
else
 mailx -s "COMPLETED: $ORACLE_SID" janine@xxxxxxxxxx < /dev/null
fi
exit

---- script end

I have one problem I don't know how to solve... while I was messing around, I 
managed to lose all my archive logs.  That would be ok in itself, except that I 
can't get RMAN to forget about them.  I deleted all my backups and copies and 
started over, but the "restore archivelog all validate" still gives 

RMAN-06025: no backup of archived log for thread 1 with sequence 1613 and 
starting SCN of 256369082 found to restore

For all the logs it thought it backed up.  It was RMAN that deleted the logs, 
so the fact that they are missing does not concern it.  Is there some way to 
tell it to forget it ever saw those logs and go on from here?

Thanks much in advance to anyone who wades through all this!

janine--
//www.freelists.org/webpage/oracle-l


Other related posts: