简体   繁体   English

从SQL Server 2000 OpenQuery到DB2 / AS400导致锁定

[英]OpenQuery to DB2/AS400 from SQL Server 2000 causing locks

Every morning we have a process that issues numerous queries (~10000) to DB2 on an AS400/iSeries/i6 (whatever IBM calls it nowadays), in the last 2 months, the operators have been complaining that our query locks a couple of files preventing them from completing their nightly processing. 每天早上我们都有一个进程,在AS400 / iSeries / i6上向DB2发出大量查询(~10000)(无论IBM现在称之为什么),在过去的两个月里,运营商一直在抱怨我们的查询锁定了几个文件阻止他们完成夜间处理。 The queries are very simplisitic, eg 查询非常简单,例如

Select [FieldName] from OpenQuery('<LinkedServerName>', 'Select [FieldName] from [LibraryName].[FieldName] where [SomeField]=[SomeParameter]')

I am not an expert on the iSeries side of the house and was wondering if anyone had any insight on lock escalation from an AS400/Db2 perspective. 我不是iSeries方面的专家,并且想知道是否有人从AS400 / Db2的角度对锁定升级有任何见解。 The ID that is causing the lock has been confirmed to be the ID we registered our linked server as and we know its most likely us because the [Library] and [FileName] are consistent with the query we are issuing. 导致锁定的ID已被确认为我们注册了我们链接服务器的ID,我们知道它最有可能是因为[Library]和[FileName]与我们发出的查询一致。

This has just started happening recently. 这最近刚刚开始发生。 Is it possible that our select statements which are causing the AS400 to escalate locks? 我们的select语句是否可能导致AS400升级锁定? The problem is they are not being released without manual intervention. 问题是如果没有人工干预,它们就不会被释放。

尝试在查询中添加“FOR READ ONLY”,然后在检索时不会锁定记录。

Writes to the files on the AS/400 side from an RPG/COBOL/JPL job program will cause a file lock (by default I think). 从RPG / COBOL / JPL作业程序写入AS / 400端的文件将导致文件锁定(我认为默认情况下)。 The job will be unable to get this lock when you are reading. 在你阅读时,这份工作将无法获得这种锁定。 The solution we used was ... don't read the files when jobs are running. 我们使用的解决方案是...在作业运行时不读取文件。 We created a big schedule sheet in excel and put all the sql servers' and as/400's jobs on it in times slots w/ color coding for importance and server. 我们在excel中创建了一个大的计划表,并将所有sql服务器和/ 400的作业放在时间槽上,用于重要性和服务器的颜色编码。 That way no conflicts or out of date extract files either. 这样,没有冲突或过时提取文件。

You might have Commitment Control causing a lock for a Repeatable Read. 您可能有Commitment Control导致可重复读取的锁定。 Check the SQL Server ODBC connection associated with <linkedServerName> to change the commitment control. 检查与<linkedServerName>关联的SQL Server ODBC连接以更改承诺控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM