Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL C#4.0 Server
How to Read Sql mdf file of running program that use this database without stopping sqlserver services?
Posted 26-Mar-13 22:55pm
Hekmat901.4K
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Don't.
 
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.
  Permalink  
Comments
Hekmat90 at 27-Mar-13 4:10am
   
I only Want to read Tables No change them cause problem.
Is the way to do this?
OriginalGriff at 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
good
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).
  Permalink  

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



Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 27 Mar 2013
Copyright © CodeProject, 1999-2014
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