Urgent -- need to attach database but don't have ldf

A client sent me xxxx.mdf without the associated xxxx.ldf.  Is there any way to go ahead and attach this database?

I tried creating my own xxxx database, which of course created an xxxx.ldf, then detached it.  Then I tried to attach the correct xxxx.mdf w/the newly created xxxx.ldf, and of course that didn't work.

Can this be done?

LVL 5
gary_jAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
This may have an answer for you if you have or acquire an account:

Attaching a database that has missing log file
http://searchdatabase.techtarget.com/ateQuestionNResponse/0,289625,sid13_cid604510_tax294863,00.html
0
acampomaCommented:
Attach the database using sp_attach_db (see BOL for syntax). If you are lucky, SQL will re-create the ldf file for you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LowfatspreadCommented:
use

sp_attach_single_file_db [@dbname =] 'dbname',
    [@physname =] 'physical_name'

for cases when you don't have the ldf ...

don't forget you still need to sort out the "orphaned" users once the database is created on your server.

hth
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

gary_jAuthor Commented:
using this command:

sp_attach_single_file_db @dbname = 'mydb',
      @physname = 'e:\sqldata\mydb.mdf'

returns this error:

Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'mydb'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'c:\sqllogs\mydb.ldf' may be incorrect.

Seems it's looking for the ldf on its own ...
0
pedros7Commented:
Unfortunately, those functions only work if you user the dettach function before on the server!

Have a look at:
http://www.spaceprogram.com/knowledge/sqlserver_recover_from_deleted_log.html 
0
gary_jAuthor Commented:
I split the points because the correct answer may well have been "it can't be done" but everybody tried.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.