Skip to content

Commit 6cccd74

Browse files
authored
Merge pull request #3722 from BrentOzarULTD/3721_sp_Blitz_RG_tempdb
#3721 sp_Blitz TempDB RG
2 parents e5d01d1 + f8c6c6d commit 6cccd74

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

Documentation/sp_Blitz_Checks_by_Priority.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Before adding a new check, make sure to add a Github issue for it first, and hav
66

77
If you want to change anything about a check - the priority, finding, URL, or ID - open a Github issue first. The relevant scripts have to be updated too.
88

9-
CURRENT HIGH CHECKID: 270.
10-
If you want to add a new one, start at 271.
9+
CURRENT HIGH CHECKID: 271.
10+
If you want to add a new one, start at 272.
1111

1212
| Priority | FindingsGroup | Finding | URL | CheckID |
1313
|----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------|
@@ -131,6 +131,7 @@ If you want to add a new one, start at 271.
131131
| 170 | File Configuration | High VLF Count | https://www.BrentOzar.com/go/vlf | 69 |
132132
| 170 | File Configuration | Multiple Log Files on One Drive | https://www.BrentOzar.com/go/manylogs | 41 |
133133
| 170 | File Configuration | System Database on C Drive | https://www.BrentOzar.com/go/drivec | 24 |
134+
| 170 | File Configuration | TempDB Governor Config Problem | https://www.BrentOzar.com/go/tempdbrg | 271 |
134135
| 170 | File Configuration | TempDB Has >16 Data Files | https://www.BrentOzar.com/go/tempdb | 175 |
135136
| 170 | File Configuration | TempDB Only Has 1 Data File | https://www.BrentOzar.com/go/tempdb | 40 |
136137
| 170 | File Configuration | TempDB Unevenly Sized Data Files | https://www.BrentOzar.com/go/tempdb | 183 |

sp_Blitz.sql

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6752,6 +6752,66 @@ IF @ProductVersionMajor >= 10
67526752
END;
67536753

67546754

6755+
6756+
IF NOT EXISTS ( SELECT 1
6757+
FROM #SkipChecks
6758+
WHERE DatabaseName IS NULL AND CheckID = 271 )
6759+
AND EXISTS (SELECT * FROM sys.all_columns WHERE name = 'group_max_tempdb_data_percent')
6760+
AND EXISTS (SELECT * FROM sys.all_columns WHERE name = 'group_max_tempdb_data_mb')
6761+
BEGIN
6762+
6763+
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 271) WITH NOWAIT;
6764+
6765+
IF EXISTS (SELECT * FROM sys.resource_governor_workload_groups
6766+
WHERE group_max_tempdb_data_percent <> 0
6767+
AND group_max_tempdb_data_mb IS NULL)
6768+
BEGIN
6769+
DECLARE @TempDBfiles TABLE (config VARCHAR(50), data_files INT)
6770+
/* Valid configs */
6771+
INSERT INTO @TempDBfiles
6772+
SELECT 'Fixed predictable growth' AS config, SUM(1) AS data_files
6773+
FROM master.sys.master_files
6774+
WHERE database_id = DB_ID('tempdb')
6775+
AND type = 0 /* data */
6776+
AND max_size <> -1 /* only limited ones */
6777+
AND growth <> 0 /* growth is set */
6778+
HAVING SUM(1) > 0
6779+
UNION ALL
6780+
SELECT 'Growth turned off' AS config, SUM(1) AS data_files
6781+
FROM master.sys.master_files
6782+
WHERE database_id = DB_ID('tempdb')
6783+
AND type = 0 /* data */
6784+
AND max_size = -1 /* unlimited */
6785+
AND growth = 0
6786+
HAVING SUM(1) > 0;
6787+
6788+
IF 1 <> (SELECT COUNT(*) FROM @TempDBfiles)
6789+
OR (SELECT SUM(data_files) FROM @TempDBfiles) <>
6790+
(SELECT SUM(1)
6791+
FROM master.sys.master_files
6792+
WHERE database_id = DB_ID('tempdb')
6793+
AND type = 0 /* data */)
6794+
BEGIN
6795+
INSERT INTO #BlitzResults
6796+
( CheckID ,
6797+
Priority ,
6798+
DatabaseName ,
6799+
FindingsGroup ,
6800+
Finding ,
6801+
URL ,
6802+
Details
6803+
)
6804+
SELECT 271 AS CheckID,
6805+
170 AS Priority,
6806+
'tempdb',
6807+
'File Configuration' AS FindingsGroup,
6808+
'TempDB Governor Config Problem' AS Finding,
6809+
'https://www.BrentOzar.com/go/tempdbrg' AS URL,
6810+
'Resource Governor is configured to cap TempDB usage by percent, but the TempDB file configuration will not allow that to take effect.' AS details
6811+
END
6812+
END
6813+
END
6814+
67556815
IF @CheckUserDatabaseObjects = 1
67566816
BEGIN
67576817

0 commit comments

Comments
 (0)