Chinaunix首页 | 论坛 | 博客
  • 博客访问: 413428
  • 博文数量: 65
  • 博客积分: 2711
  • 博客等级: 少校
  • 技术积分: 745
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-02 10:02
文章分类

全部博文(65)

文章存档

2013年(4)

2012年(3)

2011年(24)

2010年(21)

2009年(11)

2008年(2)

分类: Oracle

2010-05-21 16:39:39

用rman备份,不适用catalog,如果备份路径发生了改变,需要catalog start with从新注册,但是控制文件中以前的备份信息还在,如何删除这些备份信息?如下:
RMAN> list backup;

List of Backup Sets
===================
BS Key  Type LV Size
------- ---- -- ----------
1       Incr 0  726.37M
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1    0  Incr 66023842   2010-05-04 12:43:40 /u00/oracle/standbydb/system01.dbf
  2    0  Incr 66023842   2010-05-04 12:43:40 /u00/oracle/standbydb/undotbs01.dbf
  3    0  Incr 66023842   2010-05-04 12:43:40 /u00/oracle/standbydb/sysaux01.dbf
  4    0  Incr 66023842   2010-05-04 12:43:40 /u00/oracle/standbydb/users01.dbf
  5    0  Incr 66023842   2010-05-04 12:43:40 /u00/oracle/standbydb/example01.dbf
  7    0  Incr 66023842   2010-05-04 12:43:40 /u00/oracle/standbydb/rman.dbf
  12   0  Incr 66023842   2010-05-04 12:43:40 /u00/oracle/standbydb/lizi.dbf
  Backup Set Copy #1 of backup set 1
  Device Type Elapsed Time Completion Time     Compressed Tag
  ----------- ------------ ------------------- ---------- ---
  DISK        00:05:50     2010-05-06 04:25:07 NO         TAG20100506T041916
    List of Backup Pieces for backup set 1 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    1       1   EXPIRED     /u00/dbbackup/221-back/01lcvgi5_1_1
  Backup Set Copy #2 of backup set 1
  Device Type Elapsed Time Completion Time     Compressed Tag
  ----------- ------------ ------------------- ---------- ---
  DISK        00:05:50     2010-05-11 09:01:38 NO         TAG20100506T041916
    List of Backup Pieces for backup set 1 Copy #2
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    7       1   EXPIRED     /u00/dbbackup/221--back/01lcvgi5_1_1
BS Key  Type LV Size
------- ---- -- ----------
2       Incr 0  7.11M
  Control File Included: Ckp SCN: 66023842     Ckp time: 2010-05-04 12:43:40
  SPFILE Included: Modification time: 2010-05-06 04:17:27
  Backup Set Copy #1 of backup set 2
  Device Type Elapsed Time Completion Time     Compressed Tag
  ----------- ------------ ------------------- ---------- ---
  DISK        00:00:06     2010-05-06 04:25:22 NO         TAG20100506T041916
    List of Backup Pieces for backup set 2 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    2       1   EXPIRED     /u00/dbbackup/221-back/02lcvgtc_1_1
  Backup Set Copy #2 of backup set 2
  Device Type Elapsed Time Completion Time     Compressed Tag
  ----------- ------------ ------------------- ---------- ---
  DISK        00:00:06     2010-05-11 09:01:41 NO         TAG20100506T041916
    List of Backup Pieces for backup set 2 Copy #2
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    8       1   EXPIRED     /u00/dbbackup/221--back/02lcvgtc_1_1
BS Key  Type LV Size
------- ---- -- ----------
3       Incr 1  80.00K
  List of Datafiles in backup set 3
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1    1  Incr 66023843   2010-05-07 08:48:14 /u00/oracle/standbydb/system01.dbf
  2    1  Incr 66023843   2010-05-07 08:48:14 /u00/oracle/standbydb/undotbs01.dbf
  3    1  Incr 66023843   2010-05-07 08:48:14 /u00/oracle/standbydb/sysaux01.dbf
  4    1  Incr 66023843   2010-05-07 08:48:14 /u00/oracle/standbydb/users01.dbf
  5    1  Incr 66023843   2010-05-07 08:48:14 /u00/oracle/standbydb/example01.dbf
  7    1  Incr 66023843   2010-05-07 08:48:14 /u00/oracle/standbydb/rman.dbf
  12   1  Incr 66023843   2010-05-07 08:48:14 /u00/oracle/standbydb/lizi.dbf
  Backup Set Copy #1 of backup set 3
  Device Type Elapsed Time Completion Time     Compressed Tag
  ----------- ------------ ------------------- ---------- ---
  DISK        00:06:03     2010-05-07 08:57:48 NO         TAG20100507T085144
    List of Backup Pieces for backup set 3 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    3       1   EXPIRED     /u00/dbbackup/221-back/03ld2kt1_1_1
  Backup Set Copy #2 of backup set 3
  Device Type Elapsed Time Completion Time     Compressed Tag
  ----------- ------------ ------------------- ---------- ---
  DISK        00:06:03     2010-05-11 09:01:38 NO         TAG20100507T085144
    List of Backup Pieces for backup set 3 Copy #2
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    6       1   EXPIRED     /u00/dbbackup/221--back/03ld2kt1_1_1
BS Key  Type LV Size
------- ---- -- ----------
4       Incr 1  7.11M
  Control File Included: Ckp SCN: 66023979     Ckp time: 2010-05-07 08:48:38
  SPFILE Included: Modification time: 2010-05-07 08:50:33
  Backup Set Copy #1 of backup set 4
  Device Type Elapsed Time Completion Time     Compressed Tag
  ----------- ------------ ------------------- ---------- ---
  DISK        00:00:05     2010-05-07 08:57:57 NO         TAG20100507T085144
    List of Backup Pieces for backup set 4 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    4       1   EXPIRED     /u00/dbbackup/221-back/04ld2l8g_1_1
  Backup Set Copy #2 of backup set 4
  Device Type Elapsed Time Completion Time     Compressed Tag
  ----------- ------------ ------------------- ---------- ---
  DISK        00:00:05     2010-05-11 09:01:39 NO         TAG20100507T085144
    List of Backup Pieces for backup set 4 Copy #2
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    5       1   EXPIRED     /u00/dbbackup/221--back/04ld2l8g_1_1
RMAN> crosscheck backup;
using channel ORA_DISK_1
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u00/dbbackup/221-back/01lcvgi5_1_1 recid=1 stamp=718258757
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u00/dbbackup/221--back/01lcvgi5_1_1 recid=7 stamp=718707697
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u00/dbbackup/221-back/02lcvgtc_1_1 recid=2 stamp=718259118
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u00/dbbackup/221--back/02lcvgtc_1_1 recid=8 stamp=718707699
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u00/dbbackup/221-back/03ld2kt1_1_1 recid=3 stamp=718361505
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u00/dbbackup/221--back/03ld2kt1_1_1 recid=6 stamp=718707695
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u00/dbbackup/221-back/04ld2l8g_1_1 recid=4 stamp=718361874
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u00/dbbackup/221--back/04ld2l8g_1_1 recid=5 stamp=718707695
Crosschecked 8 objects

RMAN> DELETE EXPIRED BACKUP;
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1       1       1   1   EXPIRED     DISK        /u00/dbbackup/221-back/01lcvgi5_1_1
7       1       1   2   EXPIRED     DISK        /u00/dbbackup/221--back/01lcvgi5_1_1
2       2       1   1   EXPIRED     DISK        /u00/dbbackup/221-back/02lcvgtc_1_1
8       2       1   2   EXPIRED     DISK        /u00/dbbackup/221--back/02lcvgtc_1_1
3       3       1   1   EXPIRED     DISK        /u00/dbbackup/221-back/03ld2kt1_1_1
6       3       1   2   EXPIRED     DISK        /u00/dbbackup/221--back/03ld2kt1_1_1
4       4       1   1   EXPIRED     DISK        /u00/dbbackup/221-back/04ld2l8g_1_1
5       4       1   2   EXPIRED     DISK        /u00/dbbackup/221--back/04ld2l8g_1_1
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u00/dbbackup/221-back/01lcvgi5_1_1 recid=1 stamp=718258757
deleted backup piece
backup piece handle=/u00/dbbackup/221--back/01lcvgi5_1_1 recid=7 stamp=718707697
deleted backup piece
backup piece handle=/u00/dbbackup/221-back/02lcvgtc_1_1 recid=2 stamp=718259118
deleted backup piece
backup piece handle=/u00/dbbackup/221--back/02lcvgtc_1_1 recid=8 stamp=718707699
deleted backup piece
backup piece handle=/u00/dbbackup/221-back/03ld2kt1_1_1 recid=3 stamp=718361505
deleted backup piece
backup piece handle=/u00/dbbackup/221--back/03ld2kt1_1_1 recid=6 stamp=718707695
deleted backup piece
backup piece handle=/u00/dbbackup/221-back/04ld2l8g_1_1 recid=4 stamp=718361874
deleted backup piece
backup piece handle=/u00/dbbackup/221--back/04ld2l8g_1_1 recid=5 stamp=718707695
Deleted 8 EXPIRED objects

RMAN> list backup;

RMAN>
 
 
 
注意:rman中list backup命令是列出多有备份媒体上的所有备份集,如果备份媒体既有磁盘,又有磁带机,则类似如下:
 
bash-3.00$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Wed Nov 17 13:52:03 2010
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: PRIDB (DBID=942177643)
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================

BS Key  Size       Device Type Elapsed Time Completion Time   
------- ---------- ----------- ------------ -------------------
6       116.50K    DISK        00:00:01     2010-10-15 09:17:10
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20101015T091709
        Piece Name: /export/home/oracle/rmanback/arch05lqgfgl_1_1
  List of Archived Logs in backup set 6
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    23      1574690    2010-10-15 09:10:37 1574937    2010-10-15 09:13:31
  1    24      1574937    2010-10-15 09:13:31 1575174    2010-10-15 09:16:58
BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
7       Full    366.75M    SBT_TAPE    00:00:19     2010-10-18 16:49:57
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20101018T164938
        Handle: FULL_PRIDB_09lqp752_1_1   Media:
  List of Datafiles in backup set 7
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1       Full 2307747    2010-10-18 16:49:38 +SYS/pridb/system01.dbf
  4       Full 2307747    2010-10-18 16:49:38 +SYS/pridb/users01.dbf
 
而delete backup命令是删除你的show all命令显示出来的默认的config备份路径中的备份集,因此,如果想删除所有备份媒体中的备份集,必须用先指定其他的备份媒体路径在进行删除。类似脚本如下:
RUN {
ALLOCATE CHANNEL CH1 TYPE 'SBT_TAPE';
DELETE BACKUP;
crosscheck backup;
DELETE EXPIRED BACKUP;
RELEASE CHANNEL CH1;
}
阅读(3509) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~