Answered Error creating database

  • Tuesday, February 28, 2012 2:28 PM
     
     

    I get an error every time that I try to create a new database -- Cannot set a lock on system database??

    I never had this problem before. Any suggestions??

    I have inserted a snapshot of the error.


    • Edited by Clive-Online Tuesday, February 28, 2012 4:02 PM
    •  

All Replies

  • Tuesday, February 28, 2012 3:57 PM
     
     

    Hi,

    Can you post the complete error message please?

    thanks,

    Janos


    There are 10 type of people. Those who understand binary and those who do not.
    My Blog

  • Tuesday, February 28, 2012 4:07 PM
     
     

    Did you check whether there is any blocking with the system databases?

    Can you check this article http://decipherinfosys.wordpress.com/2007/01/29/could-not-obtain-exclusive-lock-on-database-model/


    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Tuesday, February 28, 2012 4:28 PM
     
     

    I logged in (Database Engine) using SQL Server Authentification rather than Windows Authentification. The create database worked.

    Need to login as SQL Server Authentification??


    Clive

  • Tuesday, February 28, 2012 4:32 PM
     
     

    Hi,

    authentication scheme does not matter, if you have permission to create database. try to disconnect and reconnect to the instance and try again. Also make sure all service packs/CUs are installed.

    Thanks,

    Janos


    There are 10 type of people. Those who understand binary and those who do not.
    My Blog

  • Thursday, March 01, 2012 9:04 AM
    Moderator
     
     Answered

    Hi Clive,

    You need to disconnect from “Model” database. This is because of new database is created from "Model" database.

    If it is not work, disconnect and Reconnect your SQL Server Management Studio’s session. Your error will go away.

    The exclusive lock on the model database is a necessary step to create a new database. When SQL Server creates a new database, "The SQL Server uses a copy of the model database to initialize the database and its metadata". Also, users could create, modify, drop objects in the Model database. As such, it is important to exclusively lock the model database to prevent copying the data in change from the Model database. Otherwise, there is no guarantee that the content copied from the Model database are consistent and valid.

    For more information about creating a new database, please refer to the following link:
    http://msdn.microsoft.com/en-us/library/ms176061.aspx.

    For more information about Model database, please refer to the following link:
    http://msdn.microsoft.com/en-us/library/ms186388.aspx.


    Thanks,
    Maggie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.