DB2数据库表的解锁

#p##p#下面为您介绍DB2数据库中,如何才能将数据库表进行解锁,供您参考,希望对您有所帮助。

成都网站设计、成都网站制作中从网站色彩、结构布局、栏目设置、关键词群组等细微处着手,突出企业的产品/服务/品牌,帮助企业锁定精准用户,提高在线咨询和转化,使成都网站营销成为有效果、有回报的无锡营销推广。成都创新互联专业成都网站建设10多年了,客户满意度97.8%,欢迎成都创新互联客户联系。

在DB2的命令行中输入:

update monitor switches using lock on table on

然后打开另一个DB2命令窗口执行我的那个被吊死的Update语句。

然后在第一个DB2命令窗口执行:

get snapshot for locks on Database_Name(你的数据库的名字)> locks.TXT

然后,可以看到第一个DB2的窗口有一个信息输出,把这些信息输出到TXT中,大致如下:

应用程序句柄                    = 36
应用程序标识                    = AC100C47.IC05.00F6C6095828
序号                          = 0246
应用程序名                      = java.exe
CONNECT 授权标识                = DB2ADMIN
应用程序状态                    = UOW 正在等待
状态更改时间                    = 未收集
应用程序代码页                  = 1208
挂起的锁定                      = 0
总计等待时间(毫秒)            = 0

应用程序句柄                    = 43
应用程序标识                    = *LOCAL.DB2.060512054331
序号                          = 2273
应用程序名                      = java.exe
CONNECT 授权标识                = DB2ADMIN
应用程序状态                    = 联合请求暂挂
状态更改时间                    = 未收集
应用程序代码页                  = 1208
挂起的锁定                      = 6
总计等待时间(毫秒)            = 0 #p#

锁定列表
锁定名称                       = 0x031F9052000000000000000055
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 255
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部
方式                           = S

锁定名称                       = 0x26800000000000000000000044
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部
方式                           = S

锁定名称                       = 0x020006000F1700000000000052
锁定属性                       = 0x00000000
发行版标志                     = 0x00000001
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 5903 #p#
对象类型                       = 行
表空间名                       = USERSPACE1
表模式                         = DB2ADMIN
表名                           = C_USER
方式                           = NS

锁定名称                       = 0x01000000010000000500BC0056
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部变化锁定
方式                           = S

锁定名称                       = 0x535953534E333030FD965C0641
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部方案锁定
方式                           = S #p#锁定名称                       = 0x02000600000000000000000054
锁定属性                       = 0x00000000
发行版标志                     = 0x00000001
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 6
对象类型                       = 表
表空间名                       = USERSPACE1
表模式                         = DB2ADMIN
表名                           = C_USER
方式                           = IS

应用程序句柄                    = 557
应用程序标识                    = *LOCAL.DB2.060512053913
序号                          = 1254
应用程序名                      = java.exe
CONNECT 授权标识                = DB2ADMIN
应用程序状态                    = 联合请求暂挂
状态更改时间                    = 未收集
应用程序代码页                  = 1208
挂起的锁定                      = 6
总计等待时间(毫秒)            = 0

锁定列表
锁定名称                       = 0x031F9052000000000000000055
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 255
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部
方式                           = S

锁定名称                       = 0x26800000000000000000000044
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1 #p#
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部
方式                           = S

锁定名称                       = 0x02000600071D00000000000052
锁定属性                       = 0x00000000
发行版标志                     = 0x00000001
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 7431
对象类型                       = 行
表空间名                       = USERSPACE1
表模式                         = DB2ADMIN
表名                           = C_USER
方式                           = NS

锁定名称                       = 0x01000000010000000500BC0056
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部变化锁定
方式                           = S #p#

锁定名称                       = 0x535953534E333030FD965C0641
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部方案锁定
方式                           = S

锁定名称                       = 0x02000600000000000000000054
锁定属性                       = 0x00000000
发行版标志                     = 0x00000001
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 6
对象类型                       = 表
表空间名                       = USERSPACE1
表模式                         = DB2ADMIN
表名                           = C_USER
方式                           = IS #p#

其中应用程序句柄43和557的状态都是死锁了,猜测是这2个应用争用DB2的表,造成死锁,根据日志提示,在DB2的命令窗口输入:

force application (43)

force application (557)

提示这个操作是异步的,我执行list applicaions,结果进程中还有那2个进程,那2个进程可能是在执行比较大的操作,需要耐心等待,如何还不行,则使用下面的命令来强制所有的应用都停止,然后重启DB2:

force application all

terminate

db2stop force

db2start

如果DB2在Window上,则可以使用“控制中心”->实例->右键“应用程序”,可以看到当前的锁定情况,并且可以强行关闭某个进程,也可以显示“锁定链”。

在DB2的命令行中输入:

update monitor switches using lock on table on #p#

然后打开另一个DB2命令窗口执行我的那个被吊死的Update语句。

然后在第一个DB2命令窗口执行:

get snapshot for locks on Database_Name(你的数据库的名字)> locks.TXT

然后,可以看到第一个DB2的窗口有一个信息输出,把这些信息输出到TXT中,大致如下:

应用程序句柄                    = 36
应用程序标识                    = AC100C47.IC05.00F6C6095828
序号                          = 0246
应用程序名                      = java.exe
CONNECT 授权标识                = DB2ADMIN
应用程序状态                    = UOW 正在等待
状态更改时间                    = 未收集
应用程序代码页                  = 1208
挂起的锁定                      = 0
总计等待时间(毫秒)            = 0

应用程序句柄                    = 43
应用程序标识                    = *LOCAL.DB2.060512054331
序号                          = 2273
应用程序名                      = java.exe
CONNECT 授权标识                = DB2ADMIN
应用程序状态                    = 联合请求暂挂
状态更改时间                    = 未收集
应用程序代码页                  = 1208
挂起的锁定                      = 6
总计等待时间(毫秒)            = 0 #p#

锁定列表
锁定名称                       = 0x031F9052000000000000000055
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 255
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部
方式                           = S

锁定名称                       = 0x26800000000000000000000044
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部
方式                           = S

锁定名称                       = 0x020006000F1700000000000052
锁定属性                       = 0x00000000
发行版标志                     = 0x00000001
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 5903
对象类型                       = 行
表空间名                       = USERSPACE1
表模式                         = DB2ADMIN
表名                           = C_USER
方式                           = NS #p#

锁定名称                       = 0x01000000010000000500BC0056
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部变化锁定
方式                           = S

锁定名称                       = 0x535953534E333030FD965C0641
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部方案锁定
方式                           = S

锁定名称                       = 0x02000600000000000000000054
锁定属性                       = 0x00000000
发行版标志                     = 0x00000001
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 6
对象类型                       = 表
表空间名                       = USERSPACE1
表模式                         = DB2ADMIN
表名                           = C_USER #p#
方式                           = IS

应用程序句柄                    = 557 #p#
应用程序标识                    = *LOCAL.DB2.060512053913
序号                          = 1254
应用程序名                      = java.exe
CONNECT 授权标识                = DB2ADMIN
应用程序状态                    = 联合请求暂挂
状态更改时间                    = 未收集
应用程序代码页                  = 1208
挂起的锁定                      = 6
总计等待时间(毫秒)            = 0

锁定列表
锁定名称                       = 0x031F9052000000000000000055
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 255
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部
方式                           = S #p#

锁定名称                       = 0x26800000000000000000000044
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部
方式                           = S

锁定名称                       = 0x02000600071D00000000000052
锁定属性                       = 0x00000000
发行版标志                     = 0x00000001
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 7431
对象类型                       = 行
表空间名                       = USERSPACE1
表模式                         = DB2ADMIN
表名                           = C_USER
方式                           = NS

锁定名称                       = 0x01000000010000000500BC0056
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0
对象类型                       = 内部变化锁定
方式                           = S

锁定名称                       = 0x535953534E333030FD965C0641
锁定属性                       = 0x00000000
发行版标志                     = 0x40000000
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 0 #p#
对象类型                       = 内部方案锁定
方式                           = S

锁定名称                       = 0x02000600000000000000000054
锁定属性                       = 0x00000000
发行版标志                     = 0x00000001
锁定计数                       = 1
挂起计数                       = 0
锁定对象名                     = 6
对象类型                       = 表
表空间名                       = USERSPACE1
表模式                         = DB2ADMIN
表名                           = C_USER
方式                           = IS

其中应用程序句柄43和557的状态都是死锁了,猜测是这2个应用争用DB2的表,造成死锁,根据日志提示,在DB2的命令窗口输入:

force application (43)

force application (557)

提示这个操作是异步的,我执行list applicaions,结果进程中还有那2个进程,那2个进程可能是在执行比较大的操作,需要耐心等待,如何还不行,则使用下面的命令来强制所有的应用都停止,然后重启DB2:

force application all

terminate

db2stop force

db2start

如果DB2在Window上,则可以使用“控制中心”->实例->右键“应用程序”,可以看到当前的锁定情况,并且可以强行关闭某个进程,也可以显示“锁定链”。

网页题目:DB2数据库表的解锁
路径分享:http://www.36103.cn/qtweb/news27/36827.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联