Loading MDF/LDF files

  • Hi,

    I need to recover data from MDF/LDF files, is this:

    1. possible to do

    2. how is it done, do I need anymore files?

    I copied the MDF/LDF files into the data directory of SQL and the databases show as 'suspect' with no tables. Any help will be greatly appreciated.

    TIA

    Phil Ewington.

  • These files are enough, but 'Suspect' could mean a few different things, so initially we probably need a little extra info:

    Did you detach the database before copying it, and have you reattached the mdf/ldf files?

    Is the mdf file the result of a backup (probably not judging by the file extension, but thought I'd ask anyway).

    Do you want to just restore the database or roll back some/all of the transactions in the log?

    What was the recovery model (SQL 2000) , or were truncate log on checkpoint / select into , bulk copy (SQL 7) enabled.

    Paul Ibison

    Paul.Ibison@btinternet.com


    Paul Ibison
    Paul.Ibison@replicationanswers.com

  • Hi Paul,

    The MDF/LDF files are a result of a disk recovery after a hacker deleted the boot sector of the HDD :o( No backups were available for the databases I am trying to recover, all I want is the data from two tables and am not worried about maintaining datatypes, objects, etc...

  • Sounds nasty! I'd

    (a) check the SQL error log file for any info about the suspect status.

    (b) Am not sure how you added the mdb database to sql server, but using sp_attach_db onto another already installed SQL server (rather than the disk restore) might be easier.

    Paul Ibison

    Paul.Ibison@btinternet.com


    Paul Ibison
    Paul.Ibison@replicationanswers.com

  • Unfortunately, I am not a DBA, but a web developer who has a very basic understanding of SQL Server, well enough to get my applications working anyway :o). I have checked out documentation on sp_attach_db from MSDN, however I do not know how to run a system SP, is there a specific tool to do so, or do I simply use Query Analyser to run the SP?

  • First check the error logs. In EM, open the Management folder, SQL Server logs, Current and locate the reference to the suspect db - this might be helpful.

    For reattaching, Query analyser (from any DB) will do fine. Format like:

    EXEC sp_attach_db @dbname = N'pubs',

    @filename1 = N'c:\mssql7\data\pubs.mdf',

    @filename2 = N'c:\mssql7\data\pubs_log.ldf'

    Paul Ibison

    Paul.Ibison@btinternet.com


    Paul Ibison
    Paul.Ibison@replicationanswers.com

  • I get an error message when I run this SP:

    Warning: Unicode language locale 2057 in database differs from server Unicode language locale of 1033.

    How can I change the locale of the server to allow the SP to run correctly?

  • The unicode locale id is the character set (1033 = English US, 2057 = English UK).

    This shouldn't be a problem as indicated by the severity of the warning (the message is a warning rather than an error). If you want to change it to be compatible, use "exec sp_configure 'unicode locale id', 2057".

    Paul Ibison

    Paul.Ibison@btinternet.com


    Paul Ibison
    Paul.Ibison@replicationanswers.com

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

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