Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions docs/administration/configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The **SQLAgent.ini** file is the SQL Agent's configuration file. The agent reads
- Tune logging and trace levels for troubleshooting.
- Point the agent at initialization and termination scripts.

The SQLAgent.ini file lives in the `<Configuration Directory>\SQLAgent\` directory.
The SQLAgent.ini file lives in the `<Configuration Directory>\SQL Agent\` directory.

:::note
The Configuration Directory is set during installation and is based on where you installed your programs. For more information, refer to [File Locations](https://help.smatechnologies.com/opcon/core/rolling/Files/Concepts/File%20Locations.htm) in the **Concepts** online help.
Expand All @@ -40,7 +40,7 @@ If either socket value does not match its OpCon counterpart, jobs cannot start a

To modify the SQLAgent.ini file, complete the following steps:

1. Open File Explorer and go to `<Configuration Directory>\SQLAgent\` for the desired SQL Agent instance.
1. Open File Explorer and go to `<Configuration Directory>\SQL Agent\` for the desired SQL Agent instance.
2. Right-click the **SQLAgent.ini** file and select **Open With**.
3. Select an ASCII text editor (such as Notepad) from the list.
4. Make the necessary modifications. For complete information on each setting, see the tables below.
Expand All @@ -61,12 +61,14 @@ The basic settings for the SQL Agent.

|[General Settings]|Default|Dynamic|Required|Description|
|--- |--- |--- |--- |--- |
|DisplayServiceName|SMA OpCon Agent for SQL|N|Y|The service name displayed in the Service Control Manager. The name must be unique for each SQL Agent. Do not change this unless there is more than one agent on this physical machine.|
|ShortServiceName|SMA_SQLNET|N|Y|The hidden, internal (i.e., registry) service name SQL refers to. The name must be unique for each SQL Agent. Do not change this unless there is more than one agent on this physical machine.|
|DisplayServiceName|SMA SQL Agent (.NET)|N|Y|The service name displayed in the Service Control Manager. The installer registers the Windows service with the display name **SMA OpCon Agent for SQL**, which is the name shown in **Services**. The name must be unique for each SQL Agent. Do not change this unless there is more than one agent on this physical machine.|
|ShortServiceName|SMA_SQLAGENTNET|N|Y|The hidden, internal (i.e., registry) service name SQL refers to. For each additional instance, the installer appends the instance number (for example, `SMA_SQLAGENTNET1`). The name must be unique for each SQL Agent. Do not change this unless there is more than one agent on this physical machine.|
|MaximumNumberOfJobs|50|Y|Y|Defines the maximum number of jobs the agent can simultaneously manage. When setting the MaximumNumberOfJobs, consider the SQL Agent machine's processor speed and memory (RAM) size. No job is processed when this setting is 0. Although the maximum value allowed is 500, typical customer usage ranges from 10 to 30 jobs.|
|InitializationScript|Blank|N|N|The full path to the initialization script. The initialization script runs when the SQL Agent service starts. SMA Technologies recommends using this script to map network drives or to perform any other required initialization procedure. Enclose the path in double quotes ("*path*").|
|TerminationScript|Blank|N|N|The full path to the termination script. The termination script runs when the SQL Agent service stops. SMA Technologies recommends using this script to disconnect network drives or to perform any other required termination procedure. Enclose the path in double quotes ("*path*").|

The shipped SQLAgent.ini also contains a **HungScript** setting in this section. How the agent uses it is not documented here.

### TCP/IP parameters

The network settings for the SQL Agent.
Expand All @@ -78,10 +80,11 @@ Enter all alphabetic TCP/IP parameter values in uppercase. The SQL Agent service
|[TCP/IP Parameters]|Default|Dynamic|Required|Description|
|--- |--- |--- |--- |--- |
|SocketNumberToSAM|21100|N|Y|Defines the socket number through which the agent and the SMANetCom communicate. This number must match the machine's socket number defined in Solution Manager or Enterprise Manager. If there are multiple agents installed on one machine, each agent must have a unique value. For an up-to-date list of unused ports, please refer to the Internet Assigned Numbers Authority at www.iana.org.|
|AllowedIPAddress_1|ANY|Y|N|Determines if communication from the SMANetCom to the agent is restricted to one or more TCP/IP addresses. If ANY is specified, the agent accepts communication from any TCP/IP address. If a specific TCP/IP address is defined (e.g., 126.40.90.231), the agent only accepts communication from the specified address. The agent refuses a connection if communication is attempted from another address. This definition enhances communication security by refusing communications from other TCP/IP addresses. If multiple SAMs are on a network, this address ensures the agent is only accepting messages from the intended SMANetCom. This parameter is case-sensitive.|
|AllowedIPAddress_1|ANY|Y|N|Determines if communication from the SMANetCom to the agent is restricted to one or more TCP/IP addresses. If ANY is specified, the agent accepts communication from any TCP/IP address. If a specific TCP/IP address is defined (for example, 192.0.2.10), the agent only accepts communication from the specified address. The agent refuses a connection if communication is attempted from another address. This definition enhances communication security by refusing communications from other TCP/IP addresses. If multiple SAMs are on a network, this address ensures the agent is only accepting messages from the intended SMANetCom. This parameter is case-sensitive.|
|AllowedIPAddress_2|Blank|Y|N|Same as Address_1 explanation.|
|AllowedIPAddress_3|Blank|Y|N|Same as Address_1 explanation.|
|AllowedIPAddress_4|Blank|Y|N|Same as Address_1 explanation.|
|AllowedIPAddress_5|Blank|Y|N|Same as Address_1 explanation.|

### Debug options

Expand All @@ -103,12 +106,12 @@ Settings for configuring JORS for job output retrieval.
|JORSSocket|21110|N|Y|Defines the socket number through which the JORS Service communicates. This number must match the JORS Port Number defined in Solution Manager or Enterprise Manager under **Advanced Machine Settings** > **Communication Settings**. If there are multiple SQL Agents installed on one machine, each agent's JORS Service must have a unique port. For an up-to-date list of unused ports, please refer to the Internet Assigned Numbers Authority at www.iana.org.|
|MaxJorsFileSize|65536|N|N|The maximum size of a Job Output file retrieved for viewing in OpCon. If the output file is larger than the MaxJorsFileSize, it is truncated when viewed. The minimum and default value is 65536 bytes (64 KB) and the maximum value is 52428800 bytes (50 MB). If an invalid value is specified, the file defaults to 65536.|
|LogComposition|MIX|N|N|LogComposition only applies when a job output file larger than the MaxJorsFileSize is being viewed. **START** presents MaxJorsFileSize bytes from the start of the file. **END** presents MaxJorsFileSize bytes from the end of the file. **MIX** presents half of MaxJorsFileSize bytes from the start of the file and half from the end.|
|UseSmoApi|True|N|N|Determines how the agent retrieves output for MS SQL Server Agent jobs. When set to **True** (default), the agent uses the SMO (SQL Server Management Objects) API. When set to **False**, the agent uses a direct T-SQL call to the `sp_help_jobhistory` stored procedure instead. Set to **False** if SMO API performance is slow or unavailable in your environment.|
|UseSmoApi|True|Y|N|Not in the shipped file; add it to the JORS Settings section to change it. Determines how the agent retrieves output for MS SQL Server Agent jobs. When set to **True** (default), the agent uses the SMO (SQL Server Management Objects) API. When set to **False**, the agent uses a direct T-SQL call to the `sp_help_jobhistory` stored procedure instead. Set to **False** if SMO API performance is slow or unavailable in your environment.|

## FAQs

**Where is the SQLAgent.ini file stored?**
The SQLAgent.ini file is stored in the `<Configuration Directory>\SQLAgent\` directory. The Configuration Directory is set based on where you installed your programs.
The SQLAgent.ini file is stored in the `<Configuration Directory>\SQL Agent\` directory. The Configuration Directory is set based on where you installed your programs.

**Why won't my SQL Agent service start after editing SQLAgent.ini?**
Check that all alphabetic TCP/IP parameter values are entered in uppercase. The SQL Agent service does not start if these values are in lowercase.
Expand Down
2 changes: 1 addition & 1 deletion docs/administration/manage-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Start the agent after a stop, after a reboot if the service did not auto-start,
To start the SQL Agent, complete the following steps:

1. Go to **Start** > **Control Panel** > **Administrative Tools** > **Services**.
2. Select **SMA OpCon Agent for SQL** in the **Services** list. The **SMA OpCon Agent for SQL Properties** dialog displays.
2. Select **SMA OpCon Agent for SQL** in the **Services** list. The **SMA OpCon Agent for SQL Properties** window displays.
3. Confirm that the **Startup Type** is set to **Automatic (Delayed Start)**. If it is not, complete the following steps:
1. Select **Automatic (Delayed Start)** from the **Startup Type** list.
2. Select **OK**.
Expand Down
12 changes: 6 additions & 6 deletions docs/administration/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ net send machine/username "Agent Stopped"

## Job environment variables

When the SQL Agent starts a cmd-based job (MS SQL Script, MySQL, Oracle, ODBC, OLE DB), it sets the following environment variables in the job's process environment. Scripts invoked as the job body (`.sql` or `.bat` files run by the agent) can read these variables.
When the SQL Agent starts a job that runs a command-line client (MS SQL Script, MS SQL DTExec, MySQL, Oracle), it sets the following environment variables in the job's process environment. MS SQL Job and Other DB (ODBC and OLE DB) jobs run inside the agent and do not receive them. Scripts invoked as the job body (`.sql` or `.bat` files run by the agent) can read these variables.

:::caution Not available in InitializationScript or TerminationScript
These variables are set per-job at the time a job process starts. InitializationScript and TerminationScript run at service start/stop — no job is running at that point, so none of these variables are available in those scripts.
:::

The agent sets two parallel groups of variables: one for the impersonated (batch) user context and one for the system account context.
The agent sets one of two groups of variables, depending on the account the job runs as: the `SMA_` group when the job runs as its Windows User ID, or the `SMA_MSLSAM_` group when it runs as the SQL Agent service account. A script that must work in both cases should check for both names.

### Impersonated user context
### Job runs as its Windows User ID

These variables are available in the impersonated user's process environment.
The agent sets these variables when the job definition has a **Windows User ID**.

| Variable | Description |
|---|---|
Expand All @@ -88,9 +88,9 @@ These variables are available in the impersonated user's process environment.
| `SMA_SCHEDULE_FREQ` | The schedule frequency name for the job. |
| `SMA_JOBOUTPUT_FILENAME` | The full path to the job output file for the current run. |

### System account context
### Job runs as the service account

These variables are set in the system account's process environment. They carry the same values as the impersonated user context variables.
The agent sets these variables instead when the job has no **Windows User ID**, or when it begins with `USE SERVICE ACCOUNT`. They carry the same information as the `SMA_` group.

| Variable | Description |
|---|---|
Expand Down
8 changes: 4 additions & 4 deletions docs/administration/service-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The SQL Agent service can run under two different account types, and the choice

In Local System mode, select a Windows User account from your network for the Windows User ID in the job definition in Solution Manager.

For information on configuring mapped network drives in the SQLAgent.ini file, see [Using the InitializationScript and TerminationScript](scripts). For information on adding a batch user for SQL, refer to [Adding a Batch User for SQL](https://help.smatechnologies.com/opcon/core/rolling/Files/UI/Enterprise-Manager/Adding%20Batch%20Users.htm#Adding2) in the **OpCon** online help.
For information on configuring mapped network drives in the SQLAgent.ini file, see [Using the InitializationScript and TerminationScript](scripts.md). For information on adding a batch user for SQL, refer to [Adding a Batch User for SQL](https://help.smatechnologies.com/opcon/core/rolling/Files/UI/Enterprise-Manager/Adding%20Batch%20Users.htm#Adding2) in the **OpCon** online help.

## Run the SQL Agent as the Local System Account

Expand All @@ -36,7 +36,7 @@ The Local System Account must have the following advanced Windows privileges:
To configure the SQL Agent to run as a Local System Account, complete the following steps:

1. Go to **Start** > **Control Panel** > **Administrative Tools** > **Services**.
2. Select the SQL Agent service from the **Services** list. The **Properties** dialog displays.
2. Select the SQL Agent service from the **Services** list. The **Properties** window displays.
3. If not selected already, select **Automatic (Delayed Start)** from the **Startup Type** list.
4. Select the **Log On** tab.
5. Select the **Local System account** option.
Expand Down Expand Up @@ -72,7 +72,7 @@ To add the required advanced Windows privileges, complete the following steps:
1. Go to **Start** > **Control Panel** > **Administrative Tools** > **Local Security Policy**.
2. Under **Security Settings**, select **Local Policies** > **User Rights Assignment**.
3. For each privilege in the list above, select the privilege and select **Add User Or Group**.
4. In the **Select Users Or Groups** dialog, select **Locations** and choose the machine or domain depending on whether you are adding a local user or a domain user.
4. In the **Select Users Or Groups** window, select **Locations** and choose the machine or domain depending on whether you are adding a local user or a domain user.
5. In the object name field, enter the name of the user. To add the Local System Account, choose the current machine and enter `SYSTEM`.
6. Repeat steps 3 through 5 for each privilege.

Expand All @@ -81,7 +81,7 @@ To add the required advanced Windows privileges, complete the following steps:
To configure the SQL Agent to run as a Domain User, complete the following steps:

1. Go to **Start** > **Control Panel** > **Administrative Tools** > **Services**.
2. Select the SQL Agent service from the **Services** list. The **Properties** dialog displays.
2. Select the SQL Agent service from the **Services** list. The **Properties** window displays.
3. If not selected already, select **Automatic (Delayed Start)** from the **Startup Type** list.
4. Select the **Log On** tab.
5. Select the **This account** option.
Expand Down
17 changes: 6 additions & 11 deletions docs/advanced-features/jors.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tags:

## What is it?

The **Job Output Retrieval System (JORS)** is a Windows service that captures the output (stdout/stderr plus job metadata) generated by each job that runs through the SQL Agent. JORS gives operators a way to see what a job actually produced — useful for:
The **Job Output Retrieval System (JORS)** captures the output (standard output and error output, plus job metadata) generated by each job that runs through the SQL Agent. JORS is part of the SQL Agent service; the installer does not create a separate JORS service. JORS gives operators a way to see what a job actually produced — useful for:

- Diagnosing job failures and runtime errors.
- Confirming that a job did the work it was supposed to do.
Expand All @@ -25,8 +25,7 @@ JORS communicates with OpCon over a port configured in SQLAgent.ini. The configu
For each job, JORS captures:

- **Internal Job Name**
- **STDOUT** generated by the job
- **STDERR** generated by the job
- **STDOUT** and **STDERR** generated by the job, written to the same file
- **Job Start/End Time**
- **Job Process Name and PID**
- **Job ExitCode**
Expand All @@ -35,10 +34,9 @@ For each job, JORS captures:

The agent creates one log file per job containing all of the captured information.

| Phase | Location |
| Location | Notes |
|---|---|
| While the job is running | `<Output Directory>\SQLAgent\JobOutput\` |
| After the job completes | `<Output Directory>\SQLAgent\JobOutput\Archives\<Job schedule Date>\` |
| `<Output Directory>\SQL Agent\JobOutput\Archives\<date>\` | `<date>` is the date the job started, in the form `yyyy_MM_dd (Weekday)`. The agent writes the file there while the job runs. |

:::note
The Output Directory was set during installation. For more information, refer to [File Locations](https://help.smatechnologies.com/opcon/core/rolling/Files/Concepts/File%20Locations.htm) in the **Concepts** online help.
Expand All @@ -48,11 +46,8 @@ The SQL Agent cleans up archived JobOutput folders based on the **ArchiveDaysToK

## FAQs

**Where are job output files stored while a job is running?**
While the job is running, the output is stored in the JobOutput folder.

**Where are job output files moved after a job completes?**
Once the job completes, the output is saved under `<Output Directory>\SQLAgent\JobOutput\Archives\<Job schedule Date>`.
**Where are job output files stored?**
The agent writes each job's output file under `<Output Directory>\SQL Agent\JobOutput\Archives\`, in a folder named for the date the job started, in the form `yyyy_MM_dd (Weekday)`.

**How long are archived job outputs kept?**
The SQL Agent removes archived JobOutput folders based on the ArchiveDaysToKeep setting under Debug Options. Logs older than ArchiveDaysToKeep are cleaned up at midnight.
Expand Down
Loading
Loading