handsomeGun
handsomeGun

Reputation: 146

How do I attach an .mdf to sql2005?

Running sp_attach_single_file_db gives this error:

The log scan number (10913:125:2) passed to log scan in database 'myDB' is not valid

Isn't it supposed to re-create the log file?

How else would I be able to attach/repair that .mdf file?

Upvotes: 0

Views: 1379

Answers (2)

handsomeGun
handsomeGun

Reputation: 146

It worked, when I installed another one (with .ldf log file) then the one in question, then detached the first one again. Don't ask me why.

Upvotes: 1

Nick Craver
Nick Craver

Reputation: 630349

It depends what mode your database was in when it was detached, it's possible there are uncommitted/unwritten transactions in that log file that are needed to attach the database, otherwise there would be data loss. Do you know what recovery mode you were in when it was detached?

Upvotes: 1

Related Questions