Don't Delete archivelogs from Standby Until Cascaded
10.2.0.2 on AIX.
PROD uses STDBY1 as its standby, and SDTBY1 then cascades the applied archivelogs to STDBY2. On STDBY1 I periodically backup and delete applied archivelogs:
#!/bin/ksh
sqlplus <<EOF
/ as sysdba
spool /tmp/applied_logseq.txt
select 'XXX ' || max (sequence#)
from v\$archived_log
where applied = 'YES';
spool off
exit
EOF
max_logseq=$(grep ^XXX /tmp/applied_logseq.txt |awk '{print $2}')
rman <<EOF
connect target
delete noprompt archivelog until logseq $max_logseq;
exit
EOF
exit
This worked when the environment was just PROD and STDBY1. Now it seems that my archivelog cleanup script on STDBY1 is sometimes deleting archivelogs before they get cascaded to STDBY2. How do I make sure I don't delete the STDBY1 archivelogs too soon?