Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 database seems to be stuck in open

Author  Topic 

JeffInTexas
Starting Member

7 Posts

Posted - 2011-12-08 : 10:17:37
I set up an Express Database which I intend to use with a C# application. From within C#, I used Add New Data Source to use this new database. At the conclusion of the add process, it asked me if I wanted to copy this database file into my project since it was a local file that was not part of my project (I suppose to just have an independent copy for programming and tinkering). I said "Yes." It did nothing.

I tried the Add New Data Source procedure again. Now, I get a message I don't have permission to open the file (because, I am sure, the file is marked as already in use by me). From there, everywhere I went - even in SQL Manager Studio - it would not let me access the file. The same remained the case even after a re-boot.

This morning, I wake up, turn on the computer, and the file is available again. So, I try all this again and find myself stuck in the same place. I guess maybe I should not have tried to make a copy of the file into my project.

In any case, is there a way to speed up the process of getting the system to recognize the database as not in use by me? It's like there must be some kind of tag in it that is for saying, "I'm in use." It must be being set to "In use" and then getting stuck that way after whatever error occur on the attempt to copy the file.



russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-12-08 : 11:43:16
SQL Server databases are at least 2 files.

They are always in use, as SQL Server runs as a service (unless you stop the service).

Don't import in VS.
Go to Top of Page

JeffInTexas
Starting Member

7 Posts

Posted - 2011-12-08 : 12:20:14
Thanks, I concluded the same thing after thinking about it. In the meantime, it seems like it locks the file in "open by me" for hours and not even re-booting will release it back to me to try again. Do you know a way to go in (maybe to Server Studio) and release the file?

P.S., I am talking about the use of a Test Database and not the master, model, etc.

Go to Top of Page

JeffInTexas
Starting Member

7 Posts

Posted - 2011-12-08 : 12:27:08
NM - found it. I had to unmap the user from the database in Server Studio.
Go to Top of Page
   

- Advertisement -