Database/MS-SQL

[스크랩] Don't Shrink your LDF file!!

99iberty 2017. 11. 10. 15:29


LDF를 쉬링크할수록 많은 수의 VLF 파일이 생성된다.

그러면 DB 시작, 복제, 복구 등의 성능에 큰 문제가 생긴다.


https://community.spiceworks.com/topic/465564-db-logs-not-shrinking-after-backup-on-sql-server


Please, stop shrinking your log files. That is a very bad thing It causes very high numbers of virtual log files (VLFs) which can have a very bad impact on performance for anything that needs to scan the log file such as database start-up, replication, crash recovery, change data capture, etc.


Also, why shrink it if it's just going to grow back out? In order to grow the log file back out, it has to freeze all activity hitting the log file and lock the file. Frequently auto-growing the log file also has a big performance impact.


Your goal with transaction log management is to maintain the log at a reasonable size through frequent log backups. Log backups (in full or bulk-logged recovery model) are what marks a log file as reusable. If your log file is growing large, then you're not backing it up frequently enough. I recommend a minimum frequency of at least every 30 minutes. More frequently if the server is busy.


Also, don't switch between full and simple recovery model. You break the log chain and make recovery without data loss impossible. Either leave it in full recovery model and back up the log or leave it in simple recovery model.