Running RMAN commands from PLSQL

I still haven’t been able to determine if this is 100% supported, but it works. If you wanted to delete archived redo logs from within a database session (for some unknown reason), you can run something similar to the following:

begin
  for cur in (select * from v$archived_log where deleted = 'NO' and sequence# < 10) loop
    dbms_backup_restore.deletearchivedlog(cur.recid,cur.stamp,cur.name,
                                          cur.thread#,cur.sequence#,
                                          cur.resetlogs_change#,cur.first_change#,
                                          cur.block_size,1);
  end loop;
end;
/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.