diff --git a/Documentation/sp_Blitz_Checks_by_Priority.md b/Documentation/sp_Blitz_Checks_by_Priority.md index 950d11b8..cec39fca 100644 --- a/Documentation/sp_Blitz_Checks_by_Priority.md +++ b/Documentation/sp_Blitz_Checks_by_Priority.md @@ -6,8 +6,8 @@ Before adding a new check, make sure to add a Github issue for it first, and hav 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. -CURRENT HIGH CHECKID: 272. -If you want to add a new one, start at 273. +CURRENT HIGH CHECKID: 274. +If you want to add a new one, start at 275. | Priority | FindingsGroup | Finding | URL | CheckID | |----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------| @@ -127,6 +127,8 @@ If you want to add a new one, start at 273. | 150 | Performance | Stats Updated Asynchronously | https://www.BrentOzar.com/go/asyncstats | 17 | | 150 | Performance | Triggers on Tables | https://www.BrentOzar.com/go/trig | 32 | | 150 | Performance | Inconsistent Query Store metadata | | 235 | +| 150 | Performance | Missing Read-Only Routing URL | https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/configure-read-only-routing-for-an-availability-group-sql-server?view=sql-server-ver17#RORReplicaProperties | 273 | +| 150 | Performance | Missing Read-Only Routing List | https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/configure-read-only-routing-for-an-availability-group-sql-server?view=sql-server-ver17#RORReplicaProperties | 274 | | 170 | File Configuration | File growth set to 1MB | https://www.BrentOzar.com/go/percentgrowth | 158 | | 170 | File Configuration | File growth set to percent | https://www.BrentOzar.com/go/percentgrowth | 82 | | 170 | File Configuration | High VLF Count | https://www.BrentOzar.com/go/vlf | 69 | diff --git a/sp_Blitz.sql b/sp_Blitz.sql index 17527339..c4376aeb 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -3550,6 +3550,79 @@ AS END; + IF NOT EXISTS ( SELECT 1 + FROM #SkipChecks + WHERE DatabaseName IS NULL AND CheckID = 273 ) + /* No checking for if the AG DMVs exist. We already use some of them elsewhere without checking. */ + BEGIN + + IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 273) WITH NOWAIT; + + INSERT INTO #BlitzResults + ( CheckID , + Priority , + FindingsGroup , + Finding , + URL , + Details + ) + SELECT DISTINCT 273 AS CheckID , + /* + In theory, we could probably put a comma-separated list of databases here. + But the group name should be enough. + */ + 150 AS Priority , + 'Performance' AS FindingsGroup , + 'Missing Read-Only Routing URL' AS Finding , + 'https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/configure-read-only-routing-for-an-availability-group-sql-server?view=sql-server-ver17#RORReplicaProperties' AS URL , + ( 'Replica ' + QUOTENAME(ar.replica_server_name) + + ' of Availability Group ' + QUOTENAME(ag.[name]) + + ' is set to READ_ONLY when secondary. However, it has no read-only routing URL.' + + ' Maybe this is intentional, but you certainly do not have read-only routing working here.' + ) AS Details + FROM sys.availability_replicas AS ar + JOIN sys.availability_groups AS ag ON ar.group_id = ag.group_id + WHERE ar.read_only_routing_url IS NULL + AND ar.secondary_role_allow_connections = 1 /* READ_ONLY */ + END; + + IF NOT EXISTS ( SELECT 1 + FROM #SkipChecks + WHERE DatabaseName IS NULL AND CheckID = 274 ) + BEGIN + + IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 274) WITH NOWAIT; + + INSERT INTO #BlitzResults + ( CheckID , + Priority , + FindingsGroup , + Finding , + URL , + Details + ) + SELECT DISTINCT 274 AS CheckID , + /* + In theory, we could probably put a comma-separated list of databases here. + But the group name should be enough. + */ + 150 AS Priority , + 'Performance' AS FindingsGroup , + 'Missing Read-Only Routing List' AS Finding , + 'https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/configure-read-only-routing-for-an-availability-group-sql-server?view=sql-server-ver17#RORReplicaProperties' AS URL , + ( 'Replica ' + QUOTENAME(ar.replica_server_name) + + ' of Availability Group ' + QUOTENAME(ag.[name]) + + ' has a read-only routing URL, but no read-only routing lists.' + + ' Is your read-only routing configuration unfinished?' + ) AS Details + FROM sys.availability_replicas AS ar + JOIN sys.availability_groups AS ag ON ar.group_id = ag.group_id + WHERE NOT EXISTS (SELECT 1 + FROM sys.availability_read_only_routing_lists AS arorl + WHERE arorl.replica_id = ar.replica_id ) + AND ar.read_only_routing_url IS NOT NULL + END; + IF NOT EXISTS ( SELECT 1 FROM #SkipChecks WHERE DatabaseName IS NULL AND CheckID = 55 )