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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 attaching .MDF file

Author  Topic 

twhitma1
Starting Member

3 Posts

Posted - 2007-10-08 : 15:29:39
Hello everyone,
I'm new here and I have a pretty serious problem. Somehow my database I've been working in is no longer on the server. There is a .MDF file and a log file in the directory path C:\Program Files\Microsoft SQL Server\MSSQL.1\Data I have tried to go into the server and try to right click and use the attach wizard but when I select the MDF it give me an error saying that it is being used by another process. This is really urgent! I hvae everything in the ASP.NET/VB.NET files working with this database but now I can get the db open. I've been working on this for months and now it's due on Monday. Help Please! Thanks

Kristen
Test

22859 Posts

Posted - 2007-10-08 : 19:55:34
If it is in use it is probably actually attached to SQL Server.

Is there another Instance of SQL Server on that machine that it is perhaps attached to?

Put a backup strategy in place!!

Kristen
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-08 : 21:25:39
If the machine doesn't have another sql instance, then double check no file backup nor anti-virus holds those files.
Go to Top of Page

Prem Raymond
Starting Member

2 Posts

Posted - 2007-10-08 : 21:33:17
Stop the SQL Server Service via the services applet or SQL Server service Manager

Re-start SQL Server service

This should drop all the connections

Make sure to start SQL Agent

Use wizard to attach the primary .mdf file

Click on the drop down and browse to the .mdf and .ndf location

Attach the files

Enter the database name

Select sa from the drop down menu

Hope this helps
Go to Top of Page

Prem Raymond
Starting Member

2 Posts

Posted - 2007-10-08 : 21:34:32
Stop the SQL Server Service via the services applet or SQL Server service Manager

Re-start SQL Server service

This should drop all the connections

Make sure to start SQL Agent

Use wizard to attach the primary .mdf file

Click on the drop down and browse to the .mdf and .ndf location

Attach the files

Enter the database name

Select sa from the drop down menu

Hope this helps
Go to Top of Page

twhitma1
Starting Member

3 Posts

Posted - 2007-10-09 : 09:35:28
That worked, thanks very much. I just have one more question though. I am transferring the Database from SQL Server 2005 to a client laptop with SQL Server 2005 express. Session States are a large part of the program. If I am using a database called upsizedCandidate on the local server of the laptop called LT091, how can I enable the session state on the local machine?
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-09 : 22:39:41
What do you mean? How do you transfer db?
Go to Top of Page

twhitma1
Starting Member

3 Posts

Posted - 2007-10-10 : 06:25:50
I'm just trying to figure out how to enable Session State capabilities on SQL Server 2005 Express.
Go to Top of Page
   

- Advertisement -