question

Ashwan1234 avatar image
0 Votes"
Ashwan1234 asked Ashwan1234 commented

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

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-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Ashwan1234,

Any update for this thread? Did the reply could help you? If the response helped, do "Accept Answer". If it is not, please let us know.

0 Votes 0 ·
Cathyji-msft avatar image
0 Votes"
Cathyji-msft answered Ashwan1234 commented

Hi @Ashwan1234,

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".

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Cath, I understand we can get information from SQL profiler. That take time to go through all one by one. and cant save to excel to have filters to find out more specific information .
QUERY STORE: does not have information related user who is running ?
thank you


0 Votes 0 ·

You can use third part tool ApexSQL Log to read SQL server transaction log file, then you can get the information that you need.


205339-screenshot-2022-05-25-175756.jpg


0 Votes 0 ·

Hi Cath , Is that free or chargeable ?

0 Votes 0 ·
Show more comments
OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered Ashwan1234 commented

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][1]

[1]: https://docs.microsoft.com/en-us/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store?view=sql-server-ver16
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

hi Ola yes its already enabled QUERY STORE. however does not have information related user who is running though?

thank you

0 Votes 0 ·