Deleted log file

  • I have a client who's log file has exploded to 27 gb (!) and he attempted to solve it by downing the SQL Server, deleting the log file (without making a backup) and re-starting the server in the hope it would re-create the log file. What exactly happened when he upped the the serer is unclear , but subsequant attempts to re-atach the mdf file with no log file failed. Using sp_attach_db or sp_attach_single_file_db made no difference - kept getting the "error opening the physical file d:\mssql\data\<name>.ldf. CREATE DATABASE statement failed" or words to that effect.

    I've performed single file attachments before without having taken a backup before detaching it. What is the problem?

  • Not sure, but try attaching to another server to see if you can get it up. Also, the master may have it marked as suspect, try sp_resetstatus with it down and/or sp_detach_db from the server to remove the entry from master DB of the server then try reattach.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • You'll also get an error if there was more than one log file. Attach doesnt like it if one is missing, but you can work around.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • Yes, probably because there will be an entry in the db's sysfiles table for the second log file.

    On that suggestion of using sp_resetstatus because its marked as suspect, I suspected this (forgive pun!) and got the client to restore from the old back up, then delete the db in Ent. Mangr. This would have removed it from the master db's sysdatabases table altogether I would have thought. But the single file attachment still didn't work.

    Nonetheless I'll try sp_resetstatus.

Viewing 4 posts - 1 through 3 (of 3 total)

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