Skip to content

Commit 1c93b1f

Browse files
committed
CU4 Changes
New installation instructions for SQL Server Agent, setting new master db file location, setting new errorlog location and new enviroment variables for Agent/MasterDB/Errorlogs
1 parent e21803f commit 1c93b1f

4 files changed

Lines changed: 170 additions & 19 deletions

docs/linux/sql-server-linux-configure-environment-variables.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ You can use several different environment variables to configure SQL Server 2017
4545
| **MSSQL_LOG_DIR** | Change the directory where the new SQL Server database log (.ldf) files are created. |
4646
| **MSSQL_DUMP_DIR** | Change the directory where SQL Server will deposit the memory dumps and other troubleshooting files by default. |
4747
| **MSSQL_ENABLE_HADR** | Enable Availability Groups. |
48+
| **MSSQL_AGENT_ENABLED** | Enable SQL Server Agent. By default, this is disabled. |
49+
| **MSSQL_MASTER_DATA_FILE** | Sets the location of the master database data file. |
50+
| **MSSQL_MASTER_LOG_FILE** | Sets the location of the master database log file. |
51+
4852

4953
## Example: initial setup
5054

docs/linux/sql-server-linux-configure-mssql-conf.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ ms.workload: "On Demand"
2424

2525
|||
2626
|---|---|
27+
| [Agent](#agent) | Enable SQL Server Agent |
2728
| [Collation](#collation) | Set a new collation for SQL Server on Linux. |
2829
| [Customer feedback](#customerfeedback) | Choose whether or not SQL Server sends feedback to Microsoft. |
2930
| [Database Mail Profile](#dbmail) | Set the default database mail profile for SQL Server on Linux |
3031
| [Default data directory](#datadir) | Change the default directory for new SQL Server database data files (.mdf). |
3132
| [Default log directory](#datadir) | Changes the default directory for new SQL Server database log (.ldf) files. |
33+
| [Default master database file directory](#masterdatabasedir) | Changes the default directory for the master database files on existing SQL installation.|
34+
| [Default master database file name](#masterdatabasename) | Changes the name of master database files. |
3235
| [Default dump directory](#dumpdir) | Change the default directory for new memory dumps and other troubleshooting files. |
36+
| [Default error log directory](#errorlogdir) | Changes the default directory for new SQL Server ErrorLog, Default Profiler Trace, System Health Session XE and Hekaton Session XE files. |
3337
| [Default backup directory](#backupdir) | Change the default directory for new backup files. |
3438
| [Dump type](#coredump) | Choose the type of dump memory dump file to collect. |
3539
| [High availability](#hadr) | Enable Availability Groups. |
@@ -51,6 +55,24 @@ ms.workload: "On Demand"
5155

5256
* These examples run mssql-conf by specify the full path: **/opt/mssql/bin/mssql-conf**. If you choose to navigate to that path instead, run mssql-conf in the context of the current directory: **./mssql-conf**.
5357

58+
## <a id="agent"></a> Enable SQL Server Agent
59+
60+
The **sqlagent.enabled** setting enables SQL Server Agent. By default, SQL Server Agent is disabled.
61+
62+
To change these settings, use the following steps:
63+
64+
1. Enable the SQL Server Agent:
65+
66+
```bash
67+
sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true
68+
```
69+
70+
1. Restart the SQL Server service:
71+
72+
```bash
73+
sudo systemctl restart mssql-server
74+
```
75+
5476
## <a id="collation"></a> Change the SQL Server collation
5577

5678
The **set-collation** option changes the collation value to any of the supported collations.
@@ -126,6 +148,83 @@ The **filelocation.defaultdatadir** and **filelocation.defaultlogdir** settings
126148

127149
1. This command also assumes that a /tmp/log directory exists, and that it is under the user and group **mssql**.
128150

151+
152+
## <a id="masterdatabasedir"></a> Change the default master database file directory location
153+
154+
The **filelocation.masterdatafile** and **filelocation.masterlogfile** setting changes the location where the SQL Server engine looks for the master database files. By default, this location is /var/opt/mssql/data.
155+
To change these settings, use the following steps:
156+
157+
1. Create the target directory for new error log files. The following example creates a new **/tmp/masterdatabasedir** directory:
158+
159+
```bash
160+
sudo mkdir /tmp/masterdatabasedir
161+
```
162+
163+
1. Change the owner and group of the directory to the **mssql** user:
164+
165+
```bash
166+
sudo chown mssql /tmp/masterdatabasedir
167+
sudo chgrp mssql /tmp/masterdatabasedir
168+
```
169+
170+
1. Use mssql-conf to change the default master database directory for the master data and log files with the **set** command:
171+
172+
```bash
173+
sudo /opt/mssql/bin/mssql-conf set filelocation.masterdatafile /tmp/masterdatabasedir/master.mdf
174+
sudo /opt/mssql/bin/mssql-conf set filelocation.masterlogfile /tmp/masterdatabasedir/masterlog.ldf
175+
```
176+
177+
1. Stop the SQL Server service:
178+
179+
```bash
180+
sudo systemctl stop mssql-server
181+
```
182+
183+
1. Move the master.mdf and masterlog.ldf
184+
185+
```bash
186+
sudo mv /var/opt/mssql/data/master.mdf /tmp/masterdatabasedir/master.mdf
187+
sudo mv /var/opt/mssql/data/masterlog.ldf /tmp/masterdatabasedir/masterlog.ldf
188+
```
189+
190+
1. Start the SQL Server service:
191+
192+
```bash
193+
sudo systemctl start mssql-server
194+
```
195+
196+
197+
## <a id="masterdatabasename"></a> Change the name of master database files.
198+
199+
The **filelocation.masterdatafile** and **filelocation.masterlogfile** setting changes the location where the SQL Server engine looks for the master database files. By default, this location is /var/opt/mssql/data. To change these settings, use the following steps:
200+
201+
1. Stop the SQL Server service:
202+
203+
```bash
204+
sudo systemctl stop mssql-server
205+
```
206+
207+
1. Use mssql-conf to change the expected master database names for the master data and log files with the **set** command:
208+
209+
```bash
210+
sudo /opt/mssql/bin/mssql-conf set filelocation.masterdatafile /var/opt/mssql/data/masternew.mdf
211+
sudo /opt/mssql/bin/mssql-conf set filelocation.masterlogfile /var/opt/mssql/data /masterlognew.ldf
212+
```
213+
214+
1. Change the name of the master database data and log files
215+
216+
```bash
217+
sudo mv /var/opt/mssql/data/master.mdf /var/opt/mssql/data/masternew.mdf
218+
sudo mv /var/opt/mssql/data/masterlog.ldf /var/opt/mssql/data /masterlognew.ldf
219+
```
220+
221+
1. Start the SQL Server service:
222+
223+
```bash
224+
sudo systemctl start mssql-server
225+
```
226+
227+
129228
## <a id="dumpdir"></a> Change the default dump directory location
130229

131230
The **filelocation.defaultdumpdir** setting changes the default location where the memory and SQL dumps are generated whenever there is a crash. By default, these files are generated in /var/opt/mssql/log.
@@ -157,6 +256,37 @@ To set up this new location, use the following commands:
157256
sudo systemctl restart mssql-server
158257
```
159258

259+
## <a id="errorlogdir"></a> Change the default error log file directory location
260+
261+
The **filelocation.errorlogfile** setting changes the location where the new error log, default profiler trace, system health session XE and Hekaton session XE files are created. By default, this location is /var/opt/mssql/data.
262+
To change these settings, use the following steps:
263+
264+
1. Create the target directory for new error log files. The following example creates a new **/tmp/logs** directory:
265+
266+
```bash
267+
sudo mkdir /tmp/logs
268+
```
269+
270+
1. Change the owner and group of the directory to the **mssql** user:
271+
272+
```bash
273+
sudo chown mssql /tmp/logs
274+
sudo chgrp mssql /tmp/logs
275+
```
276+
277+
1. Use mssql-conf to change the default errorlog directory with the **set** command:
278+
279+
```bash
280+
sudo /opt/mssql/bin/mssql-conf set filelocation.errorlogfile /tmp/logs/errorlog
281+
```
282+
283+
1. Restart the SQL Server service:
284+
285+
```bash
286+
sudo systemctl restart mssql-server
287+
```
288+
289+
160290
## <a id="backupdir"></a> Change the default backup directory location
161291

162292
The **filelocation.defaultbackupdir** setting changes the default location where the backup files are generated. By default, these files are generated in /var/opt/mssql/data.

docs/linux/sql-server-linux-run-sql-server-agent-job.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,22 @@ The following prerequisites are optional:
4242
* Windows machine with SSMS:
4343
* [SQL Server Management Studio](https://docs.microsoft.com/sql/ssms/download-sql-server-management-studio-ssms) for optional SSMS steps.
4444

45-
## Install SQL Server Agent
45+
## Enable SQL Server Agent
4646

47-
To use SQL Server Agent on Linux, you must first install the **mssql-server-agent** package on a machine that already has SQL Server 2017 installed.
47+
To use SQL Server Agent on Linux, you must first enable SQL Server Agent on a machine that already has SQL Server 2017 installed.
4848

49-
1. Install **mssql-server-agent** with the appropriate command for your Linux OS.
50-
51-
| Platform | Installation command(s) |
52-
|-----|-----|
53-
| RHEL | `sudo yum install mssql-server-agent` |
54-
| SLES | `sudo zypper refresh`<br/>`sudo zypper update mssql-server-agent` |
55-
| Ubuntu | `sudo apt-get update`<br/>`sudo apt-get install mssql-server-agent` |
49+
1. To enable SQL Server Agent, follow the step below.
50+
```bash
51+
sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true
52+
```
5653

5754
1. Restart SQL Server with the following command:
55+
```bash
56+
sudo systemctl restart mssql-server
57+
```
5858

59-
```bash
60-
sudo systemctl restart mssql-server
61-
```
59+
> [!NOTE]
60+
> Starting with SQL Server 2017 CU4, SQL Server Agent is included with the **mssql-server** package and is disabled by default. For Agent set up prior to CU4 visit, [Install SQL Server Agent on Linux](sql-server-linux-setup-sql-agent.md).
6261
6362
## Create a sample database
6463

docs/linux/sql-server-linux-setup-sql-agent.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article describes how to install the SQL Server Agent on Linux
44
author: rothja
55
ms.author: jroth
66
manager: craigg
7-
ms.date: 10/02/2017
7+
ms.date: 02/20/2018
88
ms.topic: article
99
ms.prod: "sql-non-specified"
1010
ms.prod_service: "database-engine"
@@ -20,18 +20,36 @@ ms.workload: "On Demand"
2020

2121
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-linuxonly](../includes/appliesto-ss-xxxx-xxxx-xxx-md-linuxonly.md)]
2222

23-
The following steps install SQL Server Agent (**mssql-server-agent**) on Linux. The [SQL Server Agent](https://docs.microsoft.com/sql/ssms/agent/sql-server-agent) runs scheduled SQL Server jobs. For information on the features supported for this release of the SQL Server Agent, see the [Release Notes](sql-server-linux-release-notes.md).
23+
The [SQL Server Agent](https://docs.microsoft.com/sql/ssms/agent/sql-server-agent) runs scheduled SQL Server jobs. Starting with SQL Server 2017 CU4, SQL Server Agent is included with the **mssql-server** package and is disabled by default. For information on the features supported for this release of the SQL Server Agent along with version information, see the [Release Notes](sql-server-linux-release-notes.md).
24+
25+
Install/Enable the SQL Server Agent:
26+
- [For Versions 2017 CU4 and above, Enable the SQL Server Agent](#EnableAgentAfterCU4)
27+
- [For Versions 2017 CU3 and Below, Install the SQL Server Agent](#InstallAgentBelowCU4)
28+
29+
30+
## <a name="EnableAgentAfterCU4">For Versions 2017 CU4 and above, Enable the SQL Server Agent</a>
31+
32+
To enable SQL Server Agent, follow the steps below.
33+
34+
```bash
35+
sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true
36+
sudo systemctl restart mssql-server
37+
```
2438

2539
> [!NOTE]
26-
> Before installing SQL Server Agent, first [install SQL Server 2017](sql-server-linux-setup.md#platforms). This configures the keys and repositories that you use when you install the **mssql-server-agent** package.
40+
> If you are upgrading from 2017 CU3 or below with Agent installed, SQL Server Agent will be enabled automatically and previous Agent packages will be uninstalled.
2741
28-
Install the SQL Server Agent for your platform:
42+
## <a name="InstallAgentBelowCU4">For Versions 2017 CU3 and Below, Install the SQL Server Agent</a>
2943

44+
> [!NOTE]
45+
> The install instructions below apply to SQL Server Versions 2017 CU3 and below. Before installing SQL Server Agent, first [install SQL Server 2017](sql-server-linux-setup.md#platforms). This configures the keys and repositories that you use when you install the **mssql-server-agent** package.
46+
47+
Install the SQL Server Agent for your platform:
3048
- [Red Hat Enterprise Linux](#RHEL)
3149
- [Ubuntu](#ubuntu)
3250
- [SUSE Linux Enterprise Server](#SLES)
3351

34-
## <a name="RHEL">Install on RHEL</a>
52+
### <a name="RHEL">Install on RHEL</a>
3553

3654
Use the following steps to install the **mssql-server-agent** on Red Hat Enterprise Linux.
3755

@@ -50,7 +68,7 @@ sudo systemctl restart mssql-server
5068

5169
If you need an offline installation, locate the SQL Server Agent package download in the [Release notes](sql-server-linux-release-notes.md). Then use the same offline installation steps described in the article [Install SQL Server](sql-server-linux-setup.md#offline).
5270

53-
## <a name="ubuntu">Install on Ubuntu</a>
71+
### <a name="ubuntu">Install on Ubuntu</a>
5472

5573
Use the following steps to install the **mssql-server-agent** on Ubuntu.
5674

@@ -70,7 +88,7 @@ sudo systemctl restart mssql-server
7088

7189
If you need an offline installation, locate the SQL Server Agent package download in the [Release notes](sql-server-linux-release-notes.md). Then use the same offline installation steps described in the article [Install SQL Server](sql-server-linux-setup.md#offline).
7290

73-
## <a name="SLES">Install on SLES</a>
91+
### <a name="SLES">Install on SLES</a>
7492

7593
Use the following steps to install the **mssql-server-agent** on SUSE Linux Enterprise Server.
7694

0 commit comments

Comments
 (0)