第十三章: Rman 维护

1、rman 使用和维护

2、list  查看备份信息
  1)RMAN> list backup;
  2)RMAN> list backup of tablespace users;
  3)RMAN> list backup of datafile 2;
  4)RMAN> list backup of controlfile;
  5) RMAN> list backup of archivelog all;
  6)RMAN> list backup of archivelog until time ='sysdate -1';
  7)RMAN> list backupset 56;
  8)RMAN> list copy;
  9)RMAN> list copy of tablespace users;
  10)RMAN> list copy of datafile 1;
  11)RMAN> list datafilecopy 67;
  12)RMAN> list copy of controlfile;

3、crosscheck:用于检测备份状态(AVAILABLE:可用;UNAVAILABLE :不可用;expired 过期(备份已经被os 删除了)(防止备份在os下被误删除)
RMAN> crosscheck backup;
RMAN> crosscheck copy;

4、report
RMAN> report schema;  查看目标库的物理结构
RMAN> report need backup;  查看需要做备份的datafile
RMAN> report obsolete; 根据备份冗余策略来判断,那些备份是陈旧的(obsolete)

5、delete  ;删除备份
RMAN> delete backup of datafile 2;
RMAN> delete backup of tablespace system;
RMAN> delete backup ;
RMAN> delete backup of controlfile;
RMAN> delete noprompt backup of controlfile;     ;删除noprompt 不提示
RMAN> delete copy;
RMAN> delete copy of  datafile 10;
RMAN> delete copy of  tablespace users;
RMAN> delete expired backup; 删除过期的备份
RMAN> delete expired copy;
RMAN> delete  obsolete ;删除陈旧的备份
RMAN> delete  noprompt  obsolete; 删除不加提示
 
6、catalog :可以把手工备份的文件,转换到rman

-------将手工备份注册为p_w_picpath
RMAN> catalog datafilecopy '/disk1/backup/prod/hot_bak/users01.dbf';                                                                    

cataloged datafile copy
datafile copy filename=/disk1/backup/prod/hot_bak/users01.dbf recid=68 stamp=759556193

RMAN> list copy of datafile 2;                                                                                                          


List of Datafile Copies
Key     File S Completion Time Ckp SCN    Ckp Time        Name
------- ---- - --------------- ---------- --------------- ----
68      2    A 19-AUG-11       1457868    19-AUG-11       /disk1/backup/prod/hot_bak/users01.dbf

RMAN> delete copy of datafile 2;

-------将手工备份注册成备份集

RMAN> catalog backuppiece  '/disk1/backup/prod/hot_bak/users01.dbf';

---------注册目录下所有的备份(p_w_picpath)

RMAN> catalog start with ‘/disk1/backup/prod/hot_bak/’;

7、change: 修改备份状态
RMAN> change backupset 66 unAVAILABLE; 
RMAN> change backupset 66 AVAILABLE;