Cannot copy a SQL Express file from a non-bootable machine
I have a user with a POS system that runs on MS SQL Express. I believe it is V2008. Their machine died and is unbootable but the system hard drive is readable. I am trying to copy the *.dat file their app uses to another machine to get them up again (no they didn't have a backup) but when I try to copy the file it tells me the file is in use. I have tried to take ownership of the file which appears to be successful but I still get the error.
I tried to use NovaStor backup to backup the file but it says it is in use. The hard drive is connected via a USB drive so the SQL program is not running or accessing the file. I assume it is an issue with the file type and SQL Express.
Is there a way to extract this file from the old hard drive and move it to a working machine so I can get their business up and running again?
Thanks so much in advance for your help.
DatabasesSQL
Last Comment
Pavel Celba
8/22/2022 - Mon
Tom Cieslik
I think that Indexing is blocking your file.
Try to stop Windows Search service and try copy file again.
If this will not work from Explorer, try use CMD as Administrator and copy over file manually.
John Tsioumpris
If everything fails find a bootable WinPE and boot form it and copy your files..
Thomas Anthony
ASKER
I stopped the search services with no joy. I will try the WinPE next.
Thanks.
For what reason do you need the *.dat files? And how do you know the "SQL program is not running"? What is the name of this program?
MS SQL Express is running as Windows Service and uses *.mdf and *.ldf files by default.
If the machine died then it is highly probable these files will be corrupted so you have to run all the DBCC checks immediately after mounting them to the new SQL server.
Tom Cieslik
You can try connect this disk to new working SQL Express and if you going to have SQL Management tool installed you can try attache database from affected disk, then backup it to file on new computer/SQL server then restore to new Database server.
Thomas Anthony
ASKER
I stated in the initial post that the data is on a hard drive connected to a usb interface because I took it out of the original machine. I know sql isn’t running because it isn’t installed on the machine I am working on. The program is called MIC Systems. It is a motorcycle pos system. It uses .dat as its database but MS SQL Express as its engine.
So you are telling you have all the necessary files on USB disk, this disk is connected to a new computer but you cannot copy the *.dat files from USB to computer's harddrive as it reports "file in use error".... Simple idea is "Who or what software could open use files?". Yes, you could download Process Monitor and look at the log but it is too technical step.
This whole story sounds like a nonsense. When you connect standard USB to a new computer then you have to see all the files. Or your computer is full of viruses or your USB disk is copy protected by some software or by access rights (it should not report file in use in such case but who knows).
So to summarize and go further you should answer a few questions:
1) The old computer cannot boot so how did you move the files to the USB drive? Did you dismount the system drive from the broken computer and mount it to the new one via USB?
2) Are you sure all the data are in *.dat files? Are you sure MS SQL Server uses just dat files and nothing else? The whole MIC Systems application does not mean just SQL Server but much more.
3) Did you install the MIC Systems on the new computer? I am sure the simple copy cannot work as the software installation means registry update and possibly more.
4) Did you call the MIC Systems support and ask them what is the correct procedure to move their software and data to the new computer? Their support number is 714-545-4444. What was the answer?
I removed the old hard drive from the old system and installed it into a usb enclosure. I can move or copy all files on the old drive except the .dat file (which is leading me to believe it is corrupted).
I have been working with the support for MIC systems for the past 3 days but they are little help without the ability to move the file.
My request today will be for them to try to open the file directly from the usb drive without moving it.
For the record, the first thing I did and always do is check a system for malicious code or viruses. I would assume this being an experts Exchange that that is a given?
Thomas Anthony
ASKER
Also when I first got the error of the file being in use the first thing I did is checked for open files and used process monitor. Again, assuming this is expert Exchange I should do due diligence before asking questions.
Thanks for all of your suggestions.
I would highly recommend to give this work to professional as he knows the details about SQL Server file structures. Fortunately, SQL Server keeps data in one file and transactions in another file so it is possible to reconstruct data from the past transactions.
MS SQL database is not alone. It contains 3 system databases which are not used by your application so you don't need to restore them because they'll be created during SQL Express installation.
Your steps should be following:
1) Make a physical copy of the corrupted harddrive to a new disk and work with this new disk preferably (use harddrive cloning software)
2) Copy the SQL Server files to a computer where SQL Server is installed and attach them
3) Check the file integrity by SQL Server tools
4) Use the SQL Server data recovery software mentioned above
Try to stop Windows Search service and try copy file again.
If this will not work from Explorer, try use CMD as Administrator and copy over file manually.