Published on

September 25, 2019

SQL Server Audit: Common Questions and Best Practices

As a SQL Server database administrator, it is crucial to have a solid understanding of SQL Server Audit. In this article, we will explore some common questions related to SQL Server Audit and discuss best practices for implementing and managing it effectively.

1. What is the SQL Server Audit process?

The SQL Server Audit process involves tracking and logging the actions performed on the SQL Server instance to achieve the main audit goals of securing company data. It helps in monitoring and identifying any unauthorized activities or potential security threats.

2. What are some common and critical events that should be audited?

Some common and critical events that should be audited include failed logins, login changes, user changes, schema changes, and audit changes. By auditing these events, you can detect any suspicious activities and take appropriate actions to mitigate potential risks.

3. Why is it important to audit failed logins?

Auditing failed logins is crucial because it can indicate a potential attack on your SQL Server instance. Monitoring and analyzing the number of failed logins can help you identify any unauthorized attempts to access your database and take necessary measures to enhance security.

4. Why is it important to audit login changes?

Auditing login changes is essential as any unauthorized modification to logins can serve as a backdoor entry for hackers. By tracking login changes, you can detect any suspicious alterations and prevent unauthorized access to your SQL Server instance.

5. Why is it important to audit user changes?

Auditing user changes is crucial as any unauthorized modification to user permissions can be an alarm for a potential attack on your SQL Server instance. By monitoring user changes, you can ensure the integrity of user permissions and protect your database from unauthorized activities.

6. Why is it important to audit schema changes?

Auditing schema changes is recommended to catch any illegal modifications to the database schema. By tracking schema changes, you can identify any unauthorized alterations and maintain the integrity of your database structure.

7. What are the limitations of the C2 audit and why is it not recommended?

The C2 Auditing feature has two limitations. Firstly, it audits all actions at the SQL Server instance and database levels without the option to configure specific events. Secondly, it automatically saves audit files into the default DATA folder, which can lead to disk space issues. Due to these limitations, it is not recommended as a long-term auditing solution.

8. Can we use SQL Profiler to audit SQL Server instances?

While SQL Profiler can be used to audit SQL Server instances, it is not a recommended long-term solution. Proper event selection and filtering can minimize the size of generated trace files, but since SQL Profiler is deprecated by Microsoft, it is advisable to explore alternative auditing solutions.

9. Why is SQL Server Extended Events not recommended as a SQL Server audit solution?

Although SQL Server Extended Events is a lightweight, highly scalable, and configurable events framework, it has limitations when it comes to auditing different types of database DML changes. Additionally, it lacks the option to compare values before and after the modification process, making it less suitable for comprehensive auditing.

10. How can SQL Server triggers be used for auditing database changes?

SQL Server triggers can be customized to build a SQL Server auditing solution tailored to your company’s requirements. By creating triggers on critical data tables, you can track and log modified or inserted data, compare values before and after modifications, and even prevent changes on specific tables.

11. Is Change Data Capture (CDC) recommended for auditing database changes?

CDC is not recommended as a comprehensive SQL Server audit solution. It does not track SELECT statements, requires significant maintenance and administration effort, and does not handle DDL changes on CDC-enabled tables automatically. Additionally, creating auditing reports that consolidate DML changes from multiple databases can be challenging.

12. Is Change Tracking recommended for auditing database changes?

Change Tracking (CT) is not recommended as a SQL Server audit solution. It does not record information about inserted or deleted data, lacks the option to compare data before and after modifications, and requires additional coding effort to retrieve useful information by joining internal tables with the tracked source table.

13. What makes the SQL Audit built-in feature light and easy to use?

The SQL Audit built-in feature is built using the Extended Events feature, making it lightweight and easy to use. It provides flexibility in defining the audit storage mechanism, synchronization mode, audit file rollover mechanism, and actions to be performed in case of audit failure.

14. What are the main components of the SQL Server Audit feature?

The SQL Server Audit feature consists of three main components: SQL Server Audit, SQL Server Audit Specifications, and SQL Database Audit Specifications. SQL Server Audit allows you to define the audit storage path, synchronization mode, file rollover mechanism, and actions in case of audit failure. SQL Server Audit Specifications track and log changes at the instance level, while SQL Database Audit Specifications track and log changes at the database level.

15. Will the SQL Server Audit feature work when the database is detached and attached to a new instance?

No, the SQL Server Audit feature will not work when the database is detached from the current instance and attached to a new instance. The Audit Specification is connected to a specific SQL Server Audit, and if the new instance does not support the SQL Server Audit feature or has a different SQL Server Audit with a different GUID, the Audit Specification will not function properly. To resolve this issue, you need to connect the Audit Specification to an existing SQL Server Audit or create a new one and associate the Database Audit Specification with it.

16. What should be considered when configuring SQL Server Audit on a database participating in SQL Mirroring or Always On Availability Group?

When configuring SQL Server Audit on a database participating in SQL Mirroring or Always On Availability Group, it is important to create the same SQL Server Audit with the same GUID on the mirrored or secondary replicas. Additionally, granting permission to the SQL Server service account on the folder where audit logs will be stored is necessary to ensure the Audit Specification functions correctly during failover scenarios.

17. Is the System-versioned Temporal Table feature recommended for SQL Server auditing?

The System-versioned Temporal Table feature is not recommended as a SQL Server audit solution. It does not record information about the type of changes performed, and both the source data and historical data are stored in the same database, making it less secure. Furthermore, it does not provide options to audit DDL or server-level changes.

18. Why is it important to define the SQL auditing scope and narrow it down?

Defining the scope of the SQL audit project is crucial as it helps specify what needs to be audited, who should be audited, and for how long. This decision-making process is essential for effective auditing and prevents excessive consumption of SQL Server resources, which can lead to performance degradation. Narrowing down the amount of collected data also makes it easier to review and analyze the audit logs.

19. Why is it important to audit your auditing system?

Auditing the changes performed on the SQL Server audit solution itself helps in detecting any unauthorized attempts to disable the auditing process. By ensuring that all actions are audited, you can maintain the integrity of your audit logs and meet auditor requirements. Additionally, auditing your auditing system serves as a reminder to re-enable the audit in case it was temporarily disabled for maintenance purposes.

20. What aspects should drive the decision in choosing the best SQL Server audit 3rd party tool?

When selecting a 3rd party tool for SQL Server audit, consider factors such as installation process and requirements, supported SQL Server versions, user interface and GUI experience, available configuration options, audited actions at the server and database levels, options for storing and archiving logs, log integrity checks, tool and critical action alerts, and availability of auditing reports. Evaluating these aspects will help you choose the most suitable tool for your specific auditing needs.

By understanding these common questions and best practices related to SQL Server Audit, you can enhance the security and integrity of your SQL Server instances and databases. Implementing effective auditing measures is crucial for protecting sensitive data and ensuring compliance with regulatory requirements.

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.