SQL Agent in Level 5 of the Stairway of SQL Server on Linux

SQL Server Agent
The SQL Server Agent is a carrier that runs scheduled SQL Server jobs and may be used to automate not unusual administration tasks. For example, the Agent may additionally notify an operator in case a blunder is raised or send an alert in response to positive performance conditions.



If you're going for walks a SQL Server example on Windows Server, the SQL Server Agent service is covered as part of the SQL Server set up the system, together with the database engine. This is genuine for each edition of SQL Server, except for the Express Edition, which requires something one-of-a-kind to agenda tasks (we will speak approximately this later). Read more at SQL Server DBA online training

SQL Server Agent on Linux
On a Linux server, things are unique, primarily based on the version of SQL Server for Linux you're installing: with SQL Server 2017 Cumulative Update three or below, SQL Server Agent need to be established in a separate procedure while, beginning from the Cumulative Update 4, SQL Agent is blanketed, however ought to be activated. We will observe each situation below.

SQL Server 2017 Cumulative Update three or below
If you're walking SQL Server 2017 Cumulative Update three or below, you should set up SQL Server Agent separately. This may be carried out by running these instructions from the command prompt:
1 2 3 4 5 6 # Update packages list sudo apt-get update # Install SQL Server agent sudo apt-get install mssql-server-agent # restart SQL Server service sudo systemctl restart mssql-server

If you already have a working SQL Server installation with a previous release, you may use the same commands to replace it with the contemporary version. Please be aware that SQL Server Agent relies upon the SQL Server engine so that you ought to replace the engine earlier than you start updating SQL Server Agent itself.

SQL Server 2017 Cumulative Update 4 and above
Starting with SQL Server 2017 Cumulative Update four, the SQL Server Agent provider comes collectively with the engine installation but is disabled due to protection reasons. We have to allow SQL Agent with the following command:
1 2 sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true sudo systemctl restart mssql-server

Did you notice? To installation SQL Server Agent we are the usage of the identical tool we utilized in Level 2 to configure a fresh set up of SQL Server on Linux, the MySQL-conf Python script.

SQL Server Agent on an Express Edition
If you are walking a SQL Server 2017 Express Edition in your Linux device, you already know that there’s no SQL Server Agent available. And as we stated before, on a Windows operating system you may use the Task Scheduler program, to release a batch document or use the SQL cmd command-line tool to run your scheduled queries (for examples like those required to backup your databases or appearing indexes and statistics maintenance).
In a Linux operating machine, there's something similar, the cron device, that we will use to time table a manner and repeat it on an everyday basis.
Thom Andrews wrote a very good article about this subject matter here: https://www.Sqlservercentral.Com/articles/sql-server-agent-for-sql-express-on-linux.
SQL Server Agent and Containers
As you know, SQL Server 2017 may be set up not only on Windows and Linux operating systems, however additionally in a box. The set up on a box is even less complicated than other platforms, gaining from the presence of a Dockerfile. This is a Dockerfile instance with the required commands to put in SQL Server 2017 on a Ubuntu 16.04 machine and enable SQL Server Agent as part of the setup:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # building from ubuntu FROM ubuntu:16.04 # install curl & sudo & apt-transport-https RUN apt-get update && apt-get install -y curl sudo && apt-get install -y apt-transport-https # Import the public repository GPG keys RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - # Register the Microsoft SQL Server Ubuntu repository RUN curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | tee /etc/apt/sources.list.d/mssql-server.list # update package list RUN apt-get update -y # install sql server RUN apt-get install -y mssql-server # enable the agent RUN sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true # start sql server CMD /opt/mssql/bin/sqlservr

Comments

Popular posts from this blog

Informatica Knowledge Base (IKB)

Learn About React Vs. Angular: Which one is easier

MicroStrategy Vs Tableau: 11 Thing You're Forgetting to Do