查看: 903|回复: 1

ttbulkcp锁表问题解决办法

 关闭 [复制链接]

签到天数: 2592 天

连续签到: 6 天

[LV.Master]至尊海神IIIIII

发表于 2010-8-4 19:11 | 显示全部楼层 |阅读模式
我们使用ttbulkcp -i加载数据时会产生table级锁,降低了并发性。特别是生产系统上,很可能会造成其他事物锁等待超时。解决办法是加上 -notblLock参数不产生表级锁,只产生行锁,以此来提高并发性能。
但要记得加-xp参数,-xp默认是1000条提交一次,-xp参数也不要设置太大,否则为了存放锁,临时空间可能不够用。

下面是验证的过程:

-xp 0            0表示整个加载完成后再提交 ,其他事物请求锁会超时                     
$ ttXactAdmin -tbl tmp_test -connstr DSN=gejie
2010-07-28 18:03:02.624


TimesTen Release 7.0.5.2.0
Outstanding locks on table GEJIE.TMP_TEST
Resource  ResourceID           PID     Context            TransactId  Mode  
Table (表级锁)    736856               15402   0x60000000000379f0    7.7795551 W

-xp 1000   (1000条提交时,有表锁,但其他事物不会请求锁超时)
$ ttXactAdmin -tbl tmp_test -connstr DSN=gejie
2010-07-28 18:04:45.964


TimesTen Release 7.0.5.2.0
Outstanding locks on table GEJIE.TMP_TEST
Resource  ResourceID           PID     Context            TransactId  Mode  
Table(表级锁)     736856               15539   0x60000000000379f0    7.7795750 W


-xp 1000 -notblLock  
$ ttXactAdmin -tbl tmp_test -connstr DSN=gejie
2010-07-28 18:01:32.386


TimesTen Release 7.0.5.2.0
Outstanding locks on table GEJIE.TMP_TEST
Resource  ResourceID           PID     Context            TransactId  Mode  
Table     736856               15358   0x60000000000379f0    7.7792131 IXn   
Row (行锁)      0x0000000069bcc158   15358   0x60000000000379f0    7.7792131 Xn   
Row       0x0000000069bcc148   15358   0x60000000000379f0    7.7792131 Xn   
Row       0x0000000069bcc138   15358   0x60000000000379f0    7.7792131 Xn   
Row       0x0000000069bcc128   15358   0x60000000000379f0    7.7792131 Xn   
Row       0x0000000069bcc118   15358   0x60000000000379f0    7.7792131 Xn   
Row       0x0000000069bcc108   15358   0x60000000000379f0    7.7792131 Xn   
Row       0x0000000069bcc0f8   15358   0x60000000000379f0    7.7792131 Xn   
………………………………
<
PCOS系统下载站:http://zhuangji.wang

签到天数: 1036 天

连续签到: 0 天

[LV.10]逍遥海仙III

发表于 2010-8-5 09:04 | 显示全部楼层
进来学习一下!
PCOS系统下载站:http://zhuangji.wang
回复 支持 反对

使用道具 举报

本版积分规则