Create Database Failed

  • Has anyone ever seen this error message when trying to create a database?

    Server: Msg 1807, Level 16, State 3, Line 1

    Could not obtain exclusive lock on database 'MODEL'. Retry the operation later.

    Server: Msg 1802, Level 16, State 1, Line 1

    CREATE DATABASE failed. Some file names listed could not be created. Check previous errors.

  • Yes, it means someone or some thing has connected to the Model database. The Model database is what is used as a template for all databases.

    You can use sp_who or sp_who2 or EM to find out who is in it and can kill the connection youself if needed.

    I got this error as I had QA attahced to model when running and had not relized it the first time I came accross.

  • I've seen this message before although I can't remember the exact situation. My guess is that someone else holds a connection to the model datatabase or maybe you've selected the model database in QA while trying to create a new database.

    [font="Verdana"]Markus Bohse[/font]

  • I've seen this message before although I can remember the exact situation. My guess is that someone else holds a connection to the model datatabase or maybe you've selected the model database in QA while trying to create a new database.

    [font="Verdana"]Markus Bohse[/font]

  • I just checked EM and it doesn't seem like there is anyone connected to the Model db. sp_who returns too much to scan through to see if anyone is connected. I tried to created it again and it still gives the same error.

  • If sp_who returns too much data then you could store the results into a temp table and query that temp table to see if anyone is accessing/locking model....there was a thread on how to store the results of sp_who but I can't find it...however this should also work :

    create table #temp1(spid int,status varchar(100),loginname varchar(100),

    hostname varchar(100),blk int,dbname varchar(100),cmd varchar(100))

    insert into #temp1 exec sp_who

    select * from #temp1 where dbname = 'model'

    drop table #temp1

    p.s : and thanks for the tip on being attached to model via QA ...we had the same problem once and it worked when we shut off QA and relogged in...and we assumed that it was one of those wierd restart-system-to-get-it-working errors...

    Edited by - winash on 05/30/2003 4:31:08 PM

  • Run sp_who in QA then click in the result window and use find. Find is based on which section has focus, so as long as your cursor is in the results you can seach the results.

  • don't position yourself (with EM) at the model-db when you want to create a new db.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Thanks everyone for your help. The db was created this morning when the SQL Server switched to the secondary node. No one knows why it wouldn't go, I couldn't see any connections to Model through sp_who2 either. (I pasted the results in Excel and sorted them from there.)

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

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