VLF 는 로그파일이 증가될 때마다 생성 됨
VLF 개수 확인 방법
SELECT [name] AS 'Database Name', COUNT(l.database_id) AS 'VLF Count', SUM(CAST(vlf_active AS INT)) AS 'Active VLF', COUNT(l.database_id)-SUM(CAST(vlf_active AS INT)) AS 'Inactive VLF', SUM(vlf_size_mb) AS 'VLF Size (MB)', SUM(vlf_active*vlf_size_mb) AS 'Active VLF Size (MB)', SUM(vlf_size_mb)-SUM(vlf_active*vlf_size_mb) AS 'Inactive VLF Size (MB)' FROM sys.databases s CROSS APPLY sys.dm_db_log_info(s.database_id) l GROUP BY [name] ORDER BY COUNT(l.database_id) |
- 출처 :
https://red9.com/blog/high-vlf-count/
- VLF 개수가 많으면 Transaction Log 관련 작업 시 성능 저하 (If you have too many VLFs, then you may witness performance degradation of any activity that use the transaction log)
- VLF 개수가 적으면 VLF truncate 때 마다 비우는데 상당한 시간이 소요되며 작업 시 system 이 느려지는 것을 볼 수 있다. (On the flip side, having too few VLFs can also pose a problem. In such a case where each VLF is GBs in size, when each VLF is truncated, it will take a substantial amount of time to clear, an you could witness a system slowdown while this takes place.)
- 그래서 큰 로그 파일의 경우 8GB 청크로 트랜잭션 로그를 늘리는 것을 권장한다. (Thereofre, for large log files, it is recommended that you grow your transaction log in 8GB chunks to maintain the optimum number and size of VLFs.)
SQL Server 2014 부터 현재 로그 파일의 1/8 사이즈보다 적게 늘어나면 새로운 세그먼트 당 1개의 VLF 생성
그 전 버전까진 64MB~1GB 이하면 8VLF, 1GB 초과면 16VLF 생성
- VLF 사이즈를 줄이려면 아래와 같은 방법으로 Shrink -> Resizing 을 한다.
USE [DB명] GO DBCC SHRINKFILE ('Log 파일 명', 0, TRUNCATEONLY); GO ALTER DATABASE [DB명] MODIFY FILE (NAME = 'Log 파일 명', SIZE = 512000KB); |
출처 : https://tootlecode.wordpress.com/2019/03/09/best-practices-for-sql-server-instances/
Pro SQL Server 2019 Administration (Apress)
'Database > MSSQL' 카테고리의 다른 글
MSSQL systemdb 파일 이전, 경로 변경하기 (0) | 2022.02.22 |
---|---|
DBCC CHECKDB (0) | 2022.02.07 |
MSSQL Msg 22050 오류 (0) | 2019.05.02 |
Index Fragmentation (0) | 2019.04.12 |
Plan Cache (0) | 2019.03.28 |