Microsoft KB Archive/165512

From BetaArchive Wiki
Knowledge Base


FIX: Err 1203 Running Dynamic Cursor in a Stored Procedure

Article ID: 165512

Article Last Modified on 3/1/2005



APPLIES TO

  • Microsoft SQL Server 6.5 Service Pack 2



This article was previously published under Q165512

BUG #: 16523

SYMPTOMS

A cursor that is retrieving data from within a stored procedure may fail with error 1203 "Caller of lock manager is incorrectly trying to unlock an unlocked object. Spid=%d locktype=%d dbid=%d lockid=%id". This error may happen a few times, or it may go into an endless loop in the errorlog, quickly filling up the disk it resides on. This problem only occurs on SQL Server version 6.5 Service Pack 2.

CAUSE

The problem occurs when SQL Server upgrades a page lock to a table lock. The dynamic cursor's connection is not informed of the lock escalation, and repeatedly tries to unlock the page lock.

WORKAROUND

To work around this problem, change the cursor from a dynamic cursor to a SCROLL cursor by adding the keyword SCROLL to the cursor create.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5 Service Pack 2. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.

Keywords: kbbug kbfix kbusage KB165512