当前位置:操作系统 > Unix/Linux >>

Backup CATALOG简析

Backup CATALOG简析
 
DELETE OBSOLETE RECOVERY WINDOW OF 7 DAYS
 
BACKUP 
  INCREMENTAL LEVEL 0
  MAXSETSIZE 10M
  DATABASE
  TAG 'BACKUP_1';
 
 
CONFIGURE BACKUP OPTIMIZATION ON
 
 
CONFIGURE ARCHIVELOG DELETION POLICY
  TO BACKED UP 1 TIMES TO SBT;
 
 
DELETE 
  ARCHIVELOG ALL
  BACKED UP 2 TIMES TO DEVICE TYPE sbt;
 
 
CHANGE BACKUP OF ARCHIVELOG TAG SECOND_COPY UNAVAILABLE;
 
 
BACKUP DATABASE
  SKIP INACCESSIBLE
  SKIP READONLY
  SKIP OFFLINE;
 
 
 
 
Performing Block Media Recovery
###############################
To recover specific data blocks
===============================
RECOVER 
  DATAFILE 8 BLOCK 13 
  DATAFILE 2 BLOCK 199
  FROM TAG mondayam;
 
 
To recover all blocks logged in V$DATABASE_BLOCK_CORRUPTION
===========================================================
RECOVER CORRUPTION LIST;
 
 
 
 
make a backup with tag
======================
backup as backupset
  database device type disk 
  format '/disk1/backup_%U'
  tag mondaybkp;
 
 
Making Compressed Backups
=========================
The following example backs up the database, switches the online redo logs, and includes archived logs in the backup:
By archiving the logs immediately after the backup, you ensure that you have a full set of archived logs through the time of the backup. In this way, you guarantee that you can perform media recovery after restoring this backup.
 
 
backup as compressed backupset
  database plus archivelog;
 
 
 
 
Backing Up Tablespaces and Datafiles with RMAN
==============================================
RMAN automatically backs up the control file and the server parameter file (if the instance was started with a server parameter file) when datafile 1 is included in the backup. If control file autobackup is enabled, then RMAN writes the current control file and server parameter file to a separate autobackup piece. Otherwise, RMAN includes these files in the backup set that contains datafile 1.
 
 
backup device type sbt
  tablesapce users, tools;
 
 
backup device type sbt
  datafile 1,2,3
 
 
 
 
To manually back up the control file
====================================
backup device type sbt
  tablespace users
  include current controlfile;
 
 
BACKUP AS COPY
  CURRENT CONTROLFILE 
  FORMAT '/tmp/control01.ctl';
 
 
 
 
To back up the server parameter file
====================================
backup device type sbt spfile;
 
 
 
 
Archived Redo Log Failover
==========================
The archived redo log failover feature enables RMAN to complete a backup even when some archiving destinations are missing logs or contain logs with corrupt blocks.
 
 
 
 
Online Redo Log Switching
=========================
Another important RMAN feature is automatic online redo log switching. To make an open database backup of archived redo logs that includes the most recent online redo log, you can execute the BACKUP command with any of the following clauses:
  PLUS ARCHIVELOG
  ARCHIVELOG ALL
  ARCHIVELOG FROM ...
 
 
Before beginning the backup, RMAN switches out of the current redo log group, and archives all online redo logs that have not yet been archived, up to and including the redo log 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.
 
&nbs
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,