Results 1 to 6 of 6

Thread: Newbie SQL2000 LDF Question

  1. #1
    Join Date
    Mar 2005
    Location
    Oakland, CA
    Posts
    3

    Newbie SQL2000 LDF Question

    Our company uses an application that regularly creates LDF/MDF data archives of essential databases on a biweekly basis. To view data from an archived period, this app has an executable that pulls data from these archive files wihtout leaving them in the active database.

    I know which LDF/MDF set to pull for a given date range (they left a nifty date-reference by datafile table for me to reference), so I know which file to pull, I'm just not sure on the cleanest way to view it.

    I'm minimally experienced with SQL (I know enough syntax to do a SELECT query or a basic sp), but I'd like to find a way to trigger a stored procedure or something that will pull data from the data archives so I can build my own processes to view the archived data on my own terms (my asp interface). The app that created the data files doesn't leave the tables attached, and I'm worried about making a process that attaches/detaches the data files because I am to the understanding that detach will rewrite the ldf/mdf file. I don't want to do that. I just want to read from the LDF or MDF in a query, I don't want to move files or rewrite (I want to keep everything read only).

    Am I missing a very basic means of viewing the data in these files? Can anyone recommend a site with sample statements/code for such a task?

    Thanks.

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    You can't read data from .mdf nor .ldf file directly, have to attach them to sql server as db first.

  3. #3
    Join Date
    Mar 2005
    Location
    Oakland, CA
    Posts
    3
    Thank you for the reply.

    Just what I feared.

    If I do an attach/detach sequence with the LDF/MDF files, will it rewrite them or are the functions passive? If the detach function is a write only gig, is it possible to attach the data, read, then delete the table so that the source ldf/mdfs are not molested, or will the attach delete the source files?

  4. #4
    Join Date
    Feb 2003
    Posts
    1,048
    Without the files, there is no database. Attaching or detaching the files doesn't change them. If you delete a table, that will change the files.

  5. #5
    Join Date
    Mar 2005
    Location
    Oakland, CA
    Posts
    3
    Thanks! I got the impression from this article:
    http://support.microsoft.com/default...b;en-us;224071

    that the detach was writing the mdf. Cool! I appreciate your help.

  6. #6
    Join Date
    Feb 2003
    Posts
    1,048
    Yeah, those KB articals can be confusing sometimes. When you create a new database, it writes the mdf and ldf files.

Posting Permissions

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