SQL Server Database Engine cannot obtain a LOCK resource at this time

  • The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users. Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions.

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.:P

  • What statement were you trying to run? Was that the full error message? Was there any reference to what resource it was trying to lock?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • each lock that SQL takes out uses up a small amount of memory (cannot remember how much - something like a few KB). The upper limit of no of locks can be configured to a set value but the default, and usual setting, is to allow SQL to dynamically configure the upper limit depending on memory available. Check to see how yours is set (it listed at the start of the errrorlog or use server properties or sp_configure), but chances are it is dynamic so this message is telling you have run out of memory.

    This will be down to the overall workload at that time which is why the error message says try rerunning the query at a quieter time.

    As Gail says try and identify what is running at the time and whether any queries can be tuned to take out fewer locks, or hold them for a shorter time. Index defrags on large tables are quite often a culprit here.

    Of course you may just need more memory.

    ---------------------------------------------------------------------

  • I'm currently suffering from the same issue. All the performance tuning in the world is still leading to this error message:-

    'The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users. Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions'

    This has only recently started to affect all the databases' on two differnt SQL instances which suggest it isn't a configuration but maybe a hardware issue. Using both profiler and DMV's I can't find any actual locks???!!:crazy:

    If anyone has experienced this please help??!

  • Kris, any other signs of memory pressure.? Can you allocate more memory to SQL in your environment?

    ---------------------------------------------------------------------

  • Thanks for your response.

    There was 3.2GB on the box- 2.5G allocated to SQL. The average avaliable mememory was less than 200mb across the day although we'd reduced the number of processes to a minimum- resulting in the above error with almost every query ran against it.

    As an MI dept when SPID's hung for too long (hours) we'd kill the proces which would then go into roll back then we tended to reboot the box- this started happening weekly.

    This solved the issue in most instances but ( as far as i understand) we were openeing ourseleves up for some sort of data corruption.

    I think this finally caught up with us. To fix it I eneded up backing up the master DB. Touch wood this seems to have resolved the Locks.............although i wouldn't recommend managing your datawarehouses like this!

  • backing up master db won't affect no of locks held, though it is something you should be doing on a regular basis!

    use sp_lock to see how many locks are taken out.

    sounds like you have /3gb switch enabled or this is 64 bit? I would look to up the amount of physical RAM you have if possible.

    Are these processes hung or just long running? Whilst they remain active they will hold onto their locks (possibly causing blocking) so investigations into what is happening to these connections will be worthwhile.

    ---------------------------------------------------------------------

  • This issue was well beyond sp_lock. It's 32 bit and on it's own box ( not a VM). As i understand it-SQL server takes 80% of server resource which is what is happening in this case- split equally between 2 instances. It turns out only one instance was failing.

    I'm not new to SQL server- have monitored locks and performance tuned queries extensively but this was different- more like there weren't locks - just flags/ errors saying there was. I quessed a system table was corrupt in someway- quite a leap I know, but after this fix it appears to have solved our situation..........at least untill we move onto two new box's with higher spec which are on order.

    It seems a strange solution I know but if i helps anyone else -great!

  • I had a same error from SQL job in one step which is executing a stored procedure.

    And the reason was that at the same time index defragmentation and statstics update job was executing and it had a Schema-M lock on the table.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply