SQL Server DB, histroy of SQL run information with username, SQLID,SQL text

Ashwan 521 Reputation points
2022-05-24T00:35:06.277+00:00

Hi we have production performance issue and looking to find out SQL run history information (already completed ) with username who run,time, SQLID ,SQLtext etc thorough SQL Script
SQL Version: 2016Sp3

any one knows with that information please share here.

many thanks

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,678 questions
{count} votes

2 answers

Sort by: Most helpful
  1. CathyJi-MSFT 21,086 Reputation points Microsoft Vendor
    2022-05-24T03:18:38.343+00:00

    Hi @Ashwan ,

    >we have production performance issue

    Could you please describe your performance issue more clearly? CPU or I/O bottlenecks, slow query, etc?

    > SQL run history information

    You can get this information from SQL server log file. Or you can using SQL server profiler to trace this.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


  2. Olaf Helper 40,736 Reputation points
    2022-05-24T04:58:29.687+00:00

    looking to find out SQL run history information

    By default SQL Server don't log such information.
    But with SQL Server version 2016 onward you can use the Query Store feature to log it.
    See Monitor performance by using the Query Store