O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

1

Compartilhar

Baixar para ler offline

Understanding and controlling transaction logs

Baixar para ler offline

SQL In The City - Understanding and Controlling Transaction Logs by Nigel Peter Sammy.
- Relational DBMS Basics
- Introduction to Transaction Logs
- The Architecture
- Recovery Models
- Managing the Transaction Logs
- Red Gate Tools

Understanding and controlling transaction logs

  1. 1. #sqlinthecity Understanding and Controlling Transaction Logs Nigel Peter Sammy
  2. 2. http://www.nigelpsammy.com
  3. 3. #sqlinthecity Managing Expectations • This is a 100-300 level session. • This session does not cover Tempdb Transaction Log.
  4. 4. #sqlinthecity Agenda – Relational DBMS Basics – Introduction to Transaction Logs – The Architecture – Recovery Models – Managing the Transaction Logs – Red Gate Tools
  5. 5. RELATIONAL DBMS BASICS
  6. 6. #sqlinthecity Transaction Transaction is an action or series of actions carried out by a single user or application that reads and/or updates the contents of a database.
  7. 7. #sqlinthecity Properties of a Transaction Atomicity Either all the operations constituting transaction are performed or non them Consistency Guarantees that the database evolves from one consistent state to another. Isolation Concurrent transactions behave as though each were the only transaction running in the system Durability Committed transactions are guaranteed to be physically performed
  8. 8. INTRODUCTION TO TRANSACTION LOGS
  9. 9. #sqlinthecity The Transaction Log The transaction log is a serial record of all the transactions and the modifications that occurred in a database. Each SQL Server database has at least one transaction log file and generally has the .ldf extension.
  10. 10. #sqlinthecity Purpose of Transaction Logs Recovery of individual transactions Recovery of all incomplete transaction Restore to the point of failure Supporting replication and various standby server solutions
  11. 11. #sqlinthecity How the Transaction Log works
  12. 12. THE ARCHITECTURE
  13. 13. #sqlinthecity Virtual Log Files VLF 1 VLF 2 VLF 3 VLF 4 USED UNUSED UNUSED UNUSED Number of VLFs <64 MB = 4 VLFs 64 MB – 1 GB = 8 VLFs >1GB = 16 VLFs Size of VLFs <64 MB 64 MB – 1 GB >1GB = approx. 1/4 size or growth size = approx. 1/8 size or growth size = approx. 1/16 size or growth size
  14. 14. #sqlinthecity Virtual Log Files VLF 1 VLF 2 VLF 3 VLF 4 USED UNUSED UNUSED UNUSED Transaction 1 Transaction 2 Transaction 3
  15. 15. #sqlinthecity Virtual Log Files VLF 1 VLF 2 VLF 3 VLF 4 USED UNUSED UNUSED UNUSED Transaction 1 Transaction 2 Transaction 3
  16. 16. #sqlinthecity Circular Nature of Logs VLF 1 VLF 2 VLF 3 VLF 4 USED USED USED UNUSED VLF 1 VLF 2 VLF 3 VLF 4 USED UNUSED VLF 2 VLF 3 VLF 4 TRUNCATED USED USED TRUNCATED VLF 5 USED
  17. 17. #sqlinthecity Transaction logs backup These backups are important for: • Enabling point-in-time restore of your database • Controlling the size of the log file
  18. 18. #sqlinthecity Recovery Models Simple Bulk Logged Full
  19. 19. MANAGING THE TRANSACTION LOGS
  20. 20. #sqlinthecity Transaction Logs Management Create one log file on a separate disk Create a reasonably sized transaction log Auto-growth is good but … Perform Transaction Log backups Monitor, Monitor and of course Monitor
  21. 21. #sqlinthecity DBCC • DBCC SQLPERF(logspace) • DBCC SHRINKFILE • DBCC LOGINFO • DBCC OPENTRAN
  22. 22. #sqlinthecity Transaction Logs Issues Excessive File Growth Full Transaction Log (SQL Server Error 9002) VLF Fragmentation No Log File
  23. 23. #sqlinthecity Transaction Logs Solutions • Excessive File Growth – Truncate the log (log_reuse_wait_desc from sys.database) • Full Transaction Log – Depends on if your disk is full or auto-growth was not enabled • VLF Fragmentation – Modify the log file size after truncating and shrinking it • No Log File – Restore from backup files – Log rebuild and repair
  24. 24. #sqlinthecity Demo DBCC Commands and DMVs
  25. 25. RED GATE TOOLS
  26. 26. #sqlinthecity SQL Monitor Red Gate’s Performance monitoring and alerting tool • Allows users to monitor log file • Allows user to monitor disk space • Allows users to find long running transactions
  27. 27. #sqlinthecity SQL Backup Pro • Improves the performance of your backups and restores considerably. • Allows users to easily restore a transaction log to a point in time.
  28. 28. QUESTIONS
  29. 29. #sqlinthecity Extra Resources • Blogs and Articles – Paul Randall – Kimberly L. Tripp – Brad McGehee – Gail Shaw – SQL Server Central
  30. 30. #sqlinthecity Thank you for attending, please complete the online feedback form www.red-gate.com/sitc13-feedback In return you can: - Collect a Red Gate book of your choice from 5PM - Have a chance to win a Conference pass to SQL Server LIVE! 2013, which will be drawn at 5.15PM
  • kesakara

    Aug. 11, 2014

SQL In The City - Understanding and Controlling Transaction Logs by Nigel Peter Sammy. - Relational DBMS Basics - Introduction to Transaction Logs - The Architecture - Recovery Models - Managing the Transaction Logs - Red Gate Tools

Vistos

Vistos totais

2.752

No Slideshare

0

De incorporações

0

Número de incorporações

2

Ações

Baixados

87

Compartilhados

0

Comentários

0

Curtir

1

×