Agent not working properly on SQL Server 2019 Linux based container
m4ss1m0g opened this issue · comments
Cannot setup Sql Server Properties
- 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
- Open SSMS
- Right click on Agent -> Properties
- 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)
- 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
- Create a new alert for error 21 (but any is good)
- Add an operator with a fake email
- Open a query an run
RAISERROR ( 'Whoops, an error occurred.',21,1)WITH LOG
- The alert is never triggered (See history)
- 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