本文是原创文章,转载请注明出处:http://write.blog.csdn.net/postedit/42424083
本文基于Oracle 10.2.0.4版本进行如下的测试:
RMAN> list backup of archivelog all; 中间略去很多,只保留下面的这个: BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 1410 326.36M DISK 00:00:41 05-JAN-15 BP Key: 1409 Status: AVAILABLE Compressed: NO Tag: TAG20150105T102705 -------------------->BP Key: 1409 Piece Name: F:\LOG_FIPRUSNS_1_1 List of Archived Logs in backup set 1410 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 1191 23261014 25-DEC-14 23279746 26-DEC-14 1 1192 23279746 26-DEC-14 23293125 03-JAN-15 1 1193 23293125 03-JAN-15 23296401 03-JAN-15 1 1194 23296401 03-JAN-15 23300534 03-JAN-15 1 1195 23300534 03-JAN-15 23304302 03-JAN-15 1 1196 23304302 03-JAN-15 23308204 03-JAN-15 1 1197 23308204 03-JAN-15 23316571 03-JAN-15 1 1198 23316571 03-JAN-15 23316578 03-JAN-15 1 1199 23316578 03-JAN-15 23343180 04-JAN-15 1 1200 23343180 04-JAN-15 23367540 05-JAN-15 1 1201 23367540 05-JAN-15 23368004 05-JAN-15 1 1202 23368004 05-JAN-15 23368006 05-JAN-15 1 1203 23368006 05-JAN-15 23368009 05-JAN-15 1 1204 23368009 05-JAN-15 23368011 05-JAN-15 1 1205 23368011 05-JAN-15 23369315 05-JAN-15 RMAN> change backuppiece 1409 uncatalog; -->uncatalog 的含义是删除在控制文件中的记录,对os上的备份文件不会动!(不会删除os上的备份文件) uncataloged backuppiece backup piece handle=F:\LOG_FIPRUSNS_1_1 recid=1409 stamp=868184831 Uncataloged 1 objects RMAN> list backup of archivelog all;
让该备份文件回来的方法:
RMAN> catalog backuppiece 'F:\LOG_FIPRUSNS_1_1'; cataloged backuppiece backup piece handle=F:\LOG_FIPRUSNS_1_1 recid=1413 stamp=868188578 ----->该命令可以多次执行,每次执行recid 加1 RMAN> catalog backuppiece 'F:\LOG_FIPRUSNS_1_1'; cataloged backuppiece backup piece handle=F:\LOG_FIPRUSNS_1_1 recid=1414 stamp=868188598 ----->该命令可以多次执行,每次执行recid 加1
下面看catalog回来后BSkey 和BP Key 的变化:
RMAN> list backup of archivelog all; 中间略去很多,只保留下面的这个: BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 1410 326.36M DISK 00:00:41 05-JAN-15 -------------------->BS Key: 1410 ,BS Key编号没变 BP Key: 1414 Status: AVAILABLE Compressed: NO Tag: TAG20150105T102705------->BP Key: 1414 ,BP Key编号变了,加1 Piece Name: F:\LOG_FIPRUSNS_1_1 List of Archived Logs in backup set 1410 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 1191 23261014 25-DEC-14 23279746 26-DEC-14 1 1192 23279746 26-DEC-14 23293125 03-JAN-15 1 1193 23293125 03-JAN-15 23296401 03-JAN-15 1 1194 23296401 03-JAN-15 23300534 03-JAN-15 1 1195 23300534 03-JAN-15 23304302 03-JAN-15 1 1196 23304302 03-JAN-15 23308204 03-JAN-15 1 1197 23308204 03-JAN-15 23316571 03-JAN-15 1 1198 23316571 03-JAN-15 23316578 03-JAN-15 1 1199 23316578 03-JAN-15 23343180 04-JAN-15 1 1200 23343180 04-JAN-15 23367540 05-JAN-15 1 1201 23367540 05-JAN-15 23368004 05-JAN-15 1 1202 23368004 05-JAN-15 23368006 05-JAN-15 1 1203 23368006 05-JAN-15 23368009 05-JAN-15 1 1204 23368009 05-JAN-15 23368011 05-JAN-15 1 1205 23368011 05-JAN-15 23369315 05-JAN-15
下面测试backupset 从catalog中撤销:
RMAN> change backupset 1410 uncatalog; ---------------------->backupset 不能用change uncatalog!!! RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of uncatalog command at 01/05/2015 14:14:31 RMAN-06122: CHANGE .. UNCATALOG not supported for BACKUPSET RMAN> change backupset 1410 delete; -->change backupset delete 的效果包括2个层面:删除在控制文件中的记录,删除os上的备份文件! using channel ORA_DISK_1 List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 1414 1410 1 1 AVAILABLE DISK F:\LOG_FIPRUSNS_1_1 Do you really want to delete the above objects (enter YES or NO)? yes deleted backup piece backup piece handle=F:\LOG_FIPRUSNS_1_1 recid=1414 stamp=868188598 Deleted 1 objects RMAN> ----此时,os上的F:\LOG_FIPRUSNS_1_1这个文件已经被删除了。
若是在change backupset delete 之前,手工拷贝了该backuppiece,然后change backupset delete ,之后,想注册回来的方法是:
RMAN> catalog backupset 'G:\LOG_FIPRUSNS_1_1'; -------------->没有catalog backupset这个命令。 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-00558: error encountered while parsing input commands RMAN-01009: syntax error: found "backupset": expecting one of: "archivelog, back up, backuppiece, controlfilecopy, clone, datafilecopy, device, db_recovery_file_ dest, recovery, start" RMAN-01007: at line 1 column 9 file: standard input RMAN> catalog backuppiece 'G:\LOG_FIPRUSNS_1_1'; ---> 跟上面一样的 catalog backuppiece 命令,只是换成了G盘下的。G盘下的该文件是事先手工拷贝出来的。 cataloged backuppiece backup piece handle=G:\LOG_FIPRUSNS_1_1 recid=1415 stamp=868200682 下面查看BS Key 和BP Key RMAN> list backup of archivelog all; 中间略去很多,只保留下面的这个: BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 1410 326.36M DISK 00:00:41 05-JAN-15 ----------------->BS Key: 1410 ,BS Key编号一直没变。 BP Key: 1415 Status: AVAILABLE Compressed: NO Tag: TAG20150105T10270--->BP Key: 1415 ,BP Key编号变了,加1了。 Piece Name: G:\LOG_FIPRUSNS_1_1 List of Archived Logs in backup set 1410 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 1191 23261014 25-DEC-14 23279746 26-DEC-14 1 1192 23279746 26-DEC-14 23293125 03-JAN-15 1 1193 23293125 03-JAN-15 23296401 03-JAN-15 1 1194 23296401 03-JAN-15 23300534 03-JAN-15 1 1195 23300534 03-JAN-15 23304302 03-JAN-15 1 1196 23304302 03-JAN-15 23308204 03-JAN-15 1 1197 23308204 03-JAN-15 23316571 03-JAN-15 1 1198 23316571 03-JAN-15 23316578 03-JAN-15 1 1199 23316578 03-JAN-15 23343180 04-JAN-15 1 1200 23343180 04-JAN-15 23367540 05-JAN-15 1 1201 23367540 05-JAN-15 23368004 05-JAN-15 1 1202 23368004 05-JAN-15 23368006 05-JAN-15 1 1203 23368006 05-JAN-15 23368009 05-JAN-15 1 1204 23368009 05-JAN-15 23368011 05-JAN-15 1 1205 23368011 05-JAN-15 23369315 05-JAN-15 RMAN>
总结:
1. change backuppiece 1409 uncatalog; -->uncatalog 的含义是删除在控制文件中的记录,对os上的备份文件不会动!(不会删除os上的备份文件) 2. backupset 不能用change uncatalog!!backupset只能用下面的change delete!!! 3. change backupset 1410 delete; -->change backupset delete 的效果包括2个层面:删除在控制文件中的记录,删除os上的备份文件! 4. BP Key 这个会随着每次“ catalog backuppiece”的成功执行而递增,因此,BP Key不是保留在备份片中的。 5. BS Key 这个不会随着 每次“ catalog backuppiece”的成功执行而变化,因此,BS Key 是保留在备份片中的。
时间: 2024-10-06 22:22:01