Anyone know how to attach an MDF w/o the LDF?

  • I've got a detached SQL2K SP3a database that has both the MDF and LDF. However, the LDF is corrupted due to a disk failure.

    Both sp_attach_db and sp_attach_single_file_db fail.

    Any ideas how to reattach the MDF whilst ignoring/bypassing the LDF?

  • Rick,

    Just move the corrupt LDF file to another directory or rename it.  The system will complain about the missing log file but will create a new one for you.

    Almost forgot.  I don't know if this works non-gui but will work via EM

    Good Luck



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Both of these work

  • Oops sorry - too fast with the Enter ! EXEC sp_attach_single_file_db @dbname = 'dbname', and in sql 200 you'll get an error like Device activation error. The physical file name 'f:\dbname _log.ldf' may be incorrect. but it works anyway

  • Unfortunately neither of these are working. I wish that they would...

  • Can you post the text of the error message when you try this ?

  • It looks like the other DBA has been messing around with the environment -- so it's now "game over".

    Thanks for your help anyway.

  • If you can't attatch the MDF file because it is corrupt, can you find the latest backup and restore it?  I am sure you have it backup every night.

     

    mom

  • A question... In SQL Server 7.0 also works? Only with attach? 

  • Yes EXEC sp_attach_single_file_db and sp_attach_db .Quite useful

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply