eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 使用Windows工具管理Nt上的Oracle数据库 | Blog首页 | 无文件备份、拥有所有归档的恢复 »

Use RMAN to Manage BackupSet

With Oracle 9iR2, We have a new way to let RMAN to manage backupset better.
That is CONFIGURE RETENTION POLICY command .

If we have enough backups to meet a specific recovery window.
We can also tell RMAN to keep a specific number of copies of datafiles and controlfiles.

For example:
If I have enough backupset to recover the database to seven days ago, we can issue:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

Moreover, to insure that we have at least two copies of each datafile and controlfile backup, we can issue:

CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

RMAN will keeps all archived redo logs and incremental backups necessary to insure the retention policies can be met.
When a backup piece is no longer needed, RMAN marks it as obsolete.

If we want to clear out all obsolete backup files, we can simply issue DELETE OBSOLETE;
RMAN command and RMAN handles the deletion of the corresponding physical files.

So,Under Oracle9iR2,We can use RMAN to manage all of us backupset. It's very easy and convenience.

Some testing is following:

1.Use CONFIGURE to change the setting

RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
RMAN configuration has no stored or default parameters
RMAN configuration has no stored or default parameters
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/product/9.2.0/dbs/snapcf_avatar.f'; # default

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored


 

2.You may Need CROSSCHECK

If you have delete your backupset manual ,you may need to CROSSCHECK first.

 

RMAN> crosscheck backupset;

using channel ORA_DISK_1
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/full_1_531282606 recid=262 stamp=531282620
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/full_1_531283153 recid=263 stamp=531283155
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/full_1_531887405 recid=278 stamp=531887428
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/full_1_531887992 recid=279 stamp=531887995
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/full_1_532492206 recid=293 stamp=532492220
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/full_1_532492817 recid=294 stamp=532492820
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_533097005 recid=310 stamp=533097011
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_533097101 recid=311 stamp=533097108
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_533097286 recid=312 stamp=533097293
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_533097643 recid=313 stamp=533097643
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_533701806 recid=328 stamp=533701808
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_533701901 recid=329 stamp=533701910
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_533702110 recid=330 stamp=533702118
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_533702477 recid=331 stamp=533702477
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_534306605 recid=346 stamp=534306608
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_534306700 recid=347 stamp=534306710
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_534306927 recid=348 stamp=534306934
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_534307344 recid=349 stamp=534307345
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_534911405 recid=362 stamp=534911428
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_535516204 recid=370 stamp=535516227
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_536121006 recid=382 stamp=536121028
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_536725806 recid=397 stamp=536725824
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/data1/orabak/current/full_1_537330605 recid=412 stamp=537330625
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538540208.arc recid=436 stamp=538540209
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538713016.arc recid=437 stamp=538713017
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538713196.arc recid=438 stamp=538713198
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538713364.arc recid=439 stamp=538713365
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538799412.arc recid=440 stamp=538799413
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538799577.arc recid=441 stamp=538799578
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538885808.arc recid=442 stamp=538885809
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538885931.arc recid=443 stamp=538885932
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538972208.arc recid=444 stamp=538972209
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch538972344.arc recid=445 stamp=538972345
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch539058607.arc recid=446 stamp=539058608
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch539058709.arc recid=447 stamp=539058710
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch539145011.arc recid=448 stamp=539145012
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch539145126.arc recid=449 stamp=539145127
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/full_1_539231405 recid=450 stamp=539231419
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/oracle/product/9.2.0/dbs/e7g283jl_1_1 recid=451 stamp=539233910
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/oracle/product/9.2.0/dbs/e8g283la_1_1 recid=452 stamp=539233963
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch539317809.arc recid=453 stamp=539317810
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data1/orabak/current/arch539317932.arc recid=454 stamp=539317933
Crosschecked 42 objects
       

With this step ,Rman will check does these file is exists on your disk.

If a backup piece is unreadable or absent, then RMAN marks the backup piece EXPIRED in the output of the list command
and the recovery catalog views.
If it was marked EXPIRED but is now available, RMAN marks the backup piece as AVAILABLE in the output of the list
command and the recovery catalog views.

3.DELETE OBSOLETE

Now you can use rman to list and delete obsolete file from disk.

RMAN> delete obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           262    12-JUL-04         
  Backup Piece       262    12-JUL-04          /data1/orabak/full_1_531282606
Backup Set           263    12-JUL-04         
  Backup Piece       263    12-JUL-04          /data1/orabak/full_1_531283153
Backup Set           278    19-JUL-04         
  Backup Piece       278    19-JUL-04          /data1/orabak/full_1_531887405
Backup Set           279    19-JUL-04         
  Backup Piece       279    19-JUL-04          /data1/orabak/full_1_531887992
Backup Set           293    26-JUL-04         
  Backup Piece       293    26-JUL-04          /data1/orabak/full_1_532492206
Backup Set           294    26-JUL-04         
  Backup Piece       294    26-JUL-04          /data1/orabak/full_1_532492817
Backup Set           310    02-AUG-04         
  Backup Piece       310    02-AUG-04          /data1/orabak/current/full_1_533097005
Backup Set           311    02-AUG-04         
  Backup Piece       311    02-AUG-04          /data1/orabak/current/full_1_533097101
Backup Set           312    02-AUG-04         
  Backup Piece       312    02-AUG-04          /data1/orabak/current/full_1_533097286
Backup Set           313    02-AUG-04         
  Backup Piece       313    02-AUG-04          /data1/orabak/current/full_1_533097643
Backup Set           328    09-AUG-04         
  Backup Piece       328    09-AUG-04          /data1/orabak/current/full_1_533701806
Backup Set           329    09-AUG-04         
  Backup Piece       329    09-AUG-04          /data1/orabak/current/full_1_533701901
Backup Set           330    09-AUG-04         
  Backup Piece       330    09-AUG-04          /data1/orabak/current/full_1_533702110
Backup Set           331    09-AUG-04         
  Backup Piece       331    09-AUG-04          /data1/orabak/current/full_1_533702477
Backup Set           346    16-AUG-04         
  Backup Piece       346    16-AUG-04          /data1/orabak/current/full_1_534306605
Backup Set           347    16-AUG-04         
  Backup Piece       347    16-AUG-04          /data1/orabak/current/full_1_534306700
Backup Set           348    16-AUG-04         
  Backup Piece       348    16-AUG-04          /data1/orabak/current/full_1_534306927
Backup Set           349    16-AUG-04         
  Backup Piece       349    16-AUG-04          /data1/orabak/current/full_1_534307344
Backup Set           362    23-AUG-04         
  Backup Piece       362    23-AUG-04          /data1/orabak/current/full_1_534911405
Backup Set           370    30-AUG-04         
  Backup Piece       370    30-AUG-04          /data1/orabak/current/full_1_535516204
Backup Set           382    06-SEP-04         
  Backup Piece       382    06-SEP-04          /data1/orabak/current/full_1_536121006
Backup Set           397    13-SEP-04         
  Backup Piece       397    13-SEP-04          /data1/orabak/current/full_1_536725806
Backup Set           412    20-SEP-04         
  Backup Piece       412    20-SEP-04          /data1/orabak/current/full_1_537330605
Backup Set           436    03-OCT-04         
  Backup Piece       436    03-OCT-04          /data1/orabak/current/arch538540208.arc
Backup Set           437    05-OCT-04         
  Backup Piece       437    05-OCT-04          /data1/orabak/current/arch538713016.arc
Backup Set           438    05-OCT-04         
  Backup Piece       438    05-OCT-04          /data1/orabak/current/arch538713196.arc
Backup Set           439    05-OCT-04         
  Backup Piece       439    05-OCT-04          /data1/orabak/current/arch538713364.arc
Backup Set           440    06-OCT-04         
  Backup Piece       440    06-OCT-04          /data1/orabak/current/arch538799412.arc
Backup Set           441    06-OCT-04         
  Backup Piece       441    06-OCT-04          /data1/orabak/current/arch538799577.arc
Backup Set           442    07-OCT-04         
  Backup Piece       442    07-OCT-04          /data1/orabak/current/arch538885808.arc
Backup Set           443    07-OCT-04         
  Backup Piece       443    07-OCT-04          /data1/orabak/current/arch538885931.arc
Backup Set           444    08-OCT-04         
  Backup Piece       444    08-OCT-04          /data1/orabak/current/arch538972208.arc
Backup Set           445    08-OCT-04         
  Backup Piece       445    08-OCT-04          /data1/orabak/current/arch538972344.arc
Backup Set           446    09-OCT-04         
  Backup Piece       446    09-OCT-04          /data1/orabak/current/arch539058607.arc
Backup Set           447    09-OCT-04         
  Backup Piece       447    09-OCT-04          /data1/orabak/current/arch539058709.arc
Backup Set           448    10-OCT-04         
  Backup Piece       448    10-OCT-04          /data1/orabak/current/arch539145011.arc
Backup Set           449    10-OCT-04         
  Backup Piece       449    10-OCT-04          /data1/orabak/current/arch539145126.arc
Backup Set           451    11-OCT-04         
  Backup Piece       451    11-OCT-04          /opt/oracle/product/9.2.0/dbs/e7g283jl_1_1

Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/data1/orabak/full_1_531282606 recid=262 stamp=531282620
deleted backup piece
backup piece handle=/data1/orabak/full_1_531283153 recid=263 stamp=531283155
deleted backup piece
backup piece handle=/data1/orabak/full_1_531887405 recid=278 stamp=531887428
deleted backup piece
backup piece handle=/data1/orabak/full_1_531887992 recid=279 stamp=531887995
deleted backup piece
backup piece handle=/data1/orabak/full_1_532492206 recid=293 stamp=532492220
deleted backup piece
backup piece handle=/data1/orabak/full_1_532492817 recid=294 stamp=532492820
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_533097005 recid=310 stamp=533097011
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_533097101 recid=311 stamp=533097108
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_533097286 recid=312 stamp=533097293
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_533097643 recid=313 stamp=533097643
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_533701806 recid=328 stamp=533701808
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_533701901 recid=329 stamp=533701910
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_533702110 recid=330 stamp=533702118
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_533702477 recid=331 stamp=533702477
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_534306605 recid=346 stamp=534306608
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_534306700 recid=347 stamp=534306710
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_534306927 recid=348 stamp=534306934
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_534307344 recid=349 stamp=534307345
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_534911405 recid=362 stamp=534911428
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_535516204 recid=370 stamp=535516227
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_536121006 recid=382 stamp=536121028
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_536725806 recid=397 stamp=536725824
deleted backup piece
backup piece handle=/data1/orabak/current/full_1_537330605 recid=412 stamp=537330625
deleted backup piece
backup piece handle=/data1/orabak/current/arch538540208.arc recid=436 stamp=538540209
deleted backup piece
backup piece handle=/data1/orabak/current/arch538713016.arc recid=437 stamp=538713017
deleted backup piece
backup piece handle=/data1/orabak/current/arch538713196.arc recid=438 stamp=538713198
deleted backup piece
backup piece handle=/data1/orabak/current/arch538713364.arc recid=439 stamp=538713365
deleted backup piece
backup piece handle=/data1/orabak/current/arch538799412.arc recid=440 stamp=538799413
deleted backup piece
backup piece handle=/data1/orabak/current/arch538799577.arc recid=441 stamp=538799578
deleted backup piece
backup piece handle=/data1/orabak/current/arch538885808.arc recid=442 stamp=538885809
deleted backup piece
backup piece handle=/data1/orabak/current/arch538885931.arc recid=443 stamp=538885932
deleted backup piece
backup piece handle=/data1/orabak/current/arch538972208.arc recid=444 stamp=538972209
deleted backup piece
backup piece handle=/data1/orabak/current/arch538972344.arc recid=445 stamp=538972345
deleted backup piece
backup piece handle=/data1/orabak/current/arch539058607.arc recid=446 stamp=539058608
deleted backup piece
backup piece handle=/data1/orabak/current/arch539058709.arc recid=447 stamp=539058710
deleted backup piece
backup piece handle=/data1/orabak/current/arch539145011.arc recid=448 stamp=539145012
deleted backup piece
backup piece handle=/data1/orabak/current/arch539145126.arc recid=449 stamp=539145127
deleted backup piece
backup piece handle=/opt/oracle/product/9.2.0/dbs/e7g283jl_1_1 recid=451 stamp=539233910
Deleted 38 objects

      

 

 


历史上的今天...
    >> 2015-10-12文章:
    >> 2009-10-12文章:
    >> 2008-10-12文章:
    >> 2006-10-12文章:
    >> 2005-10-12文章:

无觅

By eygle on 2004-10-12 11:40 | Comments (1) | Backup&Recovery | 1274 |

1 Comment

我只想删除无效的备份,而不删除归档日志该如何?
delete obsolete 会把无效的备份集,归档日志,控制文件等一起删除掉。

有没有delete obsolete of backupset ?


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com