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
 Error when attaching a database

Author  Topic 

CSharpNewbie
Starting Member

39 Posts

Posted - 2010-01-06 : 23:16:35
I am trying to attach a database in sql 2005 but I get an error msg that the _log.ldf file was not found

How do I create the _log.ldf file?




TITLE: Microsoft SQL Server Management Studio
------------------------------

Attach database failed for Server 'localhost'. (Microsoft.SqlServer.Smo)

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Directory lookup for the file "C:\CreateMDF\TimeTracker_log.LDF" failed with the operating system error 2(The system cannot find the file specified.). (Microsoft SQL Server, Error: 5133)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-06 : 23:52:22
You can use sp_attach_single_file_db instead.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-01-07 : 00:28:51
but before you do...check the source...there was a log file there. did you forget to copy it over too?

go to the original db if it's available to you and select * from dbname..sysfiles. that will show u the location of the file you're missing.
Go to Top of Page
   

- Advertisement -