How much transaction log, transactions generate?
Hi Everyone,
I wanted to share something that I am doing this week at work. One of the applications that I support is generating a lot of transaction log in the database. Just to have an idea, we run Transaction Log backups every 30 minutes and I have backups over 100GB and sometimes 200GB. The difficult part of investigating what is generating that amount of log is because the databases involved are used by at least 3 different applications and streams. So, I remember that in the past I created a simple script that looks at this information in the database and then I may have more inputs of what is really generating that amount of log.
As posting the T-SQL in this blog would be look good, I have uploaded the script to my OneDrive and here it is the link for the download. Also, below you can see some screenshots of the script working.
https://1drv.ms/t/s!An8tB8x6Z4aMgYQLs67EWxpFXMdQXg
and here the output it generates (you may need to click in the images to see it bigger).
Basically, I save this information in a table where later I can run some other scripts to analyse the behavior and also for how long transactions run.
I hope you enjoy this tip.
Regards,
Marcos Freccia
Data Platform MVP
_______________________________________________________________________________________
Olá pessoal,
Gostaria de compartilhar um pequeno script que tive que utilizar essa semana no trabalho. Basicamente precisava coletar por uma semana a quantidade de transaction log que estava sendo gerado. Para terem uma ideia, rodamos backup do transaction log para esse sistema a cada 30 minutos e em alguns momentos do dia tinhamos backups com 100 ou até mesmo 200GB. Como esse banco de dados era alimentado e acessado por pelo menos três sistemas diferentes, podem imaginar o quão difícil seria coletar essa informação. No passado criei um script para fazer algo similar e depois de alguns ajustes eu compartilho com vocês essa versão logo abaixo.
Como o script é um pouco grande, decidi por compartilhar em meu OneDrive, então segue o link abaixo para download.
https://1drv.ms/t/s!An8tB8x6Z4aMgYQLs67EWxpFXMdQXg
E aqui o output que o script gera para analisarmos (será melhor clicar na imagem para ver em um tamanho apropriado).
No meu caso, estou salvando o resultado em uma tabela para posteriormente analisar o comportamento das transações e até mesmo validar a quantidade de tempo que estao rodando e qual o tamanho de transaction log gerado no fim.
Espero que vocês gostem dessa dica.
Abraços,
Marcos Freccia
Data Platform MVP
Posted on May 18, 2017, in Administração, Dicas, SQL Server, T-SQL, VirtualPass and tagged beratung sql server, berlin, germany, how much transaction log my transactions generate, sql server berlin, sql server consulting, sys.dm_tran_active_transactions, sys.dm_tran_database_transactions, sys.dm_tran_session_transactions. Bookmark the permalink. 3 Comments.
Olá Freccia tudo bom? Muito bom o post e a iniciativa de fazê-lo bilíngue.
Obrigado Ariel, muito bom que gostou!
Acho que será interessante o fato de tentar manter o blog bilíngue!
Pingback: The most read posts of May – 2017 | Freccia's Blog