证券

db2rbind和flush占用锁的疑问

凌晨有个脚本没执行成功,排查了下,原因是锁超时导致....从日志可以看出,那个时间点正在执行下面两条语句
db2rbind  dbName -l db2rbind.log all
db2  FLUSH PACKAGE CACHE DYNAMIC

由于对应锁超时的详细信息无法获取,只能从这块入手分析.

这两条语句的占用锁的情况怎么样,各位大拿解释解释
参与11

10同行回答

xu5762173xu5762173数据库管理员Ess
回复 10# weiruan85    用脚本替代db2rbind all吧db2 "select 'rebind package ' || rtrim(pkgschema||'.'||pkgname||';' from syscat.packages where pkgschema 'NULLID'" >rebind.sql显示全部
回复 10# weiruan85


   用脚本替代db2rbind all吧db2 "select 'rebind package ' || rtrim(pkgschema||'.'||pkgname||';' from syscat.packages where pkgschema <> 'NULLID'" >rebind.sql收起
证券 · 2012-12-05
浏览893
weiruan85weiruan85数据库管理员ibm
回复 9# xu5762173     yes显示全部
回复 9# xu5762173


    yes收起
政府机关 · 2012-12-03
浏览1014
xu5762173xu5762173数据库管理员Ess
rebind 是需要锁的,flush package也是需要锁的。weiruan85 发表于 2012-12-2 20:24    那db2rbind all是不是一般情况下不使用,只是根据runstats的表查处所有相关的package进行bind?显示全部
rebind 是需要锁的,flush package也是需要锁的。
weiruan85 发表于 2012-12-2 20:24



   那db2rbind all是不是一般情况下不使用,只是根据runstats的表查处所有相关的package进行bind?收起
证券 · 2012-12-03
浏览978
xu5762173xu5762173数据库管理员Ess
小弟有一个不解的是楼主怎么知道报锁超时时正在执行rbind和flush操作?ppjava2009 发表于 2012-11-30 22:43    感谢关注,没有确切的证据说明锁超时是rbind和flush,只是根据时间大致推算出来,由于是半夜执行的脚本,也没有其他脚本在这个时候执行...想在这看看rb...显示全部
小弟有一个不解的是楼主怎么知道报锁超时时正在执行rbind和flush操作?
ppjava2009 发表于 2012-11-30 22:43



   感谢关注,没有确切的证据说明锁超时是rbind和flush,只是根据时间大致推算出来,由于是半夜执行的脚本,也没有其他脚本在这个时候执行...想在这看看rbind和flush占用锁的情况,以排查是不是这俩命令引起的问题.收起
证券 · 2012-12-03
浏览893
zhmwangzhmwangPDOceanBase
回复 3# xu5762173     如果package被其他应用占据,好像bind是不成功的,直接跳过。我在connect server上db2rbind,然后查看log 得到这样的信息显示全部
回复 3# xu5762173


    如果package被其他应用占据,好像bind是不成功的,直接跳过。我在connect server上db2rbind,然后查看log 得到这样的信息收起
互联网服务 · 2012-12-01
浏览884
ppjava2009ppjava2009系统工程师用友汽车信息科技(上海)有限公司
小弟有一个不解的是楼主怎么知道报锁超时时正在执行rbind和flush操作?显示全部
小弟有一个不解的是楼主怎么知道报锁超时时正在执行rbind和flush操作?收起
互联网服务 · 2012-11-30
浏览995
wyoywwyoyw数据库管理员长信通
看起来像,rbind失败4条,什么原因呢?显示全部
看起来像,rbind失败4条,什么原因呢?收起
金融其它 · 2012-11-30
浏览910
xu5762173xu5762173数据库管理员Ess
If REBIND is executed on a package that is in use by another user, the rebind will not occur until the other user's logical unit of work ends, because an exclusive lock is held on the package's record in the SYSCAT.PACKAGES system catalog table durin...显示全部
If REBIND is executed on a package that is in use by another user, the rebind will not occur until the other user's logical unit of work ends, because an exclusive lock is held on the package's record in the SYSCAT.PACKAGES system catalog table during the rebind.

rebind会占用syscat.packages表指定行的x锁
那如果是db2rbind all是一个事务里所有的记录都一直占着x锁...这样理解的?收起
证券 · 2012-11-30
浏览1005
xu5762173xu5762173数据库管理员Ess
凌晨有个脚本没执行成功INSERT INTO tab1 (...) (SELECT  ... FROM ...)DB21034E  The command was processed as an SQL statement because it was not a valid Command Line Processor command.  During SQL processing it returned:SQL...显示全部
凌晨有个脚本没执行成功
INSERT INTO tab1 (...) (SELECT  ... FROM ...)
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0911N  The current transaction has been rolled back because of a deadlock
or timeout.  Reason code "68".  SQLSTATE=40001

INSERT INTO tab2 (...) (SELECT  ... FROM ...)
DB20000I  The SQL command completed successfully.

Fri Nov 30 01:01:51 BEIST 2012


锁超时日志....
2012-11-30-01.01.34.668847+480 I1082562A463       LEVEL: Warning
PID     : 2499052              TID  : 1           PROC : db2agent (dbName) 0
INSTANCE: db2instt             NODE : 000         DB   :dbName
APPHDL  : 0-2136               APPID: *LOCAL.db2instt.130125121148
AUTHID  : DB2INSTT
FUNCTION: DB2 UDB, access plan manager, sqlra_find_pkg, probe:99
RETCODE : ZRC=0x80100044=-2146435004=SQLP_LTIMEOUT
          "LockTimeOut - tran rollback Reason code 68"

该时间点正在执行下面两条语句
db2rbind  dbName -l db2rbind.log all
Succeeded to rebind                              =  372
Failed to rebind                                 =  4
Ending time .... Fri Nov 30 01:01:49 2012

FLUSH PACKAGE CACHE DYNAMIC
DB20000I  The SQL command completed successfully.
Fri Nov 30 01:01:49 BEIST 2012


db2rbind  会占用锁,影响所有SQL吗?收起
证券 · 2012-11-30
浏览966
weiruan85weiruan85数据库管理员ibm
rebind 是需要锁的,flush package也是需要锁的。显示全部
rebind 是需要锁的,flush package也是需要锁的。收起
政府机关 · 2012-11-30
浏览1005

提问者

xu5762173
数据库管理员Ess
擅长领域: 服务器数据库存储

问题状态

  • 发布时间:2012-11-30
  • 关注会员:1 人
  • 问题浏览:6426
  • 最近回答:2012-12-05
  • X社区推广