分类: 服务器与存储
2008-06-14 14:01:56
LIST命令:
LIST BACKUP; # lists backup sets, image copies, and proxy copies LIST BACKUPSET; # lists only backup sets and proxy copies LIST COPY; # lists only disk copies LIST BACKUP BY FILE; # shows backup sets, proxy copies, and image copies LIST COPY BY FILE; # shows only disk copies LIST EXPIRED BACKUP; LIST EXPIRED BACKUP BY FILE; LIST BACKUP SUMMARY; # lists backup sets, proxy copies, and disk copies LIST EXPIRED BACKUP SUMMARY; LIST BACKUP OF DATABASE; # lists backups of all files in database LIST COPY OF DATAFILE 'ora_home/oradata/trgt/system01.dbf'; # lists copy of specified datafile LIST BACKUPSET 213; # lists specified backup set LIST DATAFILECOPY '/tmp/tools01.dbf'; # lists datafile copy LIST BACKUPSET TAG 'weekly_full_db_backup'; |
举个例子:
RMAN>list backup summary; RMAN> list backup summary; |
备份列表:
=============== 关键字 TY LV S 设备类型 完成时间 段数 副本数 压缩标记 ------- -- -- - ----------- ---------- ------- ------- ---------- --- 1 B F A DISK 02-1月 -07 1 1 NO TAG20070102T162107 2 B F A DISK 02-1月 -07 1 1 NO TAG20070102T162107 3 B F A DISK 03-1月 -07 1 1 NO TAG20070103T151828 4 B F A DISK 03-1月 -07 1 1 NO TAG20070103T151828 5 B F A DISK 03-1月 -07 1 1 NO TAG20070103T152054 ……………. 14 B A X DISK 04-1月 -07 1 1 NO TAG20070104T083259 15 B A X DISK 04-1月 -07 1 1 NO TAG20070104T083259 ……………. 79 B 0 A DISK 12-1月 -07 1 1 NO TAG20070112T135430 80 B 1 A DISK 12-1月 -07 1 1 NO TAG20070112T135540 B 表示 backup F 表示 FULL A 表示 archive log 0 1 表示 incremental backup S 说明备份状态 (A AVAILABLE X EXPIRED ) |
如果我们进行OPEN RESETLOGS方式恢复数据库,RMAN将会记录一个标记 (INCARNATION)。我们在做增量备份的时候,可以以当前的或者以前的标记做为基础;如果保留了足够的归档日志文件,我们也可以以当前的或者以前的标记进行恢复reset database to incarnation 1;关于这方面恢复我们将在以后进行详细示例阐述。
RMAN> LIST INCARNATION; |
如果这册了多个数据库我们用带有OF DATABASE参数的命令来区别不同数据库。
RMAN> LIST INCARNATION OF DATABASE prod3; RMAN> LIST INCARNATION OF DATABASE; DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time ------- ------- -------- ---------------- ------ ---------- ---------- 1 1 RDBMS 774627068 PARENT 1 21-OCT-03 2 2 RDBMS 774627068 CURRENT 173832 21-OCT-03 |
REPORT命令
报告需要备份的文件:
我们首先要执行交叉校验,然后可以利用REPORT命令报告需要备份的,RMAN根据我们的备份保留策略来给出结果。
CROSSCHECK BACKUP; # crosschecks backup sets and proxy copies CROSSCHECK COPY; # crosschecks only disk copies of archived redo logs, datafiles and control file RMAN>REPORT NEED BACKUP; RMAN 保留策略将应用于该命令 将 RMAN 保留策略设置为冗余 1 文件冗余备份少于1个 文件 #bkps 名称 ---- ----- ----------------------------------------------------- 5 0 E:\ORACLE\ORADATA\ROME\TEST.DBF |
我们也可以给出DAYS参数来按照我们的要求时间让RMAN给出需要备份的结果。如下例:
REPORT NEED BACKUP DAYS = 1 DATABASE; # needs min 1 days of logs to recover REPORT NEED BACKUP DAYS = 10 TABLESPACE SYSTEM; REPORT NEED BACKUP DAYS = 5 DATAFILE '…/tools01.dbf'; |
我们也可以报告那些文件需要进行增量备份:
REPORT NEED BACKUP INCREMENTAL = 1 DATABASE; REPORT NEED BACKUP INCREMENTAL = 3 TABLESPACE SYSTEM; REPORT NEED BACKUP INCREMENTAL = 5 DATAFILE '…/users01.dbf'; |
报告过期备份:
CROSSCHECK BACKUP; # lists backups that not needed to recover the database to within last week REPORT OBSOLETE RECOVERY WINDOW OF 7 DAYS; # lists backups that are superfluous because more than 2 copies are on tape REPORT OBSOLETE REDUNDANCY = 2 DEVICE TYPE sbt; |
ORPHAN参数报告在同一个标记 (INCARNATION)中间断的备份,前一个备份和后一个备份不连续,也就是说同一个标记(INCARNATION)中两个备份中间有被删除的备份。
REPORT OBSOLETE ORPHAN; |
删除过期备份:
# delete obsolete backups displayed when you issue REPORT OBSOLETE DELETE OBSOLETE; # delete obsolete backups according to a specified recovery window DELETE OBSOLETE RECOVERY WINDOW OF 7 DAYS; # delete obsolete backups according to a specified redundancy DELETE OBSOLETE REDUNDANCY = 2; |
报告数据库方案:
REPORT SCHEMA AT TIME 'SYSDATE-14'; # schema as it was two weeks ago REPORT SCHEMA AT SCN 1000; # schema as it was at scn 1000 REPORT SCHEMA AT SEQUENCE 100 THREAD 1; # schema as it was at sequence 100 REPORT SCHEMA AT SCN 1000; |