技阳的rman数据库出现删除rman备份失败,原因是出现SBT_TYPE的磁带备份。
[BEGIN] 2018/8/13 13:48:42
RMAN> list backup;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
8480 117.00M SBT_TAPE 00:00:11 03-AUG-18
BP Key: 9170 Status: AVAILABLE Compressed: NO Tag: TAG20180803T045555
Handle: 8249_ORCL_a2t9joer_1_1 Media: V_9139_26800
List of Archived Logs in backup set 8480
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 606 1919655867 03-AUG-18 1919656111 03-AUG-18
1 607 1919656111 03-AUG-18 1919656212 03-AUG-18
1 608 1919656212 03-AUG-18 1919666497 03-AUG-18
1 609 1919666497 03-AUG-18 1919666601 03-AUG-18
1 610 1919666601 03-AUG-18 1919746627 03-AUG-18
1 611 1919746627 03-AUG-18 1919746646 03-AUG-18
...省略部分内容...
RMAN> allocate channel for maintenance device type 'SBT_TAPE';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on ORA_MAINT_SBT_TAPE_2 channel at 08/13/2018 13:54:31
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27211: Failed to load Media Management Library
Additional information: 2
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 7 days
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 8480 03-AUG-18
Backup Piece 9170 03-AUG-18 8249_ORCL_a2t9joer_1_1
Backup Set 8481 03-AUG-18
Backup Piece 9171 03-AUG-18 8250_ORCL_a3t9jof6_1_1
...省略部分内容...
Backup Set 8742 06-AUG-18
Backup Piece 9432 06-AUG-18 8883_ORCL_i8t9sh7i_1_1
Backup Set 8744 06-AUG-18
Backup Piece 9434 06-AUG-18 8882_ORCL_i9t9sh7i_1_1
Backup Set 8743 06-AUG-18
Backup Piece 9433 06-AUG-18 c-1404877812-20180806-0a
Backup Set 8745 06-AUG-18
Backup Piece 9435 06-AUG-18 c-1404877812-20180806-0b
Backup Set 8747 06-AUG-18
Backup Piece 9437 06-AUG-18 8883_ORCL_idt9shrf_1_1
Backup Set 8748 06-AUG-18
Backup Piece 9438 06-AUG-18 c-1404877812-20180806-0c
Backup Set 8750 06-AUG-18
Backup Piece 9440 06-AUG-18 8882_ORCL_igt9shsf_1_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 08/13/2018 13:58:26
RMAN-06091: no channel allocated for maintenance (of an appropriate type)
RMAN> delete force backupset 9440;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 08/13/2018 13:59:06
RMAN-20215: backup set not found
RMAN-06159: error while looking up backup set
RMAN> delete force backupset 8750;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 08/13/2018 13:59:19
RMAN-06160: no backup pieces found for backup set key: 8750
RMAN> crosscheck backupset 8750;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of crosscheck command at 08/13/2018 13:59:56
RMAN-06160: no backup pieces found for backup set key: 8750
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 7 days
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 8480 03-AUG-18
Backup Piece 9170 03-AUG-18 8249_ORCL_a2t9joer_1_1
Backup Set 8481 03-AUG-18
Backup Piece 9171 03-AUG-18 8250_ORCL_a3t9jof6_1_1
...省略部分内容...
Backup Set 8748 06-AUG-18
Backup Piece 9438 06-AUG-18 c-1404877812-20180806-0c
Backup Set 8750 06-AUG-18
Backup Piece 9440 06-AUG-18 8882_ORCL_igt9shsf_1_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 08/13/2018 14:00:33
RMAN-06091: no channel allocated for maintenance (of an appropriate type)
RMAN> show all;
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f'; # default
[oracle@SHQTbobcat logs]$ vi rman_inc_1_20180813.log
[END] 2018/8/13 14:30:51
首先构造环境如下,相同操作执行两遍。
[oracle@oracle ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Aug 20 14:19:55 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROC (DBID=341599061)
RMAN> run{
2> allocate channel ch1 type 'sbt_tape' maxpiecesize=3072M PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/home/oracle/rman)";
3> backup incremental level 0 format '/home/oracle/rman/proc_%d_%s_%p_%t' database tag 'test';
4> release channel ch1;
5> }
using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=95 device type=SBT_TAPE
channel ch1: WARNING: Oracle Test Disk API
Starting backup at 20-AUG-18
channel ch1: starting incremental level 0 datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00007 name=/home/oracle/WMWHSE2_DATA.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/proc/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/proc/undotbs01.dbf
channel ch1: starting piece 1 at 20-AUG-18
channel ch1: finished piece 1 at 20-AUG-18
piece handle=/home/oracle/rman/proc_PROC_33_1_984666016 tag=TEST comment=API Version 2.0,MMS Version 8.1.3.0
channel ch1: backup set complete, elapsed time: 00:01:25
channel ch1: starting incremental level 0 datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/proc/system01.dbf
input datafile file number=00006 name=/home/oracle/test.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/proc/users01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/proc/sysaux01.dbf
channel ch1: starting piece 1 at 20-AUG-18
channel ch1: finished piece 1 at 20-AUG-18
piece handle=/home/oracle/rman/proc_PROC_34_1_984666101 tag=TEST comment=API Version 2.0,MMS Version 8.1.3.0
channel ch1: backup set complete, elapsed time: 00:01:26
channel ch1: starting incremental level 0 datafile backup set
channel ch1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ch1: starting piece 1 at 20-AUG-18
channel ch1: finished piece 1 at 20-AUG-18
piece handle=/home/oracle/rman/proc_PROC_35_1_984666187 tag=TEST comment=API Version 2.0,MMS Version 8.1.3.0
channel ch1: backup set complete, elapsed time: 00:00:03
Finished backup at 20-AUG-18
released channel: ch1
RMAN>
冗余策略如下:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
RMAN> crosscheck backup;
using channel ORA_DISK_1
specification does not match any backup in the repository
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log 5 15-AUG-18 /u01/app/oracle/archivelog/1_22_979397527.dbf
...省略部分内容...
Archive Log 103 17-AUG-18 /u01/app/oracle/archivelog/1_120_979397527.dbf
Archive Log 104 17-AUG-18 /u01/app/oracle/archivelog/1_121_979397527.dbf
Archive Log 105 20-AUG-18 /u01/app/oracle/archivelog/1_122_979397527.dbf
Backup Set 32 20-AUG-18
Backup Piece 32 20-AUG-18 /home/oracle/rman/proc_PROC_33_1_984666016
Backup Set 33 20-AUG-18
Backup Piece 33 20-AUG-18 /home/oracle/rman/proc_PROC_34_1_984666101
Backup Set 34 20-AUG-18
Backup Piece 34 20-AUG-18 /home/oracle/rman/proc_PROC_35_1_984666187
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log 5 15-AUG-18 /u01/app/oracle/archivelog/1_22_979397527.dbf
...省略部分内容...
Archive Log 103 17-AUG-18 /u01/app/oracle/archivelog/1_120_979397527.dbf
Archive Log 104 17-AUG-18 /u01/app/oracle/archivelog/1_121_979397527.dbf
Archive Log 105 20-AUG-18 /u01/app/oracle/archivelog/1_122_979397527.dbf
Backup Set 32 20-AUG-18
Backup Piece 32 20-AUG-18 /home/oracle/rman/proc_PROC_33_1_984666016
Backup Set 33 20-AUG-18
Backup Piece 33 20-AUG-18 /home/oracle/rman/proc_PROC_34_1_984666101
Backup Set 34 20-AUG-18
Backup Piece 34 20-AUG-18 /home/oracle/rman/proc_PROC_35_1_984666187
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 08/20/2018 14:37:01
RMAN-06091: no channel allocated for maintenance (of an appropriate type)
将磁盘上实际的备份文件删除,用crosscheck backup无法有效检查出问题来。
RMAN> crosscheck backup;
using channel ORA_DISK_1
specification does not match any backup in the repository
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
32 Incr 0 2.41G SBT_TAPE 00:01:15 20-AUG-18
BP Key: 32 Status: AVAILABLE Compressed: NO Tag: TEST
Handle: /home/oracle/rman/proc_PROC_33_1_984666016 Media: /rman,/home/oracle/rman/p
List of Datafiles in backup set 32
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
3 0 Incr 1325882 20-AUG-18 /u01/app/oracle/oradata/proc/undotbs01.dbf
5 0 Incr 1325882 20-AUG-18 /u01/app/oracle/oradata/proc/example01.dbf
7 0 Incr 1325882 20-AUG-18 /home/oracle/WMWHSE2_DATA.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
33 Incr 0 1.94G SBT_TAPE 00:01:21 20-AUG-18
BP Key: 33 Status: AVAILABLE Compressed: NO Tag: TEST
Handle: /home/oracle/rman/proc_PROC_34_1_984666101 Media: /rman,/home/oracle/rman/p
List of Datafiles in backup set 33
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 1325974 20-AUG-18 /u01/app/oracle/oradata/proc/system01.dbf
2 0 Incr 1325974 20-AUG-18 /u01/app/oracle/oradata/proc/sysaux01.dbf
4 0 Incr 1325974 20-AUG-18 /u01/app/oracle/oradata/proc/users01.dbf
...省略部分内容...
需要使用Oralce自带的磁带库入分配channel来删除即可。
RMAN> run{
2> allocate channel ch1 type 'sbt_tape' maxpiecesize=3072M PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/home/oracle/rman)";
3> crosscheck backup;
4> release channel ch1;
5> }
released channel: ORA_DISK_1
allocated channel: ch1
channel ch1: SID=95 device type=SBT_TAPE
channel ch1: WARNING: Oracle Test Disk API
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/rman/proc_PROC_33_1_984666016 RECID=32 STAMP=984666016
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/rman/proc_PROC_34_1_984666101 RECID=33 STAMP=984666102
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/rman/proc_PROC_35_1_984666187 RECID=34 STAMP=984666188
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/rman/proc_PROC_36_1_984666424 RECID=35 STAMP=984666424
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/rman/proc_PROC_37_1_984666499 RECID=36 STAMP=984666499
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/rman/proc_PROC_38_1_984666585 RECID=37 STAMP=984666586
Crosschecked 6 objects
released channel: ch1
再次检查状态已经是expired了。
RMAN> list expired backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
32 Incr 0 2.41G SBT_TAPE 00:01:15 20-AUG-18
BP Key: 32 Status: EXPIRED Compressed: NO Tag: TEST
Handle: /home/oracle/rman/proc_PROC_33_1_984666016 Media: /rman,/home/oracle/rman/p
List of Datafiles in backup set 32
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
3 0 Incr 1325882 20-AUG-18 /u01/app/oracle/oradata/proc/undotbs01.dbf
5 0 Incr 1325882 20-AUG-18 /u01/app/oracle/oradata/proc/example01.dbf
7 0 Incr 1325882 20-AUG-18 /home/oracle/WMWHSE2_DATA.dbf
...省略部分内容...
RMAN> run{
2> allocate channel ch1 type 'sbt_tape' maxpiecesize=3072M PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/home/oracle/rman)";
3> report obsolete;
4> release channel ch1;
5> }
allocated channel: ch1
channel ch1: SID=95 device type=SBT_TAPE
channel ch1: WARNING: Oracle Test Disk API
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
no obsolete backups found
released channel: ch1
RMAN> run{
2> allocate channel ch1 type 'sbt_tape' maxpiecesize=3072M PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/home/oracle/rman)";
3> delete expired backup;
4> release channel ch1;
5> }
allocated channel: ch1
channel ch1: SID=95 device type=SBT_TAPE
channel ch1: WARNING: Oracle Test Disk API
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
32 32 1 1 EXPIRED SBT_TAPE /home/oracle/rman/proc_PROC_33_1_984666016
33 33 1 1 EXPIRED SBT_TAPE /home/oracle/rman/proc_PROC_34_1_984666101
34 34 1 1 EXPIRED SBT_TAPE /home/oracle/rman/proc_PROC_35_1_984666187
35 35 1 1 EXPIRED SBT_TAPE /home/oracle/rman/proc_PROC_36_1_984666424
36 36 1 1 EXPIRED SBT_TAPE /home/oracle/rman/proc_PROC_37_1_984666499
37 37 1 1 EXPIRED SBT_TAPE /home/oracle/rman/proc_PROC_38_1_984666585
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/home/oracle/rman/proc_PROC_33_1_984666016 RECID=32 STAMP=984666016
deleted backup piece
backup piece handle=/home/oracle/rman/proc_PROC_34_1_984666101 RECID=33 STAMP=984666102
deleted backup piece
backup piece handle=/home/oracle/rman/proc_PROC_35_1_984666187 RECID=34 STAMP=984666188
deleted backup piece
backup piece handle=/home/oracle/rman/proc_PROC_36_1_984666424 RECID=35 STAMP=984666424
deleted backup piece
backup piece handle=/home/oracle/rman/proc_PROC_37_1_984666499 RECID=36 STAMP=984666499
deleted backup piece
backup piece handle=/home/oracle/rman/proc_PROC_38_1_984666585 RECID=37 STAMP=984666586
Deleted 6 EXPIRED objects
released channel: ch1
RMAN> list backup;
specification does not match any backup in the repository