I got an Oracle 10g server with a bash script running every night which extract each datafile and create an rman script, which is launched from the bash script itself and make backups.
CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/opt/oracle/archivelogs/autobackup_control_file%F'; CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS; CROSSCHECK ARCHIVELOG ALL; CROSSCHECK BACKUP; ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK; COPY LEVEL 0 DATAFILE 1 TO '/opt/oracle/backup/datafile1.dbf' , DATAFILE 2 TO '/opt/oracle/backup/datafile2.dbf' ... , DATAFILE N TO '/opt/oracle/backup/datafileN.dbf' ; SQL 'alter system archive log current'; BACKUP FORMAT '/opt/oracle/archivelogs/archive_logs_%d_%s-%t.bck' ARCHIVELOG ALL DELETE INPUT; BACKUP CURRENT CONTROLFILE FORMAT '/opt/oracle/archivelogs/controlfile_%d_%s-%t.bck'; RELEASE CHANNEL RMAN_BACK_CH01; } DELETE NOPROMPT EXPIRED BACKUP; DELETE NOPROMPT BACKUP OF ARCHIVELOG UNTIL TIME='sysdate-6';
As you can see from the script the backups are made via datafile copy and archivelogs backup. I got two questions:
on the archivelogs directory the script creates two controlfile backups (autobackup_control_filec-* and controlfile_SID_) which have quite the same size (6.1MB vs 6.2MB) but not exactly the same. controlfile_SID_ file creation is clear from the syntax, but when the autobackup_control_filec-* is created? Perhaps during
BACKUP ARCHIVELOG ALLcommand? And why this different size? If they are both controlfile backup I expect they have the same size.
Datafile backup rotation seems to work fine, every day I found in /opt/oracle/backup only the backup files from the latest backup schedule, but in logs I don't find any trace of old backup deletion or messages on overwrite. I suppose
COPY LEVEL 0command overwrite without any warning, is it right?