Tr. Log File Corrupt (HD fail) detached cant atach

  • Hi,

    I have a database that became Suspect. Checking Event Log it looked like the Hard Disk had a bad block.

    I wanted to know which file was bad. I stopped the service, copied both *.mdf and *.ldf. The MDF could be copied, but not the ldf.

    So, I restarted the service, and detached the database.

    When I try to reattach it,

    EXEC sp_attach_db @dbname = N'W2KDV1',

    @filename1 = N'c:\MSSQL7\Data\W2KDV1_Datos.mdf',

    @filename2 = N'c:\MSSQL7\Data\W2KDV1_Registro.ldf'

    it says:

    Error: 9004 The log for database 'W2KDV1' is corrupt.

    If I omit filename2, it says the same.

    What can I do to recover my database?

    Any Ideas?

    Thanks!

    Luis

  • Try using sp_attach_single_file_db and see how that goes. This will eliminate the transaction log from the attach and "should" work.

    Good luck.

    David

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • Try David's suggestion and let us know what happens.

    Steve Jones

    steve@dkranch.net

  • Yes, I did tried using that stored procedure. I tried first, with both the DataFile and the Tran Log file present, and this tells me:

    Server: Msg 9004, Level 23, State 2, Line 1

    El registro de la base de datos 'W2KDV1' está dañado. (The log from database 'W2KDV1' is damaged)

    When I remove the Log file, so that it tries to ignore the log file, it tells:

    Server: Msg 945, Level 14, State 2, Line 1

    No se puede abrir la base de datos 'W2KDV1', porque no es posible activar algunos de los archivos. (It isn't possible to open the database 'W2KDV1', because some files cant be activated)

    Server: Msg 1813, Level 16, State 2, Line 1

    No se puede abrir la nueva base de datos 'W2KDV1'. CREATE DATABASE cancelada.

    (It isnt possible to create the new database.)

    I tried also with Create Database for attach, but didn't work neither (with the same error message)

    Any Ideas?!

  • I'm surprised attaching the database without the log file did not work. Try using the EM GUI and specifying the data file for a new database, but renaming or deleting the log file.

    If that doesn't work, I might create a new database (same size) and then detach it. Then copy over the new mdf file with the old mdf file and reattach.

    Steve Jones

    steve@dkranch.net

  • unfortunately, i've tried this and didn't work neither.

    Is there any way you can restore a DB from the mdf instead of a backup file?

  • No that I know of. If this is valuble data, I'd call MS and get a case going.

    Steve Jones

    steve@dkranch.net

  • No, thanks God. It's a Demo Database. I'll have to rebuild it then.

    Thanks anyway!

  • Sorry we couldn't help.

    Steve Jones

    steve@dkranch.net

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

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