SQL server agent not running

yash ghelani 1 Reputation point
2022-08-19T05:52:13.46+00:00

Hi,
I have install Microsoft SQL Server 2019 (RTM-CU17) (KB5016394) - 15.0.4249.2 (X64) Developer Edition (64-bit) on Linux (Ubuntu 18.04.6 LTS) ec2 instance . I have enabled sql agent using following command:
"sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true" and have restarted the mssql service.

I have enabled cdc on database as well as table level using the commands provide by microsoft documentation. Along with it have enabled also the snapshot isolation.

Still sql server agent shows following error in the logs:
2022-08-19 05:12:51 - ? [101] SQLServerAgent service successfully started
2022-08-19 05:12:51 - ? [350] Waiting for SQL Server to start...
2022-08-19 05:12:52 - ? [000] Event Global\sqlserverRecComplete opened
2022-08-19 05:12:52 - ? [500] Waiting for SQL Server to recover all databases...
2022-08-19 05:12:54 - ? [100] Microsoft SQLServerAgent version 15.0.4249.2 (X64 unicode retail build) : Process ID 328
2022-08-19 05:12:54 - ? [495] The SQL Server Agent startup service account is ip-172-31-30-24\ip-172-31-30-24$.
2022-08-19 05:12:54 - ? [151] Running SQL Server Agent cross-platform
2022-08-19 05:13:25 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:13:58 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:14:30 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:15:02 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:15:34 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:16:06 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:16:38 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:17:11 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:17:43 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:18:15 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:18:47 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:19:19 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:19:51 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:20:24 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:20:56 - ! [150] SQL Server does not accept the connection (error: 258). Waiting for Sql Server to allow connections. Operation attempted was: Verify Connection On Start.
2022-08-19 05:20:56 - ! [000] Unable to connect to server '(local),1433'; SQLServerAgent cannot start
2022-08-19 05:20:56 - ! [103] SQLServerAgent could not be started (reason: Unable to connect to server '(local),1433'; SQLServerAgent cannot start)
2022-08-19 05:21:01 - ! [298] SQLServer Error: 258, TCP Provider: The wait operation timed out. [SQLSTATE 08001]
2022-08-19 05:21:01 - ! [165] ODBC Error: 0, Login timeout expired [SQLSTATE HYT00]
2022-08-19 05:21:01 - ! [298] SQLServer Error: 258, A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [SQLSTATE 08001]
2022-08-19 05:21:01 - ! [382] Logon to server '(local),1433' failed (DisableAgentXPs)
2022-08-19 05:21:01 - ? [102] SQLServerAgent service successfully stopped
2022-08-19 05:21:01 - ? [098] SQLServerAgent terminated (normally)

FYI,

  • I have added hostname in my /etc/hosts in following manner:
    0.0.0.0 <hostname>
  • I have change the server name to mssql-host (as it was more than 15 letters)
  • I have make sure that tcp is running at 1433 using following cmd:
    " sudo /opt/mssql/bin/mssql-conf set network.tcpport 1433"
  • I have allowed remote connections using following cmd:
    "EXEC sp_configure 'remote access', 1;
    GO
    RECONFIGURE;
    GO"

Can anyone help to find what the problem , as of now have tried the following solution found from internet but still it does not work

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,693 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,451 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. YufeiShao-msft 7,056 Reputation points
    2022-08-22T08:12:57.987+00:00

    Hi @yash ghelani ,

    Please check if your database server is set up to accept remote connection using TCP provider, enable TCP/IP in SQL Server Configuration Manager for instance, the database server may be only listening to local traffic or traffic coming from a private network adapter, and check the firewall

    Please check again the container/ SQL Server name by running select @@servername can resovable into IP address within the container running your SQL.
    https://github.com/microsoft/mssql-docker/issues/503

    Troubleshooting the connect issues:
    https://statics.teams.cdn.office.net/evergreen-assets/safelinks/1/atp-safelinks.html

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.