Posted by: baskardba | May 14, 2010

Deleting Applied archives in a two node RAC in DR

Hi all,

The below script will delete the applied logs in the DR site by keeping the last ten applied logs.

set echo on
select database_role from v$database;
var v_maxseq1 number
var v_maxseq2 number
exec select max(sequence#)-10 into :v_maxseq1 from v$archived_log where applied=’YES’ and thread#=1;
exec select max(sequence#)-10 into :v_maxseq2 from v$archived_log where applied=’YES’ and thread#=2;
print v_maxseq1
print v_maxseq2
set echo off
set heading off
set feedback off
spool script.rman
select ‘delete archivelog until sequence ‘ || :v_maxseq1 || ‘thread 1 ;’ from dual;
select ‘delete archivelog until sequence ‘ || :v_maxseq2 || ‘thread 2 ;’ from dual;
spool off
host rman target / @script.rman
exit
spool off
exit

The above script will avoid setting the RMAN configuration of applied on standby.

Happy Learning,

baskar.l

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: