FIX: Error 1203 Using Dynamic Cursor Within Transaction

Last reviewed: April 9, 1997
Article ID: Q158288
The information in this article applies to:
  • Microsoft SQL Server, version 6.5
BUG #: 16082 (6.50)

SYMPTOMS

Using Dynamic Cursor within a user-defined transaction can cause hundreds of 1203 errors in the SQL Server errorlog and Windows NT Event Viewer. The SQL Server shuts down afterwards, with the following error message:

   Error: 1203, Severity: 20, State: 2
   Caller of lock manager is incorrectly trying to unlock an unlocked
   object.
   spid=%d locktype=%d dbid=%d lockid=%Id

CAUSE

Dynamic Cursor scans through all data pages in the table, starting from the first page. When it accumulates enough SH_PAGE locks on the table, lock promotion occurs, which frees all SH_PAGE locks, and it acquires a table lock instead. Cursor fetch has no knowledge of the lock promotion, so it finishes its scan and tries to free SH_PAGE lock. However, SH_PAGE lock is no longer there, which causes the problem.

WORKAROUND

To work around this problem, do one of the following:

  • Change the cursor definition to use either SCROLL or INSENSITIVE.

    -or-

  • Increase "LE Threshold Maximum" setting in sp_configure.

    -or-

  • Do not use transaction around Dynamic Cursor.

STATUS

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

MORE INFORMATION

Trace flag 1200 can be used to monitor the lock promotion in this case.


Additional query words: unhandled exception
Keywords : kbbug6.50 kbfix6.50.sp2 kbnetwork SSrvErr_Log SSrvLock
Version : 6.5
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 9, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.