Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repair/Remove/Install processes for SQL Server 2012 Express get stuck or hung

An instance of SQL Server 2012 Express became corrupted somehow.
I suspect it was related in some way to my use of Entity Framework, but have no proof yet.

When trying to repair the instance, the repair process seemed to be stuck at the SqlEngineConfigAction_repair_validation_Cpu64 step.
It was at that step for a long time with no noticeable CPU usage, so I finally cancelled the repair process.

When trying to remove the instance, the uninstall process seemed to hang at the SqlEngineConfigAction_remove_validation_Cpu64 step.

When trying to install a 2nd instance, the install process seemed to hang at the SqlEngineDBStartConfigAction_install_configrc_Cpu64 step.

For some of the attempts, the SQL Server services were not manually stopped beforehand. For other attempts, the services were manually stopped, and changed from "Automatic" to "Manual".

Symptoms of the database corruption, in case this helps:
"SQL Server (SQLEXPRESS)" service has a status of "Started" on system reboot, but gets stuck in "Starting" status when the service is manually restarted using the Restart option.

When the service is manually stopped and then started, it displays this error:

Windows could not start the SQL Server (SQLEXPRESS) service on Local Computer. Error 1053: The service did not respond to the start or control request in a timely fashion.

SSMS (SQL Server Management Studio) fails to connect to the instance. It either tries forever with no timeout or error displayed, or it displays this error:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The wait operation timed out.)(Microsoft SQL Server, Error: 258)

EDIT: I'm guessing the down-vote was because this was not stated in the form of a question. So to clarify, the question is how to resolve the issue of the Repair, Remove, or Install process hanging?

EDIT2: As a followup, it turns out the root cause of the corruption was shutting down the Windows 7 PC without first explicitly stopping the SQL Server services, even though SQL Server Express was not actively being used at the time.

EDIT3: Issue seems to have been resolved in SQL Server 2014 Express.

like image 502
jk7 Avatar asked Feb 01 '15 19:02

jk7


People also ask

How do I completely uninstall SQL Server 2012?

To begin the removal process, navigate to the Control Panel and then select Programs and Features. Right-click Microsoft SQL Server (Version) (Bit) and select Uninstall. For example, SQL Server 2012 (64-bit). Select Remove on the SQL Server dialog pop-up to launch the SQL Server installation wizard.

How long does SQL installation take?

Maybe a couple of hours. If you mean getting building a database for some sort of use, it could be a few hours for a simple one, to a number of months for a moderate sized one. I did one for half of the data in a medium sized company in approximately five months. Was this worth your time?


2 Answers

In my case the reason for the uninstaller getting stuck at SqlEngineConfigAction_repair_validation_Cpu64 were invalid file paths in the SQL server's system tables.

To correct this, allowing uninstallation, this worked for me:

1) Set service to use local account (Start -> Local Services -> SQL-Server->Properties -> Log on -> Local System acccount)

2) Follow the steps here: https://social.technet.microsoft.com/wiki/contents/articles/31786.sql-server-not-starting-after-fresh-installation.aspx

3) Retry uninstalling.

In case the above link becomes unavailable, here's a short summary:

  • Start the SQL server service in recovery mode: NET START MSSQL$SQLEXPRESS /f /T3608
  • Connect to server: SQLCMD -S .\SQLEXPRESS
  • List the files referenced in system table: SELECT name, physical_name, state_desc FROM sys.master_files ORDER BY database_id; (go)
  • Wherever the file path points to something invalid (like a missing drive), adjust it, using this: ALTER DATABASE model MODIFY FILE ( NAME = modeldev, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS01\MSSQL\DATA\model.mdf'); (go) Note that the files have different NAMEs and different extensions (.mdf, .ldf)
  • Exit sql server (exit)
  • Shut down the service NET STOP MSSQL$SQLEXPRESS
like image 143
Efrain Avatar answered Oct 30 '22 18:10

Efrain


Try sbEnable=1

This advice from TechNet worked for me:

Following Registry-Key must be set to 1[...]:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat\sbEnable = 1

In my case that registry directory did not exist at all. And the uninstall was STILL stuck at that location for several (less than 10) minutes. But eventually it continued and finished.

like image 20
StackzOfZtuff Avatar answered Oct 30 '22 17:10

StackzOfZtuff