February 15, 2024 at 6:20 am
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 we want to find the root cause why log got increased and disk space issue occurred we cannot see old date transactions occurred
Thanks
Naga.Rohitkumar
February 15, 2024 at 9:56 am
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.
February 15, 2024 at 3:14 pm
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.
Also, what are your growth settings on the log file? They should NOT be based on percentage.
As a bit of a sidebar, here are some typical "fun" things that can make your log file explode...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 15, 2024 at 3:49 pm
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 growth, days after the fact.
Set up monitoring on your servers.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 20, 2024 at 2:54 pm
If you got full recovery model, make sure the transaction log backups set up properly. This causes the disk space issues, too.
DBASupport
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply