Sql-server – How to resolve MDF and LDF files remaining in use

sql serversql-server-2000windows

I am attempting to copy off approximately 220 gigs of database MDF and LDF files from a MS SQL server 2000 install in order to transfer ownership to a third party.

The error I get when I try to stop the database using the enterprise manager is

Error 1051: A Stop Control Has Been Sent To A Service Which Other Running Services Are Dependent On

Going to the service and looking at the dependencies tab does not show any other services running in relation to it. If I stop the actual Windows service, and try to copy it tells me that the databases are still in use. I have changed the service from automatic to manual and rebooted, and it still insists the files are in use.

I don't particularly care about copying the log files, but how can I resolve the error to do a clean shutdown and be able to copy off at least the MDF files?

Best Answer

The Restart-Service cmdlet sends a stop message and then a start message to the Windows Service Controller for a specified service. If you specify -force parameter, it means override restrictions that prevent the command from succeeding, e.g. stop and restart a service that has dependent services.

However, Windows Server manager launched via services.msc you mentioned is not running with force parameter when you click restart button there.

Thus if you want to do that, either stop the dependent services first, then retry or use the PowerShell command line to restart.