Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

41

积分

0

好友

8

主题
1#
发表于 2012-7-19 17:14:31 | 查看: 6610| 回复: 6
hpux 11.23
oracle 9208 rac
情况是这样的:一套RAC,以前无备份无归档,现在要改为归档,定期做全备和增量,现在已经做完了0级备份,需要做1级增量,(很多年前这套系统在归档与不归档,备份与不备份之间折腾过很多次,所以有很多遗留的日志,备份等文件)我想把以前那些过期日志及备份都清除掉,当尝试下面操作时出现了下面的问题:
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 15 days
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: sid=73 devtype=SBT_TAPE
channel ORA_SBT_TAPE_1: NMO v4.1.0.0
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: sid=41 devtype=SBT_TAPE
channel ORA_SBT_TAPE_2: NMO v4.1.0.0
using channel ORA_DISK_1
using channel ORA_DISK_2
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           15153  07-11?-06        
  Backup Piece       15153  07-11?-06         /hddms1_15223_1/
Backup Set           15154  07-11?-06        
  Backup Piece       15154  07-11?-06         /hddms1_15221_1/
Backup Set           15155  07-11?-06        
  Backup Piece       15155  07-11?-06         /hddms1_15224_1/
Backup Set           15156  07-11?-06        
  Backup Piece       15156  07-11?-06         /NMO_c-3649627009-20061107-06/
Backup Set           15162  07-11?-06        
  Backup Piece       15162  07-11?-06         /NMO_c-3649627009-20061107-07/
Backup Set           15168  07-11?-06        
  Backup Piece       15168  07-11?-06         /NMO_c-3649627009-20061107-08/
Backup Set           15174  07-11?-06        
  Backup Piece       15174  07-11?-06         /NMO_c-3649627009-20061107-09/
Backup Set           15180  07-11?-06        
......
Backup Set           16091  03-4? -07        
  Backup Piece       16091  03-4? -07         /hddms1_arch_16195_1/
Backup Set           16092  03-4? -07        
  Backup Piece       16092  03-4? -07         /hddms1_arch_16197_1/
Backup Set           16094  03-4? -07        
  Backup Piece       16094  03-4? -07         /NMO_c-3649627009-20070403-05/
Backup Set           16100  10-4? -07        
  Backup Piece       16100  10-4? -07         /NMO_c-3649627009-20070410-00/
Do you really want to delete the above objects (enter YES or NO)? YES

Killed
等了很长时间也没啥反应,观察alert日志也没有写入任何东西,最后把进程给kill掉了。
执行 RMAN> delete noprompt expired backup;时一样会卡住,如下:
RMAN> delete backupset 16106;
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: sid=156 devtype=SBT_TAPE
channel ORA_SBT_TAPE_1: NMO v4.1.0.0
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: sid=155 devtype=SBT_TAPE
channel ORA_SBT_TAPE_2: NMO v4.1.0.0
using channel ORA_DISK_1
using channel ORA_DISK_2
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
16106   16106   1   1   AVAILABLE   SBT_TAPE    /NMO_c-3649627009-20070410-01/
Do you really want to delete the above objects (enter YES or NO)? yes




user interrupt received
user interrupt received
user interrupt received
user interrupt received
user interrupt received
Killed

这是为什么呢?

我尝试不管这些东西继续做增量备份,记录如下日志:

Recovery Manager: Release 9.2.0.8.0 - 64bit Production
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
connected to target database: HDDMS (DBID=3649627009)
using target database controlfile instead of recovery catalog
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13>
Starting backup at 18-7M-TM-B -12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=175 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=206 devtype=DISK
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00039 name=/dev/vg01/rbck1_15g_indx.ora
input datafile fno=00006 name=/dev/vg01/rindx01.dbf
input datafile fno=00027 name=/dev/vg03/rpmis_dc.ora
input datafile fno=00030 name=/dev/vg03/rbck3_10g_2.ora
input datafile fno=00041 name=/dev/vg02/rbck2_10g_base.ora
input datafile fno=00044 name=/dev/vg01/rbck1_10g_1.ora
input datafile fno=00046 name=/dev/vg03/rbck3_10g_5.ora
input datafile fno=00002 name=/dev/vg01/rundodbs01.dbf
input datafile fno=00001 name=/dev/vg01/rsystem01.dbf
input datafile fno=00016 name=/dev/vg02/rpmis_log.ora
input datafile fno=00031 name=/dev/vg03/rbck3_5g_1.ora
input datafile fno=00034 name=/dev/vg03/rbck3_5g_3.ora
input datafile fno=00015 name=/dev/vg02/rpmis_web.ora
input datafile fno=00018 name=/dev/vg02/rpmis_gg.ora
input datafile fno=00020 name=/dev/vg02/rpmis_sd.ora
input datafile fno=00022 name=/dev/vg02/rpmis_bh.ora
input datafile fno=00024 name=/dev/vg02/rpmis_tx.ora
input datafile fno=00026 name=/dev/vg02/rpmis_zdh.ora
input datafile fno=00036 name=/dev/vg03/rbck3_1g_2.ora
input datafile fno=00038 name=/dev/vg03/rbck3_1g_4.ora
input datafile fno=00004 name=/dev/vg01/rdrsys01.ora
input datafile fno=00007 name=/dev/vg01/rodm01.ora
input datafile fno=00010 name=/dev/vg01/ruser01.ora
channel ORA_DISK_1: starting piece 1 at 18-7M-TM-B -12
channel ORA_DISK_2: starting incremental level 1 datafile backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
input datafile fno=00042 name=/dev/vg03/rbck3_20g_dc.ora
input datafile fno=00014 name=/dev/vg02/rpmis_allblobs.ora
input datafile fno=00029 name=/dev/vg03/rbck3_10g_1.ora
input datafile fno=00040 name=/dev/vg02/rbck2_10g_allblobs.ora
input datafile fno=00043 name=/dev/vg03/rbck3_10g_4.ora
input datafile fno=00045 name=/dev/vg01/rbck1_10g_2.ora
input datafile fno=00033 name=/dev/vg03/rbck3_10g_3.ora
input datafile fno=00009 name=/dev/vg01/rundodbs02.dbf
input datafile fno=00012 name=/dev/vg02/rpmis_base.ora
input datafile fno=00028 name=/dev/vg01/rbck1_5g_1.ora
input datafile fno=00032 name=/dev/vg03/rbck3_5g_2.ora
input datafile fno=00013 name=/dev/vg02/rpmis_users.ora
input datafile fno=00017 name=/dev/vg02/rpmis_sb.ora
input datafile fno=00019 name=/dev/vg02/rpmis_dd.ora
input datafile fno=00021 name=/dev/vg02/rpmis_yf.ora
input datafile fno=00023 name=/dev/vg02/rpmis_sc.ora
input datafile fno=00025 name=/dev/vg02/rpmis_zh.ora
input datafile fno=00035 name=/dev/vg03/rbck3_1g_1.ora
input datafile fno=00037 name=/dev/vg03/rbck3_1g_3.ora
input datafile fno=00003 name=/dev/vg01/rcwmlite01.ora
input datafile fno=00005 name=/dev/vg01/rexample01.ora
input datafile fno=00008 name=/dev/vg01/rtools01.ora
input datafile fno=00011 name=/dev/vg01/rxdb01.ora
channel ORA_DISK_2: starting piece 1 at 18-7M-TM-B -12

日志输出一直等在这里,没有其它的输出了,等大概20分钟后依然如此,检查相应的增量备份目录依然没有备份产生。请问这会是什么原因?
增量备份的脚本如下:
#!/usr/bin/sh
# user env
export BACK_DATE=`date +%Y%m%d`
export BACKUP_PATH=/backups
export BACKUP_PATH2=/archivelog1
export BACKUP_PATH3=/archivelog2
rman target / nocatalog msglog=$BACKUP_PATH/log/level1_$BACK_DATE.log << EOF
run {
backup incremental level 1 format '$BACKUP_PATH/level1_%s_%p_%t' database;
allocate channel a2 device type disk format '$BACKUP_PATH2/level1_%s_%p_%t' connect hddms1;
allocate channel a3 device type disk format '$BACKUP_PATH3/level1_%s_%p_%t' connect hddms2;
backup archivelog all delete all input;
crosscheck backup;
delete noprompt expired backup;
report obsolete;
delete noprompt obsolete;
release channel a2;
release channel a3;
sql 'alter system switch logfile';
}
exit
EOF
RMAN的设置:

RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 15 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '/NMO_%F/';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'DISK' TO '/u01/cf_back/cf_%F_%d_%T.bak';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2;
CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/arch/snap_rac.cf';
2#
发表于 2012-7-19 17:39:14
这套系统现在是处于归档状态吗?

回复 只看该作者 道具 举报

3#
发表于 2012-7-19 17:53:46

回复 2# 的帖子

是的,不然咋做0级备份呢。

回复 只看该作者 道具 举报

4#
发表于 2012-7-22 21:12:34
你的问题不是无法删除 obsolete ,而是slow delete obsolete


action plan:

1.   给RMAN 后台进程做一个10046 trace

2.  加入debug  并生成debug 日志并上传

使用方法:

run
{
debug on;
RUN YOU SLOW RMAN STATEMENT    ;   运行存在问题的RMAN命令
debug off;
}

回复 只看该作者 道具 举报

5#
发表于 2012-7-27 21:58:33

回复 4# 的帖子

多谢刘大提供的思路。
我的问题是由于之前采用sbt作备份介质,后来删除时通过非正常手段时行的。
现在要删除这些记录不能通过分配disk类型的通道,而应该采用sbt类型的通道。通过执行下面的命令,最终删除了这些过期的备份:
RMAN> allocate channel for maintenance device type sbt
parms 'SBT_LIBRARY=oracle.disksbt,
ENV=(BACKUP_DIR=/tmp)';
RMAN> delete obsolete;

回复 只看该作者 道具 举报

6#
发表于 2012-7-28 23:55:42
个人觉得:根据以上信息提示,根本原因是你没有分配合适的维护channel

请把上面的脚本 修改成如下  然后尝试

allocate channel for mainaintnance device type sbt;
crosscheck backupset;
delete noprompt obsolete;

只是个人理解,不知是否正确!如有不恰请大家指出,谢谢!

回复 只看该作者 道具 举报

7#
发表于 2012-7-30 09:34:13

回复 6# 的帖子

你的思路是对的。
但在allocate的时候需要加参数,不然不会成功(至少我的没有成功)。

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-25 15:12 , Processed in 0.048947 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569