---
title: "SQL Server"
description: "Configure SQL Server data source settings in Auditor: logon monitoring, user filters, data change rules, and auditing of successful SELECT statements."
sidebar_position: 170
---

# SQL Server

**NOTE:** Before configuring your monitoring plan, read the
[SQL Server](/docs/auditor/10.9/configuration/sqlserver/overview.md) configuration topic and
complete its instructions. It
describes the required data collecting account and ports, what Auditor configures on SQL Server
automatically, and which object types and attributes Auditor monitors.

To configure SQL Server data source settings, use the following property tabs:

- General settings
- Users
- Data
- Audit SELECT

When finished, review your data source settings and click **Add** to go back to your plan. The newly
created data source will appear in the Data source list.

As a next step, click Add item to specify an object for monitoring. See the
[Add Item to the SQL Server](/docs/auditor/10.9/configuration/monitoring-plans/sqlserver/items.md) topic for additional information.

## General settings

On the **General** tab, you can configure the following settings for SQL Server data source:

| Option                                                 | Description                                                                                                                                                       |
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Monitor this data source and collect activity data** | Enable monitoring of the selected data source and configure Auditor to collect and store audit data.                                                              |
| **Monitor SQL Server configuration changes**           | Always enabled, as Auditor always monitors SQL Server configuration changes.                                                                                      |
| **Monitor SQL Server logon activity**                  | Specify what types of logon events you want to monitor, performed through Windows and SQL authentication:<br/>- **Failed logons**<br/>- **Successful logons** |
| **Collect data for state-in-time reports**             | Store the snapshots of your SQL Server instance configuration for state-in-time reports. See [Collect data for state-in-time reports](#collect-data-for-state-in-time-reports). |

### Collect data for state-in-time reports

Configure Netwrix Auditor to store the snapshots of your SQL Server instance configuration — you
will require them for state-in-time reports generation. See
[State–In–Time Reports](/docs/auditor/10.9/admin/reports/types/stateintime/overview.md) for more
information.

**CAUTION:** The State-in-Time functionality isn't available for SQL Server Availability Groups.

The product updates the latest snapshot on the regular basis to keep users up-to-date on actual
system state. Only the latest snapshot is available for reporting in Netwrix Auditor. If you want
to generate reports based on different snapshots, you must import snapshots to the Audit Database.
To import snapshots, you need the Global administrator or the Global reviewer role in
Netwrix Auditor.

1. In the **Manage historical snapshots** section, click **Manage** and select the snapshots that
   you want to import.
2. Move the selected snapshots to the **Snapshots available for reporting** list using the arrow
   button.
3. When finished, click **OK**.

See also [Using historical data](/docs/auditor/10.9/configuration/monitoring-plans/overview.md#using-historical-data).

## Users

On the **Users** tab, you can configure the following settings for SQL Server data source:

![data_source_sql_users_thumb_0_0](/images/auditor/10.9/admin/monitoringplans/sqlserver/data_source_sql_users_thumb_0_0.webp)

In **Specify users to track their activity**, select the option you need to fine-tune your SQL
Server monitoring scope:

- **Monitor all users**
- **Include only users matching these criteria**
- **Exclude users matching these criteria**

For example, you may need to track only actions performed by administrative accounts, or exclude
the activity initiated by ordinary applications. If so, use these filters so that Auditor filters
the data before it appears in search results, reports, and Activity Summaries.

You can create either inclusion or exclusion lists. Auditor applies all filters using AND logic. To
create a filter for user activity monitoring, select the related option and click the button on the
right. Specify the following:

- **User** — Enter the initiator's account as it appears in the "_Who_" column of reports and
  Activity Summaries, for example: _mydomain\user1_. For events containing "_System_" in the
  "_Who_" column, you can enter "_System_".
- **Workstation where activity was initiated** — Enter the workstation name as it's shown in the
  "_Workstation_" column of reports and Activity Summaries, for example: _StationWin2016_.
- **Application that initiated the activity** — Enter the application name as shown next to
  "_Application name_" in details of reports and Activity Summaries.

You can use a wildcard (\*) to replace any number of characters in filters.

In addition to the restrictions for a monitoring plan, you can use the \*.txt files to collect more
granular audit data. The new monitoring scope restrictions apply together with previous exclusion
settings configured in the \*.txt files. See the
[Monitoring Plans](/docs/auditor/10.9/configuration/monitoring-plans/overview.md) topic for additional
information.

## Data

On the **Data** tab, you can configure the following settings for SQL Server data source.

:::note
When auditing SQL Server availability groups, the only supported data collection mode is
**Don't use triggers**.
:::

### Monitor changes to data in the database tables

Enable monitoring of changes to data stored in the database tables hosted on the SQL Server.

If you plan to enable this option, ensure the account that runs the _SQL Server service_ on the
monitored instance has at least _read_ permissions in the Active Directory domain (for example, it
doesn't run under a local user account). Otherwise, enabling this option may lead to issues when
altering databases on the monitored SQL Server instances.

### Data collection mode

- **Don't use triggers** — Default mode for a new installation of Netwrix Auditor. Data will be
  collected using the SQL Server traces. This mode gives you a sufficient level of detail in the
  reports and search results without producing additional load on your SQL Server instance.
  Netwrix recommends this mode for highly-transactional servers.
- **Use triggers for detailed monitoring** — Select this mode if you require very detailed
  reporting on the data changes. Auditor also selects this mode by default if you are upgrading your
  Netwrix Auditor deployment. In this mode, Auditor collects data using a set of triggers. For more information
  on this technology, see [https://kb.netwrix.com/728](https://kb.netwrix.com/728).

  To get the before and after values for updated rows, the audited tables need a primary key or a
  unique constraint. See [Before and after values for data changes](/docs/auditor/10.9/configuration/sqlserver/overview.md#before-and-after-values-for-data-changes).

  Use this setting carefully, since collecting a large amount of details from a
  highly-transactional server may affect its performance. Using this mode may lead to issues when
  altering databases on the monitored SQL Server instances. The issues occur only if the SQL Server
  service account doesn't have _Read_ permissions in the Active Directory domain (for example, a
  local user account).

  Switching from the configured triggerless mode may lead to a data loss. The workaround is to
  force data collection right after enabling the triggers.

In both modes, consider that the "_What_" field of the Activity Record with "_Object type_" =
"_Data_" may show incorrect data. The issues occur because the product applies data categories to
an entire SQL Server table and not to rows.

### Changes (per transaction) to collect and report

Specify how many changes per a database transaction you want to be collected. For example, you can
limit this number to 10 changes per transaction, or collect all changes. It's recommended to adjust
this setting carefully, as collecting large number of changes from a highly-transactional server
may affect its performance.

### Monitoring rules

To specify which data changes Auditor monitors, create at least one **inclusion rule**. Exclusion
rules are optional. Click **Add Rule** and configure the following:

![data_source_sql_data_rule_thumb_0_0](/images/auditor/10.9/admin/monitoringplans/sqlserver/data_source_sql_data_rule_thumb_0_0.webp)

- **Type** — Select rule type: include or exclude.
- **Server** — Specify a name of the monitored SQL Server instance where the required database
  resides. Use the _server_name\instance_name_ format, for example, _SQLsrv11\SQLExpress2016_.

  **NOTE:** If you are going to configure monitoring rules for SQL Server Availability Groups,
  provide the name of your Availability Group item in this field.

- **Database** — Specify the database whose data changes you want to monitor.
- **Table** — Specify database table to monitor.
- **Column** — Specify table column name. For supported column types, see
  [Monitored data types](/docs/auditor/10.9/configuration/sqlserver/overview.md#monitored-data-types).

Auditor applies these filters using AND logic. You can use a wildcard (\*) to replace any number
of characters.

## Audit SELECT

Use the settings in this section to configure how the successful SELECT statements should be
audited.

![data_source_sql_audit_select_thumb_0_0](/images/auditor/10.9/admin/monitoringplans/sqlserver/data_source_sql_audit_select_thumb_0_0.webp)

### Audit successful SELECT statements

Enable monitoring of successful SELECT statements for the database tables. Successful SELECT
statement execution will be reported as Read operation on the database table. Auditing SELECT
statements will increase the amount of data collected from the SQL Server instance and stored to
long-term archive and audit database. Plan for your resources accordingly.

### Monitoring rules

To specify what SELECT statements will be monitored, you must create at least one **inclusion
rule**. Exclusion rules are optional. Click **Add Inclusion** and specify the following:

![data_source_sql_audit_select_rule_thumb_0_0](/images/auditor/10.9/admin/monitoringplans/sqlserver/data_source_sql_audit_select_rule_thumb_0_0.webp)

- **Server** — Specify target SQL Server instance in the server\instance format.

  **NOTE:** If you are going to configure monitoring rules for SQL Server Availability Groups,
  provide the name of your Availability Group item in this field.

- **Database** — Specify target database.
- **Schema** — Specify database schema.
- **Table** — Specify database table you will monitor.

Wildcard (\*) is supported and replaces any number of characters. Filters will be applied using AND
logic, that is, only SELECT statements matching all specified criteria will be monitored. For
example, with the rule shown in the **Add Inclusion** screenshot, the program will track and report
only the successful SELECT statements executed against the _Applicants_ table of the _HR2019_
database with _Custom_ schema, hosted on the _SQLsrv02\TestInstance_.

When finished, click **Add**. If needed, configure the exclusion rules in a similar way.
