Exclusive Access

  • I am trying to rename a database using sp_renamedb but I keep getting an error that the database cannot be exclusively locked. I can put the database into single user mode, but then I (dbo) am not the single user connected - I am denied permission to the database until I put it back into unrestricted access mode. I can’t figure out what is holding the connection. Under current activity/processes, there is no process that is associated with the database. Is there any procedure that can help me figure out what is holding the connection that is keeping me from gaining exclusive access to the database?

  • sp_who2 should be enough to tell you who are connecting this database. you have to kill all connection to this database before rename it.

    use master

    go

    sp_renamedb 'CE85Test', 'CE85TST'

    go

  • If you're trying to do this from QA, make sure you're not sitting in the database that you want to rename. That's alway good for a laugh make sure that EE doesn't have the database highlighted as well. Sounds silly but it happens to more times than I'd like to admit.

    John Zacharkan


    John Zacharkan

  • sp_who2 does not show any connection to this database. That is my problem, I can't find a connection to kill... Also there are no locks associated with this database.

    Could there be a connection that is held in memory or something that is not listed under sp_who2? Is there any other way to check for connections?

  • Thank you John, I guess that was my problem. It's the little things that drive you crazy...

Viewing 5 posts - 1 through 4 (of 4 total)

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