db2无法force掉备份连接的处理办法

在数据库在线备份的时候会与Load和ALTER TABLE <表名> ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE发生冲突导致这两种操作被挂起,而在MIS系统中数据库往往比较大(TB级别很常见),备份时候经常花费几个小时,甚至1天以上的时间。当我们急需上述两种操作的时候,就需要kill掉备份,一般步骤如下:

#1 找到备份连接
[db2inst1@limt bin]$ db2 list applications show detail|grep -i back
#2 force掉备份连接
[db2inst1@limt bin]$ db2 "force application(26)"
DB20000I  The FORCE APPLICATION command completed successfully.
DB21024I  This command is asynchronous and may not be effective immediately.

然后有时我们连续执行了几次备份依然不能kill掉,我们可以用另一种手段:

#找到Process ID of client application 
[db2inst1@limt bin]$ db2 get snapshot for application agentid 55|less

            Application Snapshot

Application handle                         = 55
Application status                         = Connect Completed
Status change time                         = Not Collected
Application code page                      = 1208
Application country/region code            = 0
DUOW correlation token                     = *LOCAL.db2inst1.150104134326
Application name                           = db2bp
Application ID                             = *LOCAL.db2inst1.150104134326
Sequence number                            = 00001
TP Monitor client user ID                  =
TP Monitor client workstation name         =
TP Monitor client application name         =
TP Monitor client accounting string        =

Connection request start timestamp         = 2015-01-04 21:43:26.408291
Connect request completion timestamp       = 2015-01-04 21:43:28.310947
Application idle time                      = Not Collected
CONNECT Authorization ID                   = DB2INST1
Client login ID                            = db2inst1
Configuration NNAME of client              = limt
Client database manager product ID         = SQL10010
Process ID of client application           = 4153  # 此处为要找到的BP进程号
Platform of client application             = LINUXAMD64  
Communication protocol of client           = Local Client

#此进程为db2bp
[db2inst1@limt bin]$ ps -ef|grep 4153
db2inst1   4153      1  0 21:28 pts/0    00:00:00 /home/db2inst1/sqllib/bin/db2bp 3796A502 5 A
db2inst1   4961   3796  0 21:46 pts/0    00:00:00 grep 4153 
[db2inst1@limt bin]$ kill -9 4153
#这个时候再次查看备份连接就消失了

 

这个办法一般也适合force C程序的嵌入式SQL程序

posted @ 2015-01-06 19:42  圣光救赎者  阅读(796)  评论(0编辑  收藏  举报