You are on page 1of 3

17/2/24, 22:49 IS there any script to find what transactions ran yesterday or week or mont – SQLServerCentral Forums

Register Login  Menu

Home  Forums  SQL Server 2022  SQL Server 2022 - Administration  IS there
any script to find what transactions ran yesterday or week or mont

Post reply Like (0)

IS there any script to find what


transactions ran yesterday or week or
mont
naga.rohi February 15, 2024 at 6:20 am #4378966

tkumar Is there any script to find what transactions ran yesterday or week
or month before in sqlserver

we are not using any tools and if any issue comes we can see
sp_who2'active' but if log size is full suddenly before 2 days and if
SSCertifiable we want to find the root cause why log got increased and disk
Points: 5553 space issue occurred we cannot see old date transactions
occurred
 More
actions
Thanks
Naga.Rohitkumar

Ant- February 15, 2024 at 9:56 am Like (0) #4379062

Green You would have to dump the log backups using fn_dump_dblog to
see what went on, but it's going to be a huge mess.

Sounds like you need to enable auditing, but that's going to be for
future events, not past.
https://www.sqlservercentral.com/forums/topic/is-there-any-script-to-find-what-transactions-ran-yesterday-or-week-or-mont 1/3
17/2/24, 22:49 IS there any script to find what transactions ran yesterday or week or mont – SQLServerCentral Forums

SSC Guru
Points: 113405

 More
actions

Jeff February 15, 2024 at 3:14 pm Like (0) #4379215

Moden You could/should setup an Extended Event to capture anything


(including code) that makes the log file grow. Of course, you'd
have to shrink the log file to a reasonable size first. A quick
search should reveal some good code for the EE in short order.

SSC Guru Also, what are your growth settings on the log file? They should
Points: 1003726 NOT be based on percentage.

 More As a bit of a sidebar, here are some typical "fun" things that can
actions
make your log file explode...

1. BAD code with accidental many-to-many JOINs due to


insufficient criteria, especially on single queries with many
CTEs and queries with views/nested views and queries with
sub-queries, etc.

2. The use of REORGANIZE in Index Maintenance plans.

3. The use of an illegal form of UPDATE for updates that have


JOINs. This illegal form is when there is a join between the
table being updated and another table but the table being
updated is in the UPDATE clause in the code rather than in the
FROM clause with only an alias in the UPDATE clause.

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-


Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:

https://www.sqlservercentral.com/forums/topic/is-there-any-script-to-find-what-transactions-ran-yesterday-or-week-or-mont 2/3
17/2/24, 22:49 IS there any script to find what transactions ran yesterday or week or mont – SQLServerCentral Forums

________Stop thinking about what you want to do to a ROW... think,


instead, of what you want to do to a COLUMN.
Change is inevitable... Change for the better is not.

Helpful Links:
How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)

Grant February 15, 2024 at 3:49 pm Like (0) #4379244

Fritchey In order to have a history of queries, behaviors, what have you, on


SQL Server, you have to set up monitoring. You either have to
build it out yourself, or you need to pick up a 3rd party tool.
Regardless, no, there really isn't any way, after the fact, with no
monitoring in place, to know what caused something like a log
SSC Guru growth, days after the fact.
Points: 398576

Set up monitoring on your servers.


 More
actions

Viewing 4 posts - 1 through 3 (of 3 total)


You must be logged in to reply to this topic. Login to reply

https://www.sqlservercentral.com/forums/topic/is-there-any-script-to-find-what-transactions-ran-yesterday-or-week-or-mont 3/3

You might also like