-2

I know this is a duplicate one. But i did not find a solution for my requirement in this forum.

Is there a way to identify the list of completed queries that were triggered along with its SQL ID and user details in SQL server for a particular day.

Expected Output:

SQL_ID, Query_Start_Time, Query_End_Time, Query_Executed, User

Madhu
  • 1

1 Answers1

1

You can accomplish this two ways:

  1. Setup an Audit

Auditing an instance of the SQL Server Database Engine or an individual database involves tracking and logging events that occur on the Database Engine. SQL Server audit lets you create server audits, which can contain server audit specifications for server level events, and database audit specifications for database level events. Audited events can be written to the event logs or to audit files.

  1. Create Extended Events

Extended Events is a lightweight performance monitoring system that enables users to collect data needed to monitor and troubleshoot problems in SQL Server. See Extended Events overview to learn more about the extended events architecture... By using Extended Events, you can see details about the inner operations of the SQL system and your application. When you create an Extended Events session, you tell the system:

  • Which occurrences you are interested in.
  • How you want the system to report the data to you.
J.D.
  • 40,776
  • 12
  • 62
  • 141