Author |
Topic |
gsgill76
Posting Yak Master
137 Posts |
Posted - 2006-10-30 : 01:04:20
|
HiCREATE DATABASE nneethrows error:Msg 1807, Level 16, State 3, Line 1Could not obtain exclusive lock on database 'model'. Retry the operation later.Msg 1802, Level 16, State 4, Line 1CREATE DATABASE failed. Some file names listed could not be created. Check related errors.what need to?(I want to add, i created a SP in 'model' DB, after that i start getting this problem, but i deleted that, but still getting the same, before SP its working fine)Regards,Thanks.Gurpreet S. Gill |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-11-04 : 03:27:56
|
You probably just have a connection that has model as the current database or you have the SP open in Enterprise Manager. Creating the SP in model won't cause that problem. Just make sure you close any connections that are using model before you try to create a new database. |
|
|
gsgill76
Posting Yak Master
137 Posts |
Posted - 2006-11-04 : 05:22:54
|
1) I Restart the SQL Server Service2) I Dissconnect & Reconnect the SSMS,this solved the problem.Is there any other way to do the same, i mean, without restart service/reconnecting SSMS ?Regards,Thanks.Gurpreet S. Gill |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-11-04 : 16:21:07
|
You don't need to restart the SQL Server service, just disconnect and reconnect. |
|
|
gsgill76
Posting Yak Master
137 Posts |
Posted - 2006-11-05 : 23:58:15
|
Hi snSQLOK, its working without restarting the SQL Service.Just disconnect & reconnect works fine. Is there any method, by which i can get rid of this problem, without disconnect & reconnect(i mean some T-SQL or somthing like that) ?Regards,Thanks.Gurpreet S. Gill |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-11-06 : 11:56:34
|
Just change the database for your connectionUSE anotherdatabase |
|
|
gsgill76
Posting Yak Master
137 Posts |
Posted - 2006-11-07 : 03:07:17
|
No that doesnt work.this is how i try1) Create a SP in 'Model' DB2) open other query editor(i am using SSMS)3) write following commands USE master CREATE DATABASE DDFFReturns same "Could not obtain exclusive lock on database model " errorI checked from the monitor the connection with the Model DB still exists. only 'USE' command dose not close the connection for 'Model' DB.What the other wayout?Regards,Thanks.Gurpreet S. Gill |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-11-07 : 04:39:32
|
1a) Create a SP in 'Model' DB1b) USE AnotherDatabase2) open other query editor(i am using SSMS)... |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-11-07 : 05:30:56
|
Try -USE masterGOCREATE DATABASE DDFF-------Moo. :) |
|
|
gsgill76
Posting Yak Master
137 Posts |
Posted - 2006-11-07 : 07:00:49
|
Hi Kristen & mr_mistBoth of the command doesnt work.(return same error)The thing is the connection to the 'Model' DB still open. How can i drop/kill this, so that create database command runs fine? |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-11-07 : 07:08:55
|
The connection to the model database needs to issue a USE command to change to a different database. Is that what you did?Kristen |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-11-07 : 07:51:14
|
Here. Look.1) Create a SP in 'Model' DB2) open other query editor(i am using SSMS)3) write following commandsUSE masterGOCREATE DATABASE DDFF-------Moo. :) |
|
|
gsgill76
Posting Yak Master
137 Posts |
Posted - 2006-11-08 : 01:24:33
|
DONE!!!Thanks to all.Regards,Gurpreet S. Gill |
|
|
|