Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to Read Sql mdf file of running program that use this database without stopping sqlserver services?
Posted

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.
 
Share this answer
 
Comments
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!
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).
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900