Backup CATALOG简析(二)
g group that was current when the command was issued. This feature ensures that the backup contains all redo generated before the start of the command.
One of the most effective ways of backing up archived redo logs is the BACKUP ... PLUS ARCHIVELOG clause, which causes RMAN to do the following:
1.Runs the ALTER SYSTEM ARCHIVE LOG CURRENT statement.
2.Runs BACKUP ARCHIVELOG ALL. If backup optimization is enabled, then RMAN skips logs that it has already backed up to the specified device.
3.Backs up the rest of the files specified in BACKUP command.
4.Runs the ALTER SYSTEM ARCHIVE LOG CURRENT statement.
Backs up any remaining archived logs generated during the backup. If backup optimization is not enabled, then RMAN backs up the logs generated in step 1 plus all the logs generated during the backup.
The preceding steps guarantee that datafile backups taken during the command are recoverable to a consistent state. Also, unless the online redo log is archived at the end of the backup, DUPLICATE is not possible with the backup.
To back up archived redo log files
==================================
BACKUP DATABASE PLUS ARCHIVELOG;
BACKUP ARCHIVELOG ALL;
BACKUP ARCHIVELOG
FROM TIME 'SYSDATE-30'
UNTIL TIME 'SYSDATE-7';
To back up archived redo logs that need backups
===============================================
BACKUP ARCHIVELOG ALL NOT BACKED UP 2 TIMES;
To delete archived redo logs after a backup
===========================================
For the following procedure, assume that you archive to /arc_dest1, /arc_dest2, and the fast recovery area.
BACKUP DEVICE TYPE sbt
ARCHIVELOG ALL
DELETE ALL INPUT;
In this case, RMAN backs up only one copy of each log sequence number in these archiving locations. RMAN does not delete any logs from the fast recovery area, but it deletes all copies of any log that it backed up from the other archiving destinations. The logs in the fast recovery area that are eligible for deletion are automatically removed by the database when space is needed.
If you had specified DELETE INPUT rather than DELETE ALL INPUT, then RMAN would only delete the specific archived redo log files that it backed up. For example, RMAN would delete the logs in /arc_dest1 if these files were used as the source of the backup, but leave the contents of the /arc_dest2 intact.
The following SQL query determines the number of blocks written to an incremental level 1 backup of each datafile with at least 20% of its blocks backed up
====================================================
SELECT FILE#, INCREMENTAL_LEVEL, COMPLETION_TIME,
BLOCKS, DATAFILE_BLOCKS
FROM V$BACKUP_DATAFILE
WHERE INCREMENTAL_LEVEL > 0
AND BLOCKS / DATAFILE_BLOCKS > .2
ORDER BY COMPLETION_TIME;
To make an incremental backup
=============================
backup incremental level 0 database;
backup incremental level 1 tablesapce system, tools;
backup incremental level 1 cumulative tablesapce users;
To enable block change tracking
===============================
SHOW PARAMETER DB_CREATE_FILE_DEST
alter database enable block change tracking
[using file '/mydir/rman_change_track.f' reuse];
alter database disable block change tracking;