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程序
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。