问题背景
如果,你负责的数据库服务器,在RMAN进行全备时,业务又有大量数据要处理,一时间,系统资源直接被耗尽,影响到了业务的正常,你准备怎么处理?
解决办法
【不推荐】当时我们组的另外一个同事在没有询问我的情况下,直接修改oracle分配内存参数,关闭监听,关闭oracle数据库。数据库停了半小时才停下来。当然数据库停下来,所有进程都消失,资源都释放了。
【推荐】其实还有更好的方法,那就是直接杀rman的备份进程!立即释放资源。
紧急状态下,我们是可以立即终止正在进行的RMAN备份进程的。
(1)查看RMAN分配的各个通道的进程号
SQL>
SELECT sid, spid, client_info
FROM v$process p, v$session s
WHERE p.addr = s.paddr
AND client_info LIKE '%rman%';
SIDSPID CLIENT_INFO
11315898 rman channel=ORA_DISK_1
11915899 rman channel=ORA_DISK_2
12015900 rman channel=ORA_DISK_3
11715901 rman channel=ORA_DISK_4
(2)根据第(1)中得到的进程号,终止RMAN备份
注:这里既要kill 掉RMAN备份脚本的PID,www.linuxidc.com?也要kill 掉RMAN中分配的各个通道的PID
[root@asmdb ~]# ps -ef | grep beq
oracle 1918 1 0 Jul10 ? 00:00:09 oracle+ASM (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 15790 1 0 08:53 ? 00:00:00 oracle+ASM (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 15892 15885 1 08:57 ? 00:00:00 oracleasmdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 15897 15885 1 08:57 ? 00:00:00 oracleasmdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 15898 15885 1 08:57 ? 00:00:00 oracleasmdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 15899 15885 2 08:57 ? 00:00:00 oracleasmdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 15900 15885 2 08:57 ? 00:00:00 oracleasmdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 15901 15885 5 08:57 ? 00:00:00 oracleasmdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
root 15903 15823 0 08:57 pts/3 00:00:00 grep beq
[root@asmdb ~]# kill -9 15898
[root@asmdb ~]# kill -9 15899
[root@asmdb ~]# kill -9 15900
[root@asmdb ~]# kill -9 15901
[root@asmdb ~]# ps -ef | grep rman
oracle 15885 15740 1 08:57 pts/2 00:00:02 rman target /
root 15926 15823 0 09:01 pts/3 00:00:00 grep rman
[root@asmdb ~]# kill -9 15885
rman备份的命令行终端的显示输出:
[oracle@asmdb ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Mon Jul 29 08:57:22 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ASMDB (DBID=557978363)
RMAN> backup database;
Starting backup at 29-JUL-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=113 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=119 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=120 devtype=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: sid=117 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00002 name=+ASMDG01/asmdb/datafile/undotbs1.261.813779611
input datafile fno=00007 name=+ASMDG01/asmdb/datafile/spottbs.268.821100481
channel ORA_DISK_1: starting piece 1 at 29-JUL-13
channel ORA_DISK_2: starting full datafile backupset
channel ORA_DISK_2: specifying datafile(s) in backupset
input datafile fno=00001 name=+ASMDG01/asmdb/datafile/system.260.813779595
channel ORA_DISK_2: starting piece 1 at 29-JUL-13
channel ORA_DISK_3: starting full datafile backupset
channel ORA_DISK_3: specifying datafile(s) in backupset
input datafile fno=00003 name=+ASMDG01/asmdb/datafile/sysaux.262.813779621
input datafile fno=00004 name=+ASMDG01/asmdb/datafile/users.264.813779629
channel ORA_DISK_3: starting piece 1 at 29-JUL-13
channel ORA_DISK_4: starting full datafile backupset
channel ORA_DISK_4: specifying datafile(s) in backupset
input datafile fno=00005 name=+ASMDG01/asmdb/datafile/luroutest01.dbf
input datafile fno=00006 name=+ASMDG01/asmdb/datafile/spot01.dbf
channel ORA_DISK_4: starting piece 1 at 29-JUL-13
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/29/2013 08:58:20
RMAN-10038: database session for channel ORA_DISK_1 terminated unexpectedly
channel ORA_DISK_1 disabled, job failed on it will be run on another channel
RMAN-03009: failure of backup command on ORA_DISK_2 channel at 07/29/2013 08:58:20
RMAN-10038: database session for channel ORA_DISK_2 terminated unexpectedly
channel ORA_DISK_2 disabled, job failed on it will be run on another channel
RMAN-03009: failure of backup command on ORA_DISK_3 channel at 07/29/2013 08:58:20
RMAN-10038: database session for channel ORA_DISK_3 terminated unexpectedly
channel ORA_DISK_3 disabled, job failed on it will be run on another channel
Killed
[oracle@asmdb ~]$
[oracle@asmdb ~]$
(3)核实进程是否还存在
此时RMAN备份操作已经被终止。查看(1)中的SQL语句时,结果为空。
注意事项
如果单单kill掉RMAN的进程号,那么RMAN备份并没有停止,必须要连channel进程也一起掉才可以!
___________________________________________________________________________________
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Author: laven54 (lurou)
Email: laven54@163.com
Blog: http://blog.csdn.net/laven54