Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003
    Posts
    2

    Unanswered: Cannot attach after recovery of file

    I deleted a database that had no backup on it. I was able to undelete the MDF and LDF file, but when I attempt to reattach I receive the folowing errors. Does anyone have any suggestions how I might be able to work around this?

    for this sp exec sp_attach_db 'plm','d:\mssql7\data\plm.mdf'

    Server: Msg 5172, Level 16, State 15, Line 1
    The header for file 'D:\MSSQL7\data\plm_log.LDF' is not a valid database file header. The PageAudit property is incorrect.
    Server: Msg 5105, Level 16, State 1, Line 1
    Device activation error. The physical file name 'D:\MSSQL7\data\plm_log.LDF' may be incorrect.
    Server: Msg 945, Level 14, State 1, Line 1
    Database 'plm' cannot be opened because some of the files could not be activated.
    Server: Msg 1813, Level 16, State 1, Line 1
    Could not open new database 'plm'. CREATE DATABASE is aborted.

    for this sp (after removing log file from data directory)
    exec sp_attach_single_file_db 'plm','d:\mssql7\data\plm.mdf'

    Server: Msg 945, Level 14, State 2, Line 1
    Database 'plm' cannot be opened because some of the files could not be activated.
    Server: Msg 1813, Level 16, State 2, Line 1
    Could not open new database 'plm'. CREATE DATABASE is aborted.

    Using MSSQL 7 and am trying to restore on the same server where the db was originally located.

    I do not have any other copies of this data, any help would be appreciated.

  2. #2
    Join Date
    Dec 2002
    Location
    Czech Republic
    Posts
    249
    Are both servers MSSQL7? This error is returned if you try to restore MSSQL2K file to MSSQL7.

  3. #3
    Join Date
    Apr 2003
    Posts
    2
    The file was recovered from a delete on the same server I am restoring to. In short, yes.

  4. #4
    Join Date
    Dec 2002
    Location
    Czech Republic
    Posts
    249
    You can try to create a database with the same file locations as the original database, stop SQL Server, replace files and start SQL Server.
    If your database would be connected, you can use DBCC commands.

    But if you didn't recover files correctly, you cannot use normal methods.

    The correct MDF header (hex) - MSSQL2K SP3
    ------------------------------
    010F000008010000
    0000000000000000

    Try 3rd party recovering utilities
    http://www.officerecovery.com/mssql/
    http://www.lumigent.com/
    Download demos and try if they are usable (you will get a sample output or not)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •