SQL Server Agent not running on Linux

  • Hello everyone,

    I am about to start using SQL Server on Linux, as it is supported with all the features we need as of this moment. I did try a SQL Server installation on Ubuntu 16.04 and it went all good. However, I find some difficulties getting the SQL Agent to work.

    I have Microsoft SQL Server 2017 Standard (CU19), so I do not need to install the Agent service manually according to the documentation. The service is enabled (sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true). It is also shown as available in SSMS. You can create operators, alerts and jobs.

    However, as all such commands for creating SQL Agent related objects do pass, there is a warning that 'SQLServerAgent is not currently running so it cannot be notified of this action'. I receive such a message when trying to run any of the created jobs too.

    SQLServerAgent is not currently running so it cannot be notified of this action. (Microsoft SQL Server, Error: 22022)

    I did read the sqlagent.out error log file, it appears that the agent can't start because it can't connect to the local server.

    SQLServerAgent could not be started (reason: Unable to connect to server '(local),1433'; SQLServerAgent cannot start)

    Anyone having an idea how to check / change a SQL Agent service account on Linux?

    Any help is highly appreciated.

    Thanks

    • This topic was modified 4 years, 9 months ago by  mTBCent.
  • What happens if you restart the service?  According to the docs the service needs to be restarted after 'set sqlagent.enabled true'.  If that doesn't work I'd make a support call.

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Hello scdecade,

    And thanks for replying. I did restart the service a couple of times, it did not solve the problem. However, I did found a solution to this problem.

    This was an AWS EC2 instance of Ubuntu 16.04. When installing, it did not prompt for a hostname and assigned an AWS hostname to the new machine of template 'ip-{PrivateIPAddress}'. In SQL Server, both the @@SERVERNAME and SERVERPROPERTY('Servername') properties returned this AWS - assigned hostname. However, SQL Agent did error out on starting up because it was trying to connect with the 'ip-{PrivateIPAddress}' server name on port 1433, but such server did not existed.

    I did change the hostname of the machine, after which I dropped the old server in SQL Server and added the new one, to match the change (sp_dropserver / sp_addserver).

    After the restart the SQL Agent started automatically and without errors. I was able to execute a job and do all the regular work with it.

    Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply