Click here to Skip to main content
13,095,921 members (53,857 online)
Rate this:
Please Sign up or sign in to vote.
See more:
How to Read Sql mdf file of running program that use this database without stopping sqlserver services?
Posted 26-Mar-13 21:55pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


Seriously - don't do it. If SQL server is handling the file, leave it to it. All you will do is read changing or invalid data and cause problems. Access the data via SQL and all will be fine.
Hekmat90 27-Mar-13 4:10am
I only Want to read Tables No change them cause problem.
Is the way to do this?
OriginalGriff 27-Mar-13 4:51am
Doens't matter if you try to read or write - SQL will require an Exclusive lock on tehfile to write to it, and if you are reading then either the data you read will be changing while you read it, or SQL server will be unable to complete it's operation, so data may be lost.
Do not do it. Seriously!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

OriginalGriff is right: don't try do that. The mdf file structure is not simple, and first of all, not public. It is a proprietary format - and you newer know how much your really reverse engineered. But not at least, you will not be able to open the database file directly while the server is using it - not even for reading. It has an exclusive lock. You could only access it if you use VSS (Volume Shadow Copy).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 27 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100