Skip to content

Commit 4d560f5

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/dev'
2 parents 6825c6e + 351d659 commit 4d560f5

File tree

7 files changed

+58
-44
lines changed

7 files changed

+58
-44
lines changed

Documentation/Development/ReleaseProcess.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Well, useful is probably the wrong word. More like entertaining. Here we go.
2727
* sp_BlitzFirst @VersionDate (no version)
2828
* sp_BlitzCache @Version and @VersionDate
2929
* sp_Blitz @Version and @VersionDate
30+
* sp_DatabaseRestore @Version and @VersionDate
3031

3132
## Push to Master
3233

sp_Blitz.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ AS
3131
SET NOCOUNT ON;
3232
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
3333
DECLARE @Version VARCHAR(30);
34-
SET @Version = '5.2';
35-
SET @VersionDate = '20170406';
34+
SET @Version = '5.3';
35+
SET @VersionDate = '20170501';
3636
SET @OutputType = UPPER(@OutputType);
3737

3838
IF @Help = 1 PRINT '

sp_BlitzCache.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ SET NOCOUNT ON;
242242
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
243243

244244
DECLARE @Version VARCHAR(30);
245-
SET @Version = '5.2';
246-
SET @VersionDate = '20170406';
245+
SET @Version = '5.3';
246+
SET @VersionDate = '20170501';
247247

248248
IF @Help = 1 PRINT '
249249
sp_BlitzCache from http://FirstResponderKit.org
@@ -4081,7 +4081,9 @@ BEGIN
40814081
'A high number of plan stubs may result in CMEMTHREAD waits, which you have '
40824082
+ CONVERT(VARCHAR(10), (SELECT CONVERT(DECIMAL(9,0), (dows.wait_time_ms / 60000.)) FROM sys.dm_os_wait_stats AS dows WHERE dows.wait_type = 'CMEMTHREAD')) + ' minutes of.'
40834083
FROM #plan_stubs_warning p ;
4084-
4084+
4085+
IF @v >= 11
4086+
BEGIN
40854087
IF EXISTS (SELECT 1/0
40864088
FROM #trace_flags AS tf
40874089
WHERE tf.global_trace_flags IS NOT NULL
@@ -4094,6 +4096,7 @@ BEGIN
40944096
'You have Global Trace Flags enabled on your server',
40954097
'https://www.brentozar.com/blitz/trace-flags-enabled-globally/',
40964098
'You have the following Global Trace Flags enabled: ' + (SELECT TOP 1 tf.global_trace_flags FROM #trace_flags AS tf WHERE tf.global_trace_flags IS NOT NULL)) ;
4099+
END
40974100

40984101
IF NOT EXISTS (SELECT 1/0
40994102
FROM ##bou_BlitzCacheResults AS bcr

sp_BlitzFirst.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ BEGIN
3030
SET NOCOUNT ON;
3131
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
3232
DECLARE @Version VARCHAR(30);
33-
SET @Version = '5.2';
34-
SET @VersionDate = '20170406';
33+
SET @Version = '5.3';
34+
SET @VersionDate = '20170501';
3535

3636

3737
IF @Help = 1 PRINT '

sp_BlitzIndex.sql

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ AS
3636
SET NOCOUNT ON;
3737
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
3838
DECLARE @Version VARCHAR(30);
39-
SET @Version = '5.2';
40-
SET @VersionDate = '20170406';
39+
SET @Version = '5.3';
40+
SET @VersionDate = '20170501';
4141
IF @Help = 1 PRINT '
4242
/*
4343
sp_BlitzIndex from http://FirstResponderKit.org
@@ -2503,73 +2503,79 @@ BEGIN;
25032503
https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/825
25042504
*/
25052505

2506-
DECLARE @number_indexes_with_includes INT;
2507-
DECLARE @percent_indexes_with_includes NUMERIC(10, 1);
2506+
SELECT database_name,
2507+
SUM(CASE WHEN count_included_columns > 0 THEN 1 ELSE 0 END) AS number_indexes_with_includes,
2508+
100.* SUM(CASE WHEN count_included_columns > 0 THEN 1 ELSE 0 END) / ( 1.0 * COUNT(*) ) AS percent_indexes_with_includes
2509+
INTO #index_includes
2510+
FROM #IndexSanity
2511+
GROUP BY database_name;
25082512

2509-
SELECT @number_indexes_with_includes = SUM(CASE WHEN count_included_columns > 0 THEN 1 ELSE 0 END),
2510-
@percent_indexes_with_includes = 100.*
2511-
SUM(CASE WHEN count_included_columns > 0 THEN 1 ELSE 0 END) / ( 1.0 * COUNT(*) )
2512-
FROM #IndexSanity;
2513-
2514-
IF @number_indexes_with_includes = 0 AND NOT (@GetAllDatabases = 1 OR @Mode = 0)
2515-
INSERT #BlitzIndexResults ( check_id, index_sanity_id, Priority, findings_group, finding, URL, details, index_definition,
2513+
IF NOT (@Mode = 0)
2514+
INSERT #BlitzIndexResults ( check_id, index_sanity_id, Priority, findings_group, finding, [database_name], URL, details, index_definition,
25162515
secret_columns, index_usage_summary, index_size_summary )
2517-
SELECT 30 AS check_id,
2516+
SELECT 30 AS check_id,
25182517
NULL AS index_sanity_id,
25192518
250 AS Priority,
25202519
N'Feature-Phobic Indexes' AS findings_group,
2520+
database_name AS [Database Name],
25212521
N'No indexes use includes' AS finding, 'http://BrentOzar.com/go/IndexFeatures' AS URL,
25222522
N'No indexes use includes' AS details,
2523-
@DatabaseName + N' (Entire database)' AS index_definition,
2523+
database_name + N' (Entire database)' AS index_definition,
25242524
N'' AS secret_columns,
25252525
N'N/A' AS index_usage_summary,
2526-
N'N/A' AS index_size_summary OPTION ( RECOMPILE );
2526+
N'N/A' AS index_size_summary
2527+
FROM #index_includes
2528+
WHERE number_indexes_with_includes = 0
2529+
OPTION ( RECOMPILE );
25272530

25282531
RAISERROR(N'check_id 31: < 3 percent of indexes have includes', 0,1) WITH NOWAIT;
2529-
IF @percent_indexes_with_includes <= 3 AND @number_indexes_with_includes > 0 AND NOT (@GetAllDatabases = 1 OR @Mode = 0)
2532+
IF NOT (@Mode = 0)
25302533
INSERT #BlitzIndexResults ( check_id, index_sanity_id, Priority, findings_group, finding, [database_name], URL, details, index_definition,
25312534
secret_columns, index_usage_summary, index_size_summary )
25322535
SELECT 31 AS check_id,
25332536
NULL AS index_sanity_id,
25342537
150 AS Priority,
25352538
N'Feature-Phobic Indexes' AS findings_group,
25362539
N'Borderline: Includes are used in < 3% of indexes' AS findings,
2537-
@DatabaseName AS [Database Name],
2540+
database_name AS [Database Name],
25382541
N'http://BrentOzar.com/go/IndexFeatures' AS URL,
2539-
N'Only ' + CAST(@percent_indexes_with_includes AS NVARCHAR(10)) + '% of indexes have includes' AS details,
2542+
N'Only ' + CAST(percent_indexes_with_includes AS NVARCHAR(20)) + '% of indexes have includes' AS details,
25402543
N'Entire database' AS index_definition,
25412544
N'' AS secret_columns,
25422545
N'N/A' AS index_usage_summary,
2543-
N'N/A' AS index_size_summary OPTION ( RECOMPILE );
2546+
N'N/A' AS index_size_summary
2547+
FROM #index_includes
2548+
WHERE number_indexes_with_includes > 0 AND percent_indexes_with_includes <= 3
2549+
OPTION ( RECOMPILE );
25442550

25452551
RAISERROR(N'check_id 32: filtered indexes and indexed views', 0,1) WITH NOWAIT;
2546-
DECLARE @count_filtered_indexes INT;
2547-
DECLARE @count_indexed_views INT;
2548-
2549-
SELECT @count_filtered_indexes=COUNT(*)
2550-
FROM #IndexSanity
2551-
WHERE filter_definition <> '' OPTION ( RECOMPILE );
2552-
2553-
SELECT @count_indexed_views=COUNT(*)
2554-
FROM #IndexSanity AS i
2555-
JOIN #IndexSanitySize AS sz ON i.index_sanity_id = sz.index_sanity_id
2556-
WHERE is_indexed_view = 1 OPTION ( RECOMPILE );
25572552

2558-
IF @count_filtered_indexes = 0 AND @count_indexed_views=0 AND NOT (@GetAllDatabases = 1 OR @Mode = 0)
2553+
IF NOT (@Mode = 0)
25592554
INSERT #BlitzIndexResults ( check_id, index_sanity_id, Priority, findings_group, finding, [database_name], URL, details, index_definition,
25602555
secret_columns, index_usage_summary, index_size_summary )
2561-
SELECT 32 AS check_id,
2556+
SELECT DISTINCT
2557+
32 AS check_id,
25622558
NULL AS index_sanity_id,
25632559
250 AS Priority,
25642560
N'Feature-Phobic Indexes' AS findings_group,
25652561
N'Borderline: No filtered indexes or indexed views exist' AS finding,
2566-
@DatabaseName AS [Database Name],
2562+
i.database_name AS [Database Name],
25672563
N'http://BrentOzar.com/go/IndexFeatures' AS URL,
25682564
N'These are NOT always needed-- but do you know when you would use them?' AS details,
2569-
@DatabaseName + N' (Entire database)' AS index_definition,
2565+
i.database_name + N' (Entire database)' AS index_definition,
25702566
N'' AS secret_columns,
25712567
N'N/A' AS index_usage_summary,
2572-
N'N/A' AS index_size_summary OPTION ( RECOMPILE );
2568+
N'N/A' AS index_size_summary
2569+
FROM #IndexSanity i
2570+
WHERE i.database_name NOT IN (
2571+
SELECT database_name
2572+
FROM #IndexSanity
2573+
WHERE filter_definition <> '' )
2574+
AND i.database_name NOT IN (
2575+
SELECT database_name
2576+
FROM #IndexSanity
2577+
WHERE is_indexed_view = 1 )
2578+
OPTION ( RECOMPILE );
25732579
END;
25742580

25752581
RAISERROR(N'check_id 33: Potential filtered indexes based on column names.', 0,1) WITH NOWAIT;

sp_BlitzWho.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ BEGIN
1111
SET NOCOUNT ON;
1212
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
1313
DECLARE @Version VARCHAR(30);
14-
SET @Version = '5.2';
15-
SET @VersionDate = '20170406';
14+
SET @Version = '5.3';
15+
SET @VersionDate = '20170501';
1616

1717

1818
IF @Help = 1

sp_DatabaseRestore.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ GO
5757
ALTER PROCEDURE [dbo].[sp_DatabaseRestore]
5858
@Database NVARCHAR(128), @RestoreDatabaseName NVARCHAR(128) = NULL, @BackupPathFull NVARCHAR(MAX), @BackupPathDiff NVARCHAR(MAX), @BackupPathLog NVARCHAR(MAX),
5959
@MoveFiles bit = 0, @MoveDataDrive NVARCHAR(260) = NULL, @MoveLogDrive NVARCHAR(260) = NULL, @TestRestore bit = 0, @RunCheckDB bit = 0, @RestoreDiff bit = 0,
60-
@ContinueLogs bit = 0, @RunRecovery bit = 0, @Debug INT = 0
60+
@ContinueLogs bit = 0, @RunRecovery bit = 0, @Debug INT = 0, @VersionDate DATETIME = NULL OUTPUT
6161
AS
6262
SET NOCOUNT ON;
6363

64+
DECLARE @Version VARCHAR(30);
65+
SET @Version = '5.3';
66+
SET @VersionDate = '20170501';
67+
6468
DECLARE @cmd NVARCHAR(4000), @sql NVARCHAR(MAX), @LastFullBackup NVARCHAR(500), @LastDiffBackup NVARCHAR(500), @BackupFile NVARCHAR(500), @BackupDateTime AS CHAR(15), @FullLastLSN NUMERIC(25, 0), @DiffLastLSN NUMERIC(25, 0);
6569
DECLARE @FileList TABLE (BackupFile NVARCHAR(255));
6670

0 commit comments

Comments
 (0)