Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5205362
  • 博文数量: 1004
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13042
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1004)

文章存档

2020年(1)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: Oracle

2011-12-02 10:43:58

步骤1:物理删除最近的备份集

[oracle@rac1 20111201]$ pwd
/u01/rman_backup/2011/201112/20111201
[oracle@rac1 20111201]$ ls
df_768745379_10_1.bak df_768745458_11_1.bak
df_768745379_9_1.bak df_768745460_12_1.bak
[oracle@rac1 20111201]$ rm -rf ./*
[oracle@rac1 20111201]$ ls

 

步骤2:list backup发现步骤1删除的备份集还在数据库备份信息中存在记录(Status: AVAILABLE)

RMAN> list backup;


List of Backup Sets
===================

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 351.26M DISK 00:00:51 30-NOV-11
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589674_5_1.bak
List of Datafiles in backup set 4
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/system01.dbf
4 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/users01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 173.91M DISK 00:00:55 30-NOV-11
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589674_6_1.bak
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/undotbs01.dbf
3 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/sysaux01.dbf
5 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/hxl01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 6.77M DISK 00:00:03 30-NOV-11
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589733_7_1.bak
Control File Included: Ckp SCN: 530571 Ckp time: 30-NOV-11

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7 Full 80.00K DISK 00:00:02 30-NOV-11
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589735_8_1.bak
SPFILE Included: Modification time: 30-NOV-11

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8 Full 351.32M DISK 00:01:06 01-DEC-11
BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20111201T122257
Piece Name: /u01/rman_backup/2011/201112/20111201/df_768745379_9_1.bak
List of Datafiles in backup set 8
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/system01.dbf
4 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/users01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9 Full 175.04M DISK 00:01:10 01-DEC-11
BP Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20111201T122257
Piece Name:
/u01/rman_backup/2011/201112/20111201/df_768745379_10_1.bak
List of Datafiles in backup set 9
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/undotbs01.dbf
3 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/sysaux01.dbf
5 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/hxl01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10 Full 6.77M DISK 00:00:05 01-DEC-11
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20111201T122257
Piece Name: /u01/rman_backup/2011/201112/20111201/df_768745458_11_1.bak
Control File Included: Ckp SCN: 557564 Ckp time: 01-DEC-11

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11 Full 80.00K DISK 00:00:03 01-DEC-11
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20111201T122257
Piece Name:
/u01/rman_backup/2011/201112/20111201/df_768745460_12_1.bak
SPFILE Included: Modification time: 01-DEC-11

步骤3:crosscheck backupset

RMAN> crosscheck backupset;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rman_backup/2011/201111/df_768589674_5_1.bak recid=4 stamp=768589674
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rman_backup/2011/201111/df_768589674_6_1.bak recid=5 stamp=768589674
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rman_backup/2011/201111/df_768589733_7_1.bak recid=6 stamp=768589735
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/rman_backup/2011/201111/df_768589735_8_1.bak recid=7 stamp=768589737
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/rman_backup/2011/201112/20111201/df_768745379_9_1.bak recid=8 stamp=768745379
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/rman_backup/2011/201112/20111201/df_768745379_10_1.bak recid=9 stamp=768745379
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/rman_backup/2011/201112/20111201/df_768745458_11_1.bak recid=10 stamp=768745460
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/rman_backup/2011/201112/20111201/df_768745460_12_1.bak recid=11 stamp=768745462
Crosschecked 8 objects

步骤4:再次list backup(状态为Status: EXPIRED)

RMAN> list backup;


List of Backup Sets
===================

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 351.26M DISK 00:00:51 30-NOV-11
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589674_5_1.bak
List of Datafiles in backup set 4
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/system01.dbf
4 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/users01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 173.91M DISK 00:00:55 30-NOV-11
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589674_6_1.bak
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/undotbs01.dbf
3 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/sysaux01.dbf
5 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/hxl01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 6.77M DISK 00:00:03 30-NOV-11
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589733_7_1.bak
Control File Included: Ckp SCN: 530571 Ckp time: 30-NOV-11

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7 Full 80.00K DISK 00:00:02 30-NOV-11
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589735_8_1.bak
SPFILE Included: Modification time: 30-NOV-11

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8 Full 351.32M DISK 00:01:06 01-DEC-11
BP Key: 8 Status: EXPIRED Compressed: NO Tag: TAG20111201T122257
Piece Name: /u01/rman_backup/2011/201112/20111201/df_768745379_9_1.bak
List of Datafiles in backup set 8
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/system01.dbf
4 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/users01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9 Full 175.04M DISK 00:01:10 01-DEC-11
BP Key: 9 Status: EXPIRED Compressed: NO Tag: TAG20111201T122257
Piece Name: /u01/rman_backup/2011/201112/20111201/df_768745379_10_1.bak
List of Datafiles in backup set 9
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/undotbs01.dbf
3 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/sysaux01.dbf
5 Full 557564 01-DEC-11 /u01/app/oracle/oradata/oracl/hxl01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10 Full 6.77M DISK 00:00:05 01-DEC-11
BP Key: 10 Status: EXPIRED Compressed: NO Tag: TAG20111201T122257
Piece Name: /u01/rman_backup/2011/201112/20111201/df_768745458_11_1.bak
Control File Included: Ckp SCN: 557564 Ckp time: 01-DEC-11

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11 Full 80.00K DISK 00:00:03 01-DEC-11
BP Key: 11 Status: EXPIRED Compressed: NO Tag: TAG20111201T122257
Piece Name: /u01/rman_backup/2011/201112/20111201/df_768745460_12_1.bak
SPFILE Included: Modification time: 01-DEC-11

步骤5:删除标记为EXPIRED的备份集

RMAN> delete expired backupset;

using channel ORA_DISK_1

List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
8 8 1 1 EXPIRED DISK /u01/rman_backup/2011/201112/2011120 1/df_768745379_9_1.bak
9 9 1 1 EXPIRED DISK /u01/rman_backup/2011/201112/2011120 1/df_768745379_10_1.bak
10 10 1 1 EXPIRED DISK /u01/rman_backup/2011/201112/2011120 1/df_768745458_11_1.bak
11 11 1 1 EXPIRED DISK /u01/rman_backup/2011/201112/2011120 1/df_768745460_12_1.bak

Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/u01/rman_backup/2011/201112/20111201/df_768745379_9_1.bak recid =8 stamp=768745379
deleted backup piece
backup piece handle=/u01/rman_backup/2011/201112/20111201/df_768745379_10_1.bak reci d=9 stamp=768745379
deleted backup piece
backup piece handle=/u01/rman_backup/2011/201112/20111201/df_768745458_11_1.bak reci d=10 stamp=768745460
deleted backup piece
backup piece handle=/u01/rman_backup/2011/201112/20111201/df_768745460_12_1.bak reci d=11 stamp=768745462
Deleted 4 EXPIRED objects

步骤6:再次list backup发现物理删除的备份集已经从控制文件记录中去除(我这里没有使用catalog,备份信息记录在控制文件).

RMAN> list backup;


List of Backup Sets
===================

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 351.26M DISK 00:00:51 30-NOV-11
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589674_5_1.bak
List of Datafiles in backup set 4
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/system01.dbf
4 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/users01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 173.91M DISK 00:00:55 30-NOV-11
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589674_6_1.bak
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/undotbs01.dbf
3 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/sysaux01.dbf
5 Full 530571 30-NOV-11 /u01/app/oracle/oradata/oracl/hxl01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 6.77M DISK 00:00:03 30-NOV-11
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589733_7_1.bak
Control File Included: Ckp SCN: 530571 Ckp time: 30-NOV-11

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7 Full 80.00K DISK 00:00:02 30-NOV-11
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20111130T170752
Piece Name: /u01/rman_backup/2011/201111/df_768589735_8_1.bak
SPFILE Included: Modification time: 30-NOV-11

总结:物理删除备份集后,需要执行crosscheck backupset才能更新控制文件或是catalog里记录的控制信息.

阅读(1923) | 评论(2) | 转发(2) |
给主人留下些什么吧!~~

hxl2011-12-04 11:47:57

背包包1112011-12-04 03:19:08

是要经常备份啊!