手动将backuppiece加入到catalog的过程演示

本文介绍如何在Oracle RMAN中恢复或重建控制文件后的备份记录,包括检查现有备份、更改备份目录名称、删除失效备份记录及重新加入备份记录到catalog的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在很多情况下,rman备份的catalog是使用控制文件的,有时需要恢复或重建控制文件等操作之后,rman的catalog丢失或不完整,如果backup piece还存在,可以使用catalog backupiece命令将这些备份加入到catalog中,下面演示一下整个过程:

大概步骤如下:

1、检查现有的备份,使用list backup命令和crosscheck发现备份都正常
2、用操作系统命令将备份的目录改名
3、删除失效的备份:因为备份目录已经改名了,crosscheck发现状态是EXPIRED的,使用delete命令将这些EXPIRED的备份都删除
4、使用catalog backuppiece命令将改过名的目录中的备份加入到catalog中
5、检查新加入的备份状态

具体操作过程如下:

[@more@]

1、检查现有的备份状态

[oracle@oracle rman]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Dec 16 10:25:31 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ORCL (DBID=1230089073)


RMAN> list backup summary;


List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
17 B 0 A DISK 01-DEC-09 1 1 NO TAG20091201T081946
18 B 0 A DISK 01-DEC-09 1 1 NO TAG20091201T081946
19 B 0 A DISK 01-DEC-09 1 1 NO TAG20091201T081946
21 B A A DISK 01-DEC-09 1 1 NO TAG20091201T082340
22 B A A DISK 01-DEC-09 1 1 NO TAG20091201T082340
23 B A A DISK 01-DEC-09 1 1 NO TAG20091201T082340
24 B F A DISK 01-DEC-09 1 1 NO TAG20091201T082401
25 B F A DISK 01-DEC-09 1 1 NO TAG20091201T082403

RMAN> crosscheck backup;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=138 devtype=DISK
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_17_1 recid=27 stamp=705752785
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_18_1 recid=28 stamp=705752787
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_19_1 recid=29 stamp=705752789
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_22_1 recid=31 stamp=705752794
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_21_1 recid=30 stamp=705752791
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_23_1 recid=32 stamp=705752795
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_spfile_orcl_20091201_704449441 recid=33 stamp=705752797
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_controlfile_orcl_20091201_704449444 recid=26 stamp=705752772
Crosschecked 8 objects


RMAN> exit


Recovery Manager complete.

2、用操作系统命令将备份的目录改名

[oracle@oracle rman]$ cd /oracle/flash_recovery_area/ORCL/
[oracle@oracle ORCL]$ ls -l
total 12
drwxr-x--- 6 oracle oinstall 4096 Dec 15 18:22 archivelog
drwxr-x--- 2 oracle oinstall 4096 Nov 7 13:39 onlinelog
drwxr-xr-x 2 oracle oinstall 4096 Dec 1 09:31 rman
[oracle@oracle ORCL]$ mv rman rman_bak

3、删除失效的备份

[oracle@oracle ORCL]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Dec 16 10:27:53 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ORCL (DBID=1230089073)

RMAN> crosscheck backup;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=137 devtype=DISK
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_17_1 recid=27 stamp=705752785
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_18_1 recid=28 stamp=705752787
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_19_1 recid=29 stamp=705752789
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_22_1 recid=31 stamp=705752794
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_21_1 recid=30 stamp=705752791
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_23_1 recid=32 stamp=705752795
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_spfile_orcl_20091201_704449441 recid=33 stamp=705752797
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_controlfile_orcl_20091201_704449444 recid=26 stamp=705752772
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
------- ------- --- --- ----------- ----------- ----------
27 17 1 1 EXPIRED DISK /oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_17_1
28 18 1 1 EXPIRED DISK /oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_18_1
29 19 1 1 EXPIRED DISK /oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_19_1
31 21 1 1 EXPIRED DISK /oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_22_1
30 22 1 1 EXPIRED DISK /oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_21_1
32 23 1 1 EXPIRED DISK /oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_23_1
33 24 1 1 EXPIRED DISK /oracle/flash_recovery_area/ORCL/rman/full_spfile_orcl_20091201_704449441
26 25 1 1 EXPIRED DISK /oracle/flash_recovery_area/ORCL/rman/full_controlfile_orcl_20091201_704449444

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_17_1 recid=27 stamp=705752785
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_18_1 recid=28 stamp=705752787
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_19_1 recid=29 stamp=705752789
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_22_1 recid=31 stamp=705752794
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_21_1 recid=30 stamp=705752791
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_orcl_20091201_23_1 recid=32 stamp=705752795
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_spfile_orcl_20091201_704449441 recid=33 stamp=705752797
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman/full_controlfile_orcl_20091201_704449444 recid=26 stamp=705752772
Deleted 8 EXPIRED objects


RMAN> list backup summary;


RMAN> exit


Recovery Manager complete.

4、使用catalog backuppiece命令将backuppiece加入catalog

[oracle@oracle ORCL]$ pwd
/oracle/flash_recovery_area/ORCL
[oracle@oracle ORCL]$ ls
archivelog onlinelog rman_bak
[oracle@oracle ORCL]$ cd rman_bak
[oracle@oracle rman_bak]$ ls
full_controlfile_orcl_20091201_704449444 full_orcl_20091201_21_1
full_orcl_20091201_17_1 full_orcl_20091201_22_1
full_orcl_20091201_18_1 full_orcl_20091201_23_1
full_orcl_20091201_19_1 full_spfile_orcl_20091201_704449441
[oracle@oracle rman_bak]$ ls -l
total 660484
-rw-r----- 1 oracle oinstall 7110656 Dec 1 08:24 full_controlfile_orcl_20091201_704449444
-rw-r----- 1 oracle oinstall 375693312 Dec 1 08:23 full_orcl_20091201_17_1
-rw-r----- 1 oracle oinstall 252444672 Dec 1 08:23 full_orcl_20091201_18_1
-rw-r----- 1 oracle oinstall 7110656 Dec 1 08:23 full_orcl_20091201_19_1
-rw-r----- 1 oracle oinstall 30318080 Dec 1 08:23 full_orcl_20091201_21_1
-rw-r----- 1 oracle oinstall 2505216 Dec 1 08:23 full_orcl_20091201_22_1
-rw-r----- 1 oracle oinstall 351232 Dec 1 08:23 full_orcl_20091201_23_1
-rw-r----- 1 oracle oinstall 98304 Dec 1 08:24 full_spfile_orcl_20091201_704449441
[oracle@oracle rman_bak]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Dec 16 10:30:04 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ORCL (DBID=1230089073)

RMAN> catalog backuppiece '/oracle/flash_recovery_area/ORCL/rman_bak/full_controlfile_orcl_20091201_704449444';

catalog backuppiece '/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_17_1';
catalog backuppiece '/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_18_1';
using target database control file instead of recovery catalog
catalog backuppiece '/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_19_1';
catalog backuppiece '/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_21_1';
catalog backuppiece '/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_22_1';
catalog backuppiece '/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_23_1';
catalog backuppiece '/oracle/flash_recovery_area/ORCL/rman_bak/full_spfile_orcl_20091201_704449441';

cataloged backuppiece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_controlfile_orcl_20091201_704449444 recid=34 stamp=705753014

RMAN>
cataloged backuppiece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_17_1 recid=35 stamp=705753015

RMAN>
cataloged backuppiece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_18_1 recid=36 stamp=705753017

RMAN>
cataloged backuppiece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_19_1 recid=37 stamp=705753021

RMAN>
cataloged backuppiece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_21_1 recid=38 stamp=705753022

RMAN>
cataloged backuppiece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_22_1 recid=39 stamp=705753026

RMAN>
cataloged backuppiece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_23_1 recid=40 stamp=705753027

RMAN>
cataloged backuppiece
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_spfile_orcl_20091201_704449441 recid=41 stamp=705753029

RMAN>
RMAN>

5、检查新加入的备份状态

RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
17 B 0 A DISK 01-DEC-09 1 1 NO TAG20091201T081946
18 B 0 A DISK 01-DEC-09 1 1 NO TAG20091201T081946
19 B 0 A DISK 01-DEC-09 1 1 NO TAG20091201T081946
21 B A A DISK 01-DEC-09 1 1 NO TAG20091201T082340
22 B A A DISK 01-DEC-09 1 1 NO TAG20091201T082340
23 B A A DISK 01-DEC-09 1 1 NO TAG20091201T082340
24 B F A DISK 01-DEC-09 1 1 NO TAG20091201T082401
25 B F A DISK 01-DEC-09 1 1 NO TAG20091201T082403

RMAN> crosscheck backup;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=138 devtype=DISK
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_17_1 recid=35 stamp=705753015
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_18_1 recid=36 stamp=705753017
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_19_1 recid=37 stamp=705753021
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_22_1 recid=39 stamp=705753026
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_21_1 recid=38 stamp=705753022
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_orcl_20091201_23_1 recid=40 stamp=705753027
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_spfile_orcl_20091201_704449441 recid=41 stamp=705753029
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/oracle/flash_recovery_area/ORCL/rman_bak/full_controlfile_orcl_20091201_704449444 recid=34 stamp=705753014
Crosschecked 8 objects


RMAN> exit


Recovery Manager complete.
[oracle@oracle rman_bak]$ exit
logout

-- end --

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22049049/viewspace-1029719/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22049049/viewspace-1029719/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值