Avatar of Thomas Anthony
Thomas Anthony
Flag for United States of America asked on

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

Avatar of undefined
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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Pavel Celba

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Tom Cieslik

Ok, so use some backup software to backup drive or folder like AOMEI BACKUPER then restore only database from backup

https://www.backup-utility.com/
Thomas Anthony

ASKER
Didn’t use that app but did use a backup program (NovaStor) and it skipped the file due to it being in use.
Tom Cieslik

Try AOMEI. It's simple and free
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Thomas Anthony

ASKER
AOMEI results same as My $400 NovaStor Advance Server. No joy.
ASKER CERTIFIED SOLUTION
Tom Cieslik

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
arnold

Fsutil  needs to be used to see whether the file status is what indicates that it is in use.
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil-file
https://blogs.technet.microsoft.com/askds/2008/11/11/dfsr-does-not-replicate-temporary-files/
Clearing the status reference if set, might help resolve your issue.
Pavel Celba

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?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Thomas Anthony

ASKER
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.
Thomas Anthony

ASKER
Best assumption is a corrupted file.
Your help has saved me hundreds of hours of internet surfing.
fblack61
John Tsioumpris

well maybe you can  recover the file...but this is another question
Pavel Celba

This really seems to be corrupted disk and the only chance is recovery software. If you copy this file to a new location then it will be incomplete most probably and you will need to use some SQL Server file recovery software, e.g. http://www.officerecovery.com/repair-corrupted-mssql-database/ or https://go.veeam.com/microsoft-sql-server-explorer.html or something other.

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.

If the harddrive is not readable then repair it. Look e.g. here for more info: https://www.easeus.com/data-recovery/other-recovery-software/hard-drive-repair-software.htm

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
Pavel Celba

And please tell how the AOMEI did help :-)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.