Upgrade from SQL 2005 to SQL 2012 fails with error “Service 'SQLSERVERAGENT' start request failed.”

I was working on a 2005 to 2012 upgrade issue and came across an interesting issue which I thought of sharing with you guys. 

Whilst running an upgrade from 2005 SP4 to 2012 RTM (and/or slipstreamed copy) it failed half way through, giving the error:

 

"There was an error attempting to remove the configuration of the product which prevents any other action from occurring. The current configuration of the product is being cancelled as a result."

 

I went ahead and had a look at summary.txt in bootstrap folder. (C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap).

 

Here is what I came across:

 

Feature: Database Engine Services

  Status: Failed: see logs for details

  Reason for failure: An error occurred during the setup process of the feature.

  Next Step: Use the following information to resolve the error, and then try the setup process again.

  Component name: SQL Server Database Engine Services Instance Features

  Component error code: 25012

  Component log file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20130520_100523\sql_engine_core_inst_Cpu32_1.log

  Error description: There was an error attempting to remove the configuration of the product which prevents any other action from occuring. The current configuration of the product is being cancelled as a result.

  Error help link: https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3128.0&EvtType=sql_engine_core_inst.msi%40Sqlmsirc_NotifyFeatureStates_32%4025012

  Component name: SQL Server Database Engine Services Instance Features

  Component error code: 0x84BB0001

  Error description: Service 'SQLSERVERAGENT' start request failed.

  Error help link: https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3128.0&EvtType=0xCA1338EF%400x0A2FBD17%401211%401&EvtType=0xCA1338EF%400x0A2FBD17%401211%401

 

The bit in yellow is interesting here.

 

I then went to services.msc and saw that SQL server agent service was in a STOPPED state. I attempted to start it, however, it failed to start. I wanted to and check the SQLAGENT.OUT log file, however, to my surprise, the folder in which the SQL server logs were saved, the SQLAGENT.out file was NOT getting updated.

 

Hence I hit a roadblock, as the application event logs were not showing messages that could lead to anything substantial.

 

Next step was pretty obvious, try and run the service using the SQLAgent90.exe itself. You must be wondering why SQLAgent90.exe? Remember we were upgrading to 2012, however it failed half way through, and the version of SQL agent which was still installed on the box was 2005 SP4.

 

Anyway, tried the following:

 

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn>SQLAGENT90.EXE -i MSSQLSERVER

 

Microsoft (R) SQLServerAgent 9.00.5000.00

Copyright (C) Microsoft Corporation, 1995 - 1999.

 

StartServiceCtrlDispatcher failed (error 6).

 

It gave me the error: StartServiceCtrlDispatcher failed (error 6).

 

Doing a net helpmsg for Error 6 gave the following:

 

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn>net helpmsg 6

 

The handle is invalid.

 

This prompted me to have a look at the registry for SQL server agent as after all we were failing to start the agent and weird enough, the SQLAgent.out was not getting updated.

 

Looked in the following registry hive:

 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\SQLServerAgent : Checked the Binary entry for ErrorLogFile: It was pointing to E:\SQL\Log.

 

Checked if that path existed: To my surprise it was not there. Therefore, updated the path of the log file in the registry (take proper registry backup before doing so). And tried to restart the agent, it started successfully and hence the upgrade was also successful.

 

Key Learnings:

1.       In case you are upgrading from any version / edition to any version/edition, and you get the error:
        "There was an error attempting to remove the configuration of the product which prevents any other action from occurring. The current configuration of the product is being cancelled as a result."
          Please check in the Summary.txt and if you find that SQL server agent is down, please follow the steps above.

2.       Even if you are not upgrading, and struggling to get the SQL server agent started, try running the EXE from the command prompt, and see if it matches the issue documented above.

 

Hope this helps.

 

 

Author:

Amit Arora, Support Engineer, Microsoft India GTSC

 

Reviewed by:

Amit Khandelwal, Technical Lead, Microsoft India GTSC