Skip to content

Commit

Permalink
Merge pull request #3550 from BrentOzarULTD/dev
Browse files Browse the repository at this point in the history
2024-07-01 Release
  • Loading branch information
BrentOzar authored Jul 1, 2024
2 parents 4e2cbda + 39f26d8 commit 82e462d
Show file tree
Hide file tree
Showing 16 changed files with 917 additions and 602 deletions.
7 changes: 2 additions & 5 deletions Deprecated/readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
These old versions worked on SQL Server 2005.
sp_AllNightLog, sp_AllNightLog_Setup, sp_BlitzInMemoryOLTP, and sp_BlitzQueryStore are no longer maintained. They may still work, but no guarantees. Please don't submit issues or pull requests to change them. You're welcome to fork the code and build your own supported version, of course, since they're open source.

They are no longer maintained or updated.

Don't use 'em on SQL Server 2008 or newer - these are only for folks who still
need to manage SQL Server 2005.
The other files in this folder are older versions of the First Responder Kit that work with versions of Microsoft SQL Server that Microsoft themselves no longer support. If you're cursed enough to work with antiques like SQL Server 2012, 2008, or heaven forbid, 2005, you may still be able to get value out of these, but we don't support the scripts anymore either.
7 changes: 5 additions & 2 deletions Documentation/sp_Blitz_Checks_by_Priority.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: 261.
If you want to add a new one, start at 262.
CURRENT HIGH CHECKID: 264.
If you want to add a new one, start at 265.

| Priority | FindingsGroup | Finding | URL | CheckID |
|----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------|
Expand Down Expand Up @@ -247,6 +247,9 @@ If you want to add a new one, start at 262.
| 200 | Performance | Non-Dynamic Memory | https://www.BrentOzar.com/go/memory | 190 |
| 200 | Performance | Old Compatibility Level | https://www.BrentOzar.com/go/compatlevel | 62 |
| 200 | Performance | Query Store Disabled | https://www.BrentOzar.com/go/querystore | 163 |
| 200 | Performance | Query Store Wait Stats Disabled | https://www.sqlskills.com/blogs/erin/query-store-settings/ | 262 |
| 200 | Performance | Query Store Effectively Disabled | https://learn.microsoft.com/en-us/sql/relational-databases/performance/best-practice-with-the-query-store#Verify | 263 |
| 200 | Performance | Undesired Query Store State | https://learn.microsoft.com/en-us/sql/relational-databases/performance/best-practice-with-the-query-store#Verify | 264 |
| 200 | Performance | Snapshot Backups Occurring | https://www.BrentOzar.com/go/snaps | 178 |
| 200 | Performance | User-Created Statistics In Place | https://www.BrentOzar.com/go/userstats | 122 |
| 200 | Performance | SSAS/SSIS/SSRS Installed | https://www.BrentOzar.com/go/services | 224 |
Expand Down
690 changes: 418 additions & 272 deletions Install-All-Scripts.sql

Large diffs are not rendered by default.

115 changes: 70 additions & 45 deletions Install-Azure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ AS
SET NOCOUNT ON;
SET STATISTICS XML OFF;

SELECT @Version = '8.20', @VersionDate = '20240522';
SELECT @Version = '8.21', @VersionDate = '20240701';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down Expand Up @@ -1172,7 +1172,7 @@ SET NOCOUNT ON;
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.20', @VersionDate = '20240522';
SELECT @Version = '8.21', @VersionDate = '20240701';
SET @OutputType = UPPER(@OutputType);

IF(@VersionCheckMode = 1)
Expand Down Expand Up @@ -8545,7 +8545,7 @@ SET NOCOUNT ON;
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.20', @VersionDate = '20240522';
SELECT @Version = '8.21', @VersionDate = '20240701';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down Expand Up @@ -13554,7 +13554,7 @@ SET NOCOUNT ON;
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.20', @VersionDate = '20240522';
SELECT @Version = '8.21', @VersionDate = '20240701';
SET @OutputType = UPPER(@OutputType);

IF(@VersionCheckMode = 1)
Expand Down Expand Up @@ -20029,6 +20029,7 @@ ALTER PROCEDURE
@EventSessionName sysname = N'system_health',
@TargetSessionType sysname = NULL,
@VictimsOnly bit = 0,
@DeadlockType nvarchar(20) = NULL,
@Debug bit = 0,
@Help bit = 0,
@Version varchar(30) = NULL OUTPUT,
Expand All @@ -20047,7 +20048,7 @@ BEGIN
SET XACT_ABORT OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.20', @VersionDate = '20240522';
SELECT @Version = '8.21', @VersionDate = '20240701';

IF @VersionCheckMode = 1
BEGIN
Expand Down Expand Up @@ -20209,7 +20210,7 @@ BEGIN
@StartDateOriginal datetime = @StartDate,
@EndDateOriginal datetime = @EndDate,
@StartDateUTC datetime,
@EndDateUTC datetime;
@EndDateUTC datetime;;

/*Temporary objects used in the procedure*/
DECLARE
Expand Down Expand Up @@ -20719,50 +20720,63 @@ BEGIN
END CATCH;
END;

IF @DeadlockType IS NOT NULL
BEGIN
SELECT
@DeadlockType =
CASE
WHEN LOWER(@DeadlockType) LIKE 'regular%'
THEN N'Regular Deadlock'
WHEN LOWER(@DeadlockType) LIKE N'parallel%'
THEN N'Parallel Deadlock'
ELSE NULL
END;
END;

/*If @TargetSessionType, we need to figure out if it's ring buffer or event file*/
/*Azure has differently named views, so we need to separate. Thanks, Azure.*/

IF
(
@Azure = 0
AND @TargetSessionType IS NULL
)
BEGIN
RAISERROR('@TargetSessionType is NULL, assigning for non-Azure instance', 0, 1) WITH NOWAIT;
IF
(
@Azure = 0
AND @TargetSessionType IS NULL
)
BEGIN
RAISERROR('@TargetSessionType is NULL, assigning for non-Azure instance', 0, 1) WITH NOWAIT;

SELECT TOP (1)
@TargetSessionType = t.target_name
FROM sys.dm_xe_sessions AS s
JOIN sys.dm_xe_session_targets AS t
ON s.address = t.event_session_address
WHERE s.name = @EventSessionName
AND t.target_name IN (N'event_file', N'ring_buffer')
ORDER BY t.target_name
OPTION(RECOMPILE);
SELECT TOP (1)
@TargetSessionType = t.target_name
FROM sys.dm_xe_sessions AS s
JOIN sys.dm_xe_session_targets AS t
ON s.address = t.event_session_address
WHERE s.name = @EventSessionName
AND t.target_name IN (N'event_file', N'ring_buffer')
ORDER BY t.target_name
OPTION(RECOMPILE);

RAISERROR('@TargetSessionType assigned as %s for non-Azure', 0, 1, @TargetSessionType) WITH NOWAIT;
END;
RAISERROR('@TargetSessionType assigned as %s for non-Azure', 0, 1, @TargetSessionType) WITH NOWAIT;
END;

IF
(
@Azure = 1
AND @TargetSessionType IS NULL
)
BEGIN
RAISERROR('@TargetSessionType is NULL, assigning for Azure instance', 0, 1) WITH NOWAIT;
IF
(
@Azure = 1
AND @TargetSessionType IS NULL
)
BEGIN
RAISERROR('@TargetSessionType is NULL, assigning for Azure instance', 0, 1) WITH NOWAIT;

SELECT TOP (1)
@TargetSessionType = t.target_name
FROM sys.dm_xe_database_sessions AS s
JOIN sys.dm_xe_database_session_targets AS t
ON s.address = t.event_session_address
WHERE s.name = @EventSessionName
AND t.target_name IN (N'event_file', N'ring_buffer')
ORDER BY t.target_name
OPTION(RECOMPILE);
SELECT TOP (1)
@TargetSessionType = t.target_name
FROM sys.dm_xe_database_sessions AS s
JOIN sys.dm_xe_database_session_targets AS t
ON s.address = t.event_session_address
WHERE s.name = @EventSessionName
AND t.target_name IN (N'event_file', N'ring_buffer')
ORDER BY t.target_name
OPTION(RECOMPILE);

RAISERROR('@TargetSessionType assigned as %s for Azure', 0, 1, @TargetSessionType) WITH NOWAIT;
END;
RAISERROR('@TargetSessionType assigned as %s for Azure', 0, 1, @TargetSessionType) WITH NOWAIT;
END;


/*The system health stuff gets handled different from user extended events.*/
Expand Down Expand Up @@ -23460,6 +23474,7 @@ BEGIN
AND (d.client_app = @AppName OR @AppName IS NULL)
AND (d.host_name = @HostName OR @HostName IS NULL)
AND (d.login_name = @LoginName OR @LoginName IS NULL)
AND (d.deadlock_type = @DeadlockType OR @DeadlockType IS NULL)
OPTION (RECOMPILE, LOOP JOIN, HASH JOIN);

UPDATE d
Expand Down Expand Up @@ -23847,7 +23862,11 @@ BEGIN
deqs.max_reserved_threads,
deqs.min_used_threads,
deqs.max_used_threads,
deqs.total_rows
deqs.total_rows,
max_worker_time_ms =
deqs.max_worker_time / 1000.,
max_elapsed_time_ms =
deqs.max_elapsed_time / 1000.
INTO #dm_exec_query_stats
FROM sys.dm_exec_query_stats AS deqs
WHERE EXISTS
Expand Down Expand Up @@ -23879,8 +23898,10 @@ BEGIN
ap.executions_per_second,
ap.total_worker_time_ms,
ap.avg_worker_time_ms,
ap.max_worker_time_ms,
ap.total_elapsed_time_ms,
ap.avg_elapsed_time_ms,
ap.max_elapsed_time_ms,
ap.total_logical_reads_mb,
ap.total_physical_reads_mb,
ap.total_logical_writes_mb,
Expand Down Expand Up @@ -23923,7 +23944,9 @@ BEGIN
c.min_used_threads,
c.max_used_threads,
c.total_rows,
c.query_plan
c.query_plan,
c.max_worker_time_ms,
c.max_elapsed_time_ms
FROM #available_plans AS ap
OUTER APPLY
(
Expand Down Expand Up @@ -24074,6 +24097,8 @@ BEGIN
@TargetSessionType,
VictimsOnly =
@VictimsOnly,
DeadlockType =
@DeadlockType,
Debug =
@Debug,
Help =
Expand Down Expand Up @@ -24178,7 +24203,7 @@ BEGIN
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.20', @VersionDate = '20240522';
SELECT @Version = '8.21', @VersionDate = '20240701';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Navigation
- [sp_BlitzAnalysis: Query sp_BlitzFirst output tables](#sp_blitzanalysis-query-sp_BlitzFirst-output-tables)
- Backups and Restores:
- [sp_BlitzBackups: How Much Data Could You Lose](#sp_blitzbackups-how-much-data-could-you-lose)
- [sp_AllNightLog: Back Up Faster to Lose Less Data](#sp_allnightlog-back-up-faster-to-lose-less-data)
- [sp_DatabaseRestore: Easier Multi-File Restores](#sp_databaserestore-easier-multi-file-restores)
- [Parameters Common to Many of the Stored Procedures](#parameters-common-to-many-of-the-stored-procedures)
- [License MIT](#license)
Expand All @@ -42,7 +41,7 @@ To install, [download the latest release ZIP](https://github.com/BrentOzarULTD/S
The First Responder Kit runs on:

* SQL Server on Windows - all versions that Microsoft supports. For end of support dates, check out the "Support Ends" column at https://sqlserverupdates.com.
* SQL Server on Linux - yes, fully supported except sp_AllNightLog and sp_DatabaseRestore, which require xp_cmdshell, which Microsoft doesn't provide on Linux.
* SQL Server on Linux - yes, fully supported except sp_DatabaseRestore, which require xp_cmdshell, which Microsoft doesn't provide on Linux.
* Amazon RDS SQL Server - fully supported.
* Azure SQL DB - not supported. Some of the procedures work, but some don't, and Microsoft has a tendency to change DMVs in Azure without warning, so we don't put any effort into supporting it. If it works, great! If not, any changes to make it work would be on you. [See the contributing.md file](CONTRIBUTING.md) for how to do that.

Expand Down Expand Up @@ -275,7 +274,6 @@ sp_BlitzIndex focuses on mainstream index types. Other index types have varying

* Fully supported: rowstore indexes, columnstore indexes, temporal tables.
* Columnstore indexes: fully supported. Key columns are shown as includes rather than keys since they're not in a specific order.
* In-Memory OLTP (Hekaton): unsupported. These objects show up in the results, but for more info, you'll want to use sp_BlitzInMemoryOLTP instead.
* Graph tables: unsupported. These objects show up in the results, but we don't do anything special with 'em, like call out that they're graph tables.
* Spatial indexes: unsupported. We call out that they're spatial, but we don't do any special handling for them.
* XML indexes: unsupported. These objects show up in the results, but we don't include the index's columns or sizes.
Expand Down Expand Up @@ -465,7 +463,7 @@ Parameters include:
* @Debug - default 0. When 1, we print out messages of what we're doing in the messages tab of SSMS.
* @StopAt NVARCHAR(14) - pass in a date time to stop your restores at a time like '20170508201501'. This doesn't use the StopAt parameter for the restore command - it simply stops restoring logs that would have this date/time's contents in it. (For example, if you're taking backups every 15 minutes on the hour, and you pass in 9:05 AM as part of the restore time, the restores would stop at your last log backup that doesn't include 9:05AM's data - but it won't restore right up to 9:05 AM.)
* @SkipBackupsAlreadyInMsdb - default 0. When set to 1, we check MSDB for the most recently restored backup from this log path, and skip all backup files prior to that. Useful if you're pulling backups from across a slow network and you don't want to wait to check the restore header of each backup.

* @EnableBroker - default 0. When set to 1, we run RESTORE WITH ENABLE_BROKER, enabling the service broker. Unless specified, the service broker is disabled on restore even if it was enabled when the backup was taken.

For information about how this works, see [Tara Kizer's white paper on Log Shipping 2.0 with Google Compute Engine.](https://www.brentozar.com/archive/2017/03/new-white-paper-build-sql-server-disaster-recovery-plan-google-compute-engine/)

Expand Down
1 change: 1 addition & 0 deletions SqlServerVersions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ VALUES
(16, 4003, 'CU1', 'https://support.microsoft.com/en-us/help/5022375', '2023-02-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 1'),
(16, 1050, 'RTM GDR', 'https://support.microsoft.com/kb/5021522', '2023-02-14', '2028-01-11', '2033-01-11', 'SQL Server 2022 GDR', 'RTM'),
(16, 1000, 'RTM', '', '2022-11-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'RTM'),
(15, 4375, 'CU27', 'https://support.microsoft.com/kb/5037331', '2024-06-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 27'),
(15, 4365, 'CU26', 'https://support.microsoft.com/kb/5035123', '2024-04-11', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 26'),
(15, 4355, 'CU25', 'https://support.microsoft.com/kb/5033688', '2024-02-15', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 25'),
(15, 4345, 'CU24', 'https://support.microsoft.com/kb/5031908', '2023-12-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 24'),
Expand Down
Loading

0 comments on commit 82e462d

Please sign in to comment.