Question : Can't ATTACH an SQL 2005 DataBase

Web application aborted and after that no more logins into it were accepted because:
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

I went and DEATTACH the DB selecting to UPDATE STATS, KEEP FULL TEEXT CATALOGS and DROP CONNECTIONS, DEATTACH was successful.

After that every time I try to re-attach the DB I got this:

TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
CREATE FILE encountered operating system error 32(The process cannot access the file because it is being used by another process.) while attempting to open or create the physical file 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\kpi.mdf'. (Microsoft SQL Server, Error: 5123)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476
------------------------------
BUTTONS:

OK
------------------------------
f I stop SQL, I can copy the DB files. I have re-started SQL and the server. I have performed consistency check on all other DBs.

No luck. Any ideas will be highly appreciated.

Answer : Can't ATTACH an SQL 2005 DataBase

So my suggestion then is to put the copies of the files you have in a different physical location on the box than the one that got restored, and then attach as "Mydatabase_safe"

If that works, the next step is to compare the data and start moving it back into the restored db.  I use SQL Data Compare from Red Gate Software for this.  Well worth every dime, and I am not affiliated with them.
Random Solutions  
 
programming4us programming4us