microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Agent not working properly on SQL Server 2019 Linux based container

m4ss1m0g opened this issue · comments

Cannot setup Sql Server Properties

  1. Run an image docker run -d -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=P@ssw0rd!" -e "MSSQL_AGENT_ENABLED=true" -p 9001:1433 --name sql1 --hostname sql1 mcr.microsoft.com/mssql/server:2019-latest
  2. Open SSMS
  3. Right click on Agent -> Properties
  4. Select Alert System tab and click ok, raise error A severe error occurred on the current command. The results, if any, should be discarded. (.Net SqlClient Data Provider)
  5. Same error if you generate the script
GO
EXEC msdb.dbo.sp_set_sqlagent_properties @email_save_in_sent_folder=1
GO

Cannot raise alert

  1. Create a new alert for error 21 (but any is good)
  2. Add an operator with a fake email
  3. Open a query an run RAISERROR ( 'Whoops, an error occurred.',21,1)WITH LOG
  4. The alert is never triggered (See history)
  5. No Log is written

UPDATE

I see that files under /var/opt/mssql/log belong all to root, changing its from root:root to mssql:root the log node is now visible on SSMS

root@server_db1:/var/opt/mssql/log# ls -l
total 1724
-rw-r----- 1 root  root    77824 May 12 07:56 HkEngineEventFile_0_132968157614770000.xel
-rw-r----- 1 root  root    17156 May 12 08:17 errorlog
-rw-r----- 1 root  root        0 May 12 07:56 errorlog.1
-rw-r----- 1 root  root    83456 May 12 08:18 log.trc
drwxrwx--- 1 mssql mssql    4096 May 12 07:39 mssql-conf
-rw-r----- 1 root  root    10776 May 12 08:17 sqlagent.1
-rw-r----- 1 root  root      204 May 12 08:19 sqlagent.out
-rw-r----- 1 root  root      113 May 12 07:55 sqlagentstartup.log
-rw-r----- 1 root  root  1548288 May 12 08:18 system_health_0_132968157629370000.xel