Here is a script I use to expire RMAN backups. Note that I filter (egrep) the backup pieces based on tags. This way I have separated expiring scripts for daily, weekly, and monthly backups.
#!/usr/bin/bash export ORACLE_BASE=/oracle/product/920/admin export ORACLE_HOME=/oracle/product/920 export LD_LIBRARY_PATH=/oracle/product/920/lib32:/usr/dt/lib:/usr/openwin/lib export TNS_ADMIN=/oracle/product/920/network/admin export LD_LIBRARY_PATH_64=/oracle/product/920/lib export ORA_NLS33=/oracle/product/920/ocommon/nls/admin/data export NLS_DATE_FORMAT="dd/mm/yyyy hh24:mi:ss" export ARQLOG=/opt/tivoli/tsm/client/log/ORACLE_SIDobsolete_`date '+%Y%m%d%H%M%S'`.log export ORACLE_SID=ORACLE_SID target=user/[EMAIL PROTECTED] parms="parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo_restore.opt)'" catalog='rmanuser/[EMAIL PROTECTED]' #Registra log de inicio date '+Inicio do script de remocao de objetos obsoletos em %d/%m/%Y as %H:%M:%S' >$ARQLOG dbobsolete_tape=/tmp/ob_tape.log cmdfile=/tmp/delete.cmd if [ -f $dbobsolete_tape ] then rm $dbobsolete_tape fi if [ -f $cmdfile ] then rm $cmdfile fi # Get a list of obsolete tape files $ORACLE_HOME/bin/rman msgno target $target rcvcat $catalog msglog $dbobsolete_tape << EOF > /dev/null run { allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo_restore.opt)'; report obsolete redundancy=45; release channel t1; } EOF # sed options del_bpiece="-e /RMAN-06285/ s/\(.* \)\(.*\)$/change backuppiece '\2' delete;/" # Create the RMAN command to delete the obsolete files echo "allocate channel for delete type 'sbt_tape' $parms ;" >> $cmdfile grep RMAN-06285 $dbobsolete_tape | egrep 'bkp_full|ctl_|arc_' | sed "$del_bpiece" >> $cmdfile echo "release channel;" >> $cmdfile # Execute the RMAN command file to delete the obsolete files $ORACLE_HOME/bin/rman msgno target $target rcvcat $catalog msglog $ARQLOG cmdfile $cmdfile if [ $? -gt 0 ] then date '+Termino do script com erro em %d/%m/%Y as %H:%M:%S' >>$ARQLOG exit 1 else date '+Termino do script com sucesso em %d/%m/%Y as %H:%M:%S' >>$ARQLOG fi On 10/13/05, Kurt Beyers <[EMAIL PROTECTED]> wrote: > Hello, > > My environment is the following: > > TSM 5.3.2 server on Windows2003 > Sun Solaris 5.8 with Oracle 8.1.7.4 with a TSM BA client 5.3.x and the TDP > for databases 5.3 > > The backup of the Oracle databases is already working. The metadata of the > backups is written in the control files of the Oracle database. > > The backups are bound to a mgmt class with the correct settings (as every > object receives a unique name in TSM). > > The expiration must first be done in Oracle with a script, eg expire the > backups older than X days. Could anybody share a working script? I'm still > struggling to get it working as it should. > > But how are the backups made inactive in the TSM database after they have > been deleted in Oracle? The 'tdposync' tool only works when the metadata is > stored in a recovery catalog database. And after a forced deletion of the > backups in RMAN, they do not become inactive in TSM either. How can the > metadata in the TSM database be synchronized with the metadata in Oracle > (control file) . > > I know this must have been discussed in the past already, but a search of the > old threads didn't clear it out yet. > > thanks a lot, > Kurt > > > -- Helder Garcia