Oracle RMAN 中change backupset unavailable 测试和相关命令用法

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:66

RMAN 中change backupset unavailable 测试和相关命令用法

比如我有两个备份集,数据库在恢复时是按默认最新的备份集来恢复,但这时如果我想
要比这个更早点的备份集来恢复,那就可以用到change 某个备份集不可用了
具体还是看业务需要
以下是测试过程
[indent]PHP code:
RMAN> change backupset 96,97 unavailable;

changed backup piece unavailable

backup piece handle=D:BACKUP34JI2ROR_1_1 recid=96 stamp=656502555

changed backup piece unavailable

backup piece handle=D:BACKUPC-799229701-20080604-03 recid=97 stamp=656502580

Changed 2 objects to UNAVAILABLE status

RMAN> list backup summary;

List of Backups

===============

Key TY LV S Device Type Completion Time #Pieces #Copies Tag

------- -- -- - ----------- --------------- ------- ------- ---

94 B F A DISK 04-JUN-08 1 1 [color=#000066][color=#ff9900]TAG20080604T094245

95 B F A DISK 04-JUN-08 1 1

96 B F U DISK 04-JUN-08 1 1 TAG20080604T094915

97 B F U DISK 04-JUN-08 1 1

RMAN> exit

状态U 表示不可用

Recovery Manager complete.

RMAN> startup nomount;

Oracle instance started

Total System Global Area 101785012 bytes

Fixed Size 454068 bytes

Variable Size 75497472 bytes

Database Buffers 25165824 bytes

Redo Buffers 667648 bytes

RMAN> alter database mount;

database mounted

RMAN> restore database;

Starting restore at 04-JUN-08

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to D:ORACLEORADATAPUBTESTSYSTEM01.DBF

restoring datafile 00002 to D:ORACLEORADATAPUBTESTUNDOTBS01.DBF

restoring datafile 00003 to D:ORACLEORADATAPUBTESTEXAMPLE01.DBF

restoring datafile 00004 to D:ORACLEORADATAPUBTESTINDX01.DBF

restoring datafile 00005 to D:ORACLEORADATAPUBTESTTOOLS01.DBF

restoring datafile 00006 to D:ORACLEORADATAPUBTESTUSERS01.DBF

channel ORA_DISK_1: restored backup piece 1

piece handle=D:BACKUP32JI2RCM_1_1 tag=[color=#ff9933]TAG20080604T094245 params=NULL

channel ORA_DISK_1: restore complete

Finished restore at 04-JUN-08

与可用的tag 备份集名一致

RMAN> recover database;

Starting recover at 04-JUN-08

using channel ORA_DISK_1

starting media recovery

media recovery complete

Finished recover at 04-JUN-08

RMAN> alter database open;

database opened

RMAN>
[/indent][indent] 1. list backup of database;
2. change backupset 2 keep forever logs; --備份集2不受冗余策略的影響永遠有效()
change backupset 2 keep until time 'sysdate+7' logs; --備份集2不受冗余策略的影響在超出正常日期7天內有效
change backupset 2 nokeep; --變更備份集2為廢棄狀態(為無效狀態可以用delete obsete來刪除)
3. delete obsolete; --刪除所有無效的備份集
4. backup database keep forever;
backup database keep unitl time "to_date('01/01/05','mm/dd/yy')";
backup database keep 5 days;

5. change backup of database tag='whole_db' unavailable;
change backup of database like '%GOLD%' unavailable;
change backupset 2 unavailable;
change backupset 2 available;
change archivelog '/cfs01/oradata/archive/2_8.log' unavailable;
change archivelog all backed up 5 times to device type disk unavailable;
change backup of database device type disk unavailable;
change backupset 2,3 delete; --刪除指定的備份集(物理刪除備份文件)
change backuppiece 3 delete; --刪除備份片3(物理刪除備份文件)
change archivelog until logseq=3 thead=1 delete;
[/indent]

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】