What does “copy of” mean when doing “delete archivelog”?

Posted on

Question :

Disclaimer: I’m not a DBA nor did I fully read the RMAN docs cover to cover, so this may be well covered, but I couldn’t find it.

The question is very simple, what is the difference between these two commands:

  • delete copy of archivelog all completed before 'SYSDATE-7';
  • delete archivelog all completed before 'SYSDATE-7';

What is deleted from where under which circumstances when running these from RMAN?



Possibly relevant infos: (?)

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5785
Next log sequence to archive   5787
Current log sequence           5787
SQL> select * from v$recovery_file_dest;

NAME             SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
---------------- ----------- ---------- ----------------- -----
e:oraclebackup 2.1475E+11  4.7820E+10 4.6097E+10        1246

RMAN> show retention policy;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ****** are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;

Answer :

Based on the documentation:

An image copy is an exact copy of a single data file, archived redo
log file, or control file. Image copies are not stored in an
RMAN-specific format. They are identical to the results of copying a
file with operating system commands. RMAN can use image copies during
RMAN restore and recover operations, and you can also use image copies
with non-RMAN restore and recovery techniques.

Even the original archivelogs count as copies, as they are a copy of an archived redo log. The 2 statements are equivalent even if you have the same archivelogs 1 or 10 times on the disk. The COMPLETED BEFORE ‘SYSDATE – 7’ clause will delete archivelogs that are older than 7 days.

This is not true for datafiles however. The original, actual datafiles don’t count as copies. If you create a copy of a datafile with the BACKUP AS COPY command, that copy will have the data from the file the time it was copied, and the database will not use that copy, except for recovery procedures. If you switch a datafile to its copy with the SWITCH command, the copy becomes the original, and the former original becomes the copy.

Leave a Reply

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