Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2062 sp_BlitzFirst false alarm on index reorgs #2091

Merged
merged 1 commit into from
Aug 26, 2019

Conversation

BrentOzar
Copy link
Member

Filtering for sql_text not like %alter index%'. Closes #2062 with duct tape.

Filtering for sql_text not like %alter index%'. Closes #2062 with duct tape.
@BrentOzar BrentOzar added this to the 2019-08 Release milestone Aug 26, 2019
@BrentOzar BrentOzar self-assigned this Aug 26, 2019
@BrentOzar BrentOzar merged commit d6265f5 into dev Aug 26, 2019
@BrentOzar BrentOzar deleted the 2062_sp_BlitzFirst_index_reorgs branch August 26, 2019 12:56
BrentOzar added a commit that referenced this pull request Aug 26, 2019
* #2005 sp_Blitz version numbers (#2006)

Working on #2005.

* #2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes #2005.

* #2010 sp_Blitz paused online index operations (#2011)

Add warning for rows in sys.index_resumable_operations. Closes #2010.

* Fix collation error. (#2014)

* #2015 sp_BlitzCache sorting in Azure SQL DB (#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes #2015.

* #2024 sp_BlitzQueryStore s.is_cursor error (#2025)

Changed alias on a temp table to match other nearby aliases. Closes #2024.

* First responder consistency check (#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* #1994 sp_Blitz version checking (#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes #1994.

* #1944 sp_BlitzIndex ignore databases (#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes #1944.

* #2009 sp_BlitzFirst call BC differently (#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes #2009.

* #2026 sp_BlitzCache show multiple plan count (#2031)

Closes #2026.

* #2017 sp_Blitz Evaluation Edition expiration check (#2032)

Closes #2017.

* #2018 sp_BlitzCache arith overflow (#2033)

Changing MONEY on totals to BIGINT. Closes #2018.

* #2019 sp_BlitzCache air_quote_actual plans (#2034)

Closes #2019.

* Add END in the right spot for IF @Help = 1 (#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* #2037 sp_BlitzLock support for AWS RDS (#2038)

Skips update stats with options that RDS doesn't support. Closes #2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (#2040)

* #2042 implicit transaction troubleshooting (#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes #2042.

* edit hyperlink (#2056)

* add @OutputType = 'XML' (#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue #2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* #2067 Updating directory "/" fixing to work with URLs (#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* #2076 sp_BlitzIndex columnstore to table (#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes #2076.

* @2060 sp_BlitzFirst 2TB RAM (#2086)

Casting RAM as a BIGINT instead of INT. Closes #2060.

* #2053 sp_BlitzIndex ignoring databases (#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes #2053.

* #2022 sp_BlitzCache disabling air_quote_actuals (#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes #2022.

* #2044 sp_Blitz new power mode (#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes #2044.

* #2062 sp_BlitzFirst false alarm on index reorgs (#2091)

Filtering for sql_text not like %alter index%'. Closes #2062 with duct tape.

* #2052 sp_BlitzCache prioritization (#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes #2052.

* #2070 sp_BlitzCache duplicated index count (#2093)

Filters index recommendations by spid. Closes #2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.
BrentOzar added a commit that referenced this pull request Aug 26, 2019
* #2005 sp_Blitz version numbers (#2006)

Working on #2005.

* #2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes #2005.

* #2010 sp_Blitz paused online index operations (#2011)

Add warning for rows in sys.index_resumable_operations. Closes #2010.

* Fix collation error. (#2014)

* #2015 sp_BlitzCache sorting in Azure SQL DB (#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes #2015.

* #2024 sp_BlitzQueryStore s.is_cursor error (#2025)

Changed alias on a temp table to match other nearby aliases. Closes #2024.

* First responder consistency check (#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* #1994 sp_Blitz version checking (#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes #1994.

* #1944 sp_BlitzIndex ignore databases (#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes #1944.

* #2009 sp_BlitzFirst call BC differently (#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes #2009.

* #2026 sp_BlitzCache show multiple plan count (#2031)

Closes #2026.

* #2017 sp_Blitz Evaluation Edition expiration check (#2032)

Closes #2017.

* #2018 sp_BlitzCache arith overflow (#2033)

Changing MONEY on totals to BIGINT. Closes #2018.

* #2019 sp_BlitzCache air_quote_actual plans (#2034)

Closes #2019.

* Add END in the right spot for IF @Help = 1 (#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* #2037 sp_BlitzLock support for AWS RDS (#2038)

Skips update stats with options that RDS doesn't support. Closes #2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (#2040)

* #2042 implicit transaction troubleshooting (#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes #2042.

* edit hyperlink (#2056)

* add @OutputType = 'XML' (#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue #2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* #2067 Updating directory "/" fixing to work with URLs (#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* #2076 sp_BlitzIndex columnstore to table (#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes #2076.

* @2060 sp_BlitzFirst 2TB RAM (#2086)

Casting RAM as a BIGINT instead of INT. Closes #2060.

* #2053 sp_BlitzIndex ignoring databases (#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes #2053.

* #2022 sp_BlitzCache disabling air_quote_actuals (#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes #2022.

* #2044 sp_Blitz new power mode (#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes #2044.

* #2062 sp_BlitzFirst false alarm on index reorgs (#2091)

Filtering for sql_text not like %alter index%'. Closes #2062 with duct tape.

* #2052 sp_BlitzCache prioritization (#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes #2052.

* #2070 sp_BlitzCache duplicated index count (#2093)

Filters index recommendations by spid. Closes #2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.
BrentOzar added a commit that referenced this pull request Sep 22, 2019
* #2005 sp_Blitz version numbers (#2006)

Working on #2005.

* #2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes #2005.

* #2010 sp_Blitz paused online index operations (#2011)

Add warning for rows in sys.index_resumable_operations. Closes #2010.

* Fix collation error. (#2014)

* #2015 sp_BlitzCache sorting in Azure SQL DB (#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes #2015.

* #2024 sp_BlitzQueryStore s.is_cursor error (#2025)

Changed alias on a temp table to match other nearby aliases. Closes #2024.

* First responder consistency check (#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* #1994 sp_Blitz version checking (#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes #1994.

* #1944 sp_BlitzIndex ignore databases (#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes #1944.

* #2009 sp_BlitzFirst call BC differently (#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes #2009.

* #2026 sp_BlitzCache show multiple plan count (#2031)

Closes #2026.

* #2017 sp_Blitz Evaluation Edition expiration check (#2032)

Closes #2017.

* #2018 sp_BlitzCache arith overflow (#2033)

Changing MONEY on totals to BIGINT. Closes #2018.

* #2019 sp_BlitzCache air_quote_actual plans (#2034)

Closes #2019.

* Add END in the right spot for IF @Help = 1 (#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* #2037 sp_BlitzLock support for AWS RDS (#2038)

Skips update stats with options that RDS doesn't support. Closes #2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (#2040)

* #2042 implicit transaction troubleshooting (#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes #2042.

* edit hyperlink (#2056)

* add @OutputType = 'XML' (#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue #2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* #2067 Updating directory "/" fixing to work with URLs (#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* #2076 sp_BlitzIndex columnstore to table (#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes #2076.

* @2060 sp_BlitzFirst 2TB RAM (#2086)

Casting RAM as a BIGINT instead of INT. Closes #2060.

* #2053 sp_BlitzIndex ignoring databases (#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes #2053.

* #2022 sp_BlitzCache disabling air_quote_actuals (#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes #2022.

* #2044 sp_Blitz new power mode (#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes #2044.

* #2062 sp_BlitzFirst false alarm on index reorgs (#2091)

Filtering for sql_text not like %alter index%'. Closes #2062 with duct tape.

* #2052 sp_BlitzCache prioritization (#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes #2052.

* #2070 sp_BlitzCache duplicated index count (#2093)

Filters index recommendations by spid. Closes #2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.

* #2097 sp_DatabaseRestore sysname caps (#2100)

Change from uppercase to lowercase for case-sensitive systems. Closes #2097.

* Issue 2063 selects with writes (#2101)

* Update sp_BlitzCache.sql

Adds check for selects that cause writes.

* Update BC docs

Adds a line to the documentation for BlitzCache, tidies up warning table message.

* Fix compression query perf (#2103)

Breaking this up into #temp tables has made it much faster on servers with many partitions.

* Issue 2051 query hash sort (#2102)

* Add query hash sort order

Grabs top10 highest cpu consuming plans with highest count of query hashes (multiple plans), and runs BlitsCache to find them.

* add a word

why not?

* Tweaks for query hash

* URL housekeeping (#2098)

* New Zealand is a real place and it's offensive for you to suggest otherwise 🥝

* revert edits to Install* scripts

* #2111 sp_BlitzCache missing union all (#2112)

Cleans up the documentation, closes #2111.

* Added Uninstaller Script (#2105)

* Added Uninstaller Script

Fulfills request #2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Remove stray semicolon (#2115)

Closes #2114 

Semicolon throws syntax error.

* Fix roll up where clause (#2116)

Closes #2113 

Where clause should only look at flagged lines.

* #2096 sp_BlitzFirst BST compatibility (#2117)

Not really about BST, heh, but just using the wrong date/time format. Closes #2096.

* 2109_sp_BlitzCache_AirQuoteActuals (#2118)

If the AirQuoteActual plan is longer than the regular plan, use it. Closes #2109.

* #2119 2019-09 release prep (#2120)

Bumping version numbers, dates, install scripts. Closes #2119.
BrentOzar added a commit that referenced this pull request Oct 24, 2019
* #2005 sp_Blitz version numbers (#2006)

Working on #2005.

* #2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes #2005.

* #2010 sp_Blitz paused online index operations (#2011)

Add warning for rows in sys.index_resumable_operations. Closes #2010.

* Fix collation error. (#2014)

* #2015 sp_BlitzCache sorting in Azure SQL DB (#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes #2015.

* #2024 sp_BlitzQueryStore s.is_cursor error (#2025)

Changed alias on a temp table to match other nearby aliases. Closes #2024.

* First responder consistency check (#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* #1994 sp_Blitz version checking (#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes #1994.

* #1944 sp_BlitzIndex ignore databases (#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes #1944.

* #2009 sp_BlitzFirst call BC differently (#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes #2009.

* #2026 sp_BlitzCache show multiple plan count (#2031)

Closes #2026.

* #2017 sp_Blitz Evaluation Edition expiration check (#2032)

Closes #2017.

* #2018 sp_BlitzCache arith overflow (#2033)

Changing MONEY on totals to BIGINT. Closes #2018.

* #2019 sp_BlitzCache air_quote_actual plans (#2034)

Closes #2019.

* Add END in the right spot for IF @Help = 1 (#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* #2037 sp_BlitzLock support for AWS RDS (#2038)

Skips update stats with options that RDS doesn't support. Closes #2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (#2040)

* #2042 implicit transaction troubleshooting (#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes #2042.

* edit hyperlink (#2056)

* add @OutputType = 'XML' (#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue #2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* #2067 Updating directory "/" fixing to work with URLs (#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* #2076 sp_BlitzIndex columnstore to table (#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes #2076.

* @2060 sp_BlitzFirst 2TB RAM (#2086)

Casting RAM as a BIGINT instead of INT. Closes #2060.

* #2053 sp_BlitzIndex ignoring databases (#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes #2053.

* #2022 sp_BlitzCache disabling air_quote_actuals (#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes #2022.

* #2044 sp_Blitz new power mode (#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes #2044.

* #2062 sp_BlitzFirst false alarm on index reorgs (#2091)

Filtering for sql_text not like %alter index%'. Closes #2062 with duct tape.

* #2052 sp_BlitzCache prioritization (#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes #2052.

* #2070 sp_BlitzCache duplicated index count (#2093)

Filters index recommendations by spid. Closes #2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.

* #2097 sp_DatabaseRestore sysname caps (#2100)

Change from uppercase to lowercase for case-sensitive systems. Closes #2097.

* Issue 2063 selects with writes (#2101)

* Update sp_BlitzCache.sql

Adds check for selects that cause writes.

* Update BC docs

Adds a line to the documentation for BlitzCache, tidies up warning table message.

* Fix compression query perf (#2103)

Breaking this up into #temp tables has made it much faster on servers with many partitions.

* Issue 2051 query hash sort (#2102)

* Add query hash sort order

Grabs top10 highest cpu consuming plans with highest count of query hashes (multiple plans), and runs BlitsCache to find them.

* add a word

why not?

* Tweaks for query hash

* URL housekeeping (#2098)

* New Zealand is a real place and it's offensive for you to suggest otherwise 🥝

* revert edits to Install* scripts

* #2111 sp_BlitzCache missing union all (#2112)

Cleans up the documentation, closes #2111.

* Added Uninstaller Script (#2105)

* Added Uninstaller Script

Fulfills request #2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Remove stray semicolon (#2115)

Closes #2114 

Semicolon throws syntax error.

* Fix roll up where clause (#2116)

Closes #2113 

Where clause should only look at flagged lines.

* #2096 sp_BlitzFirst BST compatibility (#2117)

Not really about BST, heh, but just using the wrong date/time format. Closes #2096.

* 2109_sp_BlitzCache_AirQuoteActuals (#2118)

If the AirQuoteActual plan is longer than the regular plan, use it. Closes #2109.

* #2119 2019-09 release prep (#2120)

Bumping version numbers, dates, install scripts. Closes #2119.

* #2122 deprecating sp_foreachdb (#2123)

Moving into the deprecated folder. Closes #2122.

* #2124 Fix BlitzQueryStore Edition Check Comparison (#2125)

* Issue 2127/fvanderhaegen (#2129)

* #2127 sp_DatabaseRestore added parameters

Blocksize, buffercount and maxtransfersize are added

* Update sp_DatabaseRestore.sql

* Update sp_BlitzIndex.sql (#2126)

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* #2130 sp_Blitz blocked due to DMV bug (#2131)

Added new SkipBlockingChecks parameter. Closes #2130.

* Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3. (#2133)

* Update sp_BlitzIndex.sql

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* Update sp_BlitzIndex.sql

Fix Conversion failed when converting the varchar value 'x' to data type int.

* #2135 sp_BlitzFirst log message dates (#2138)

Closes #2135.

* #2136 Fix BlitzQS DB Name Comparison for Query Store Check. (#2137)

* #2141 sp_Blitz UNC backup check (#2142)

Closes #2141.

* #2143 sp_BlitzIndex missing index sort (#2144)

Now ignores the old is_low column. Closes #2143.

* corrected fix for issue #2149 (#2151)

* fix for issue #2149

unused heaps were reported as used, see #2149

* corrected fix for issue #2149

* README.md clarifying StopAt parameter

Clarifying sp_DatabaseRestore's StopAt parameter for #2152.

* #2156 sp_BlitzCache query hash sorting (#2157)

Can now sort by query hash plus a second sort field, and avoids calling the proc again. Closes #2156.

* #2147 sp_BlitzLock in local time (#2158)

Filters & displays local time instead of UTC. Closes #2147.

* #2159 sp_BlitzFirst calling sp_BlitzWho (#2160)

Fixes a few different related bugs - see the issue for details. Closes #2159.

* #2155 sp_BlitzFirst adding SkipAnalysis param (#2161)

Passes BlitzCacheSkipAnalysis parameter to sp_BlitzCache. Closes #2155.

* #2162 add JoinKey columns to output tables (#2163)

Closes #2162.

* #2164 sp_BlitzFirst prepping BlitzCache joins (#2165)

Adding query hash to outputs to join to sp_BlitzCache data. Also updating 2017 Hekaton counters while I'm in here. Closes #2162.

* #2166 sp_BlitzWho alter table order (#2167)

Create the table, THEN alter it, you moron. Closes #2166.

* #2168 sp_BlitzCache MinutesBack (#2171)

Now works with SortOrder = 'all'. Closes #2168.

* #2170 sp_BlitzCache SortOrder All Dupes (#2173)

Plans from the SortOrder = 'spills' were being classified as 'memory grant'. Closes #2170.

* Updating README.md for SortOrder = all

Clarifying how sp_BlitzCache SortOrder All works. Related to #2170.

* 2019-10 Release

Bumping version numbers.
BrentOzar added a commit that referenced this pull request Dec 2, 2019
* #2005 sp_Blitz version numbers (#2006)

Working on #2005.

* #2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes #2005.

* #2010 sp_Blitz paused online index operations (#2011)

Add warning for rows in sys.index_resumable_operations. Closes #2010.

* Fix collation error. (#2014)

* #2015 sp_BlitzCache sorting in Azure SQL DB (#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes #2015.

* #2024 sp_BlitzQueryStore s.is_cursor error (#2025)

Changed alias on a temp table to match other nearby aliases. Closes #2024.

* First responder consistency check (#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* #1994 sp_Blitz version checking (#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes #1994.

* #1944 sp_BlitzIndex ignore databases (#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes #1944.

* #2009 sp_BlitzFirst call BC differently (#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes #2009.

* #2026 sp_BlitzCache show multiple plan count (#2031)

Closes #2026.

* #2017 sp_Blitz Evaluation Edition expiration check (#2032)

Closes #2017.

* #2018 sp_BlitzCache arith overflow (#2033)

Changing MONEY on totals to BIGINT. Closes #2018.

* #2019 sp_BlitzCache air_quote_actual plans (#2034)

Closes #2019.

* Add END in the right spot for IF @Help = 1 (#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* #2037 sp_BlitzLock support for AWS RDS (#2038)

Skips update stats with options that RDS doesn't support. Closes #2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (#2040)

* #2042 implicit transaction troubleshooting (#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes #2042.

* edit hyperlink (#2056)

* add @OutputType = 'XML' (#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue #2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* #2067 Updating directory "/" fixing to work with URLs (#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* #2076 sp_BlitzIndex columnstore to table (#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes #2076.

* @2060 sp_BlitzFirst 2TB RAM (#2086)

Casting RAM as a BIGINT instead of INT. Closes #2060.

* #2053 sp_BlitzIndex ignoring databases (#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes #2053.

* #2022 sp_BlitzCache disabling air_quote_actuals (#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes #2022.

* #2044 sp_Blitz new power mode (#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes #2044.

* #2062 sp_BlitzFirst false alarm on index reorgs (#2091)

Filtering for sql_text not like %alter index%'. Closes #2062 with duct tape.

* #2052 sp_BlitzCache prioritization (#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes #2052.

* #2070 sp_BlitzCache duplicated index count (#2093)

Filters index recommendations by spid. Closes #2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.

* #2097 sp_DatabaseRestore sysname caps (#2100)

Change from uppercase to lowercase for case-sensitive systems. Closes #2097.

* Issue 2063 selects with writes (#2101)

* Update sp_BlitzCache.sql

Adds check for selects that cause writes.

* Update BC docs

Adds a line to the documentation for BlitzCache, tidies up warning table message.

* Fix compression query perf (#2103)

Breaking this up into #temp tables has made it much faster on servers with many partitions.

* Issue 2051 query hash sort (#2102)

* Add query hash sort order

Grabs top10 highest cpu consuming plans with highest count of query hashes (multiple plans), and runs BlitsCache to find them.

* add a word

why not?

* Tweaks for query hash

* URL housekeeping (#2098)

* New Zealand is a real place and it's offensive for you to suggest otherwise 🥝

* revert edits to Install* scripts

* #2111 sp_BlitzCache missing union all (#2112)

Cleans up the documentation, closes #2111.

* Added Uninstaller Script (#2105)

* Added Uninstaller Script

Fulfills request #2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Remove stray semicolon (#2115)

Closes #2114 

Semicolon throws syntax error.

* Fix roll up where clause (#2116)

Closes #2113 

Where clause should only look at flagged lines.

* #2096 sp_BlitzFirst BST compatibility (#2117)

Not really about BST, heh, but just using the wrong date/time format. Closes #2096.

* 2109_sp_BlitzCache_AirQuoteActuals (#2118)

If the AirQuoteActual plan is longer than the regular plan, use it. Closes #2109.

* #2119 2019-09 release prep (#2120)

Bumping version numbers, dates, install scripts. Closes #2119.

* #2122 deprecating sp_foreachdb (#2123)

Moving into the deprecated folder. Closes #2122.

* #2124 Fix BlitzQueryStore Edition Check Comparison (#2125)

* Issue 2127/fvanderhaegen (#2129)

* #2127 sp_DatabaseRestore added parameters

Blocksize, buffercount and maxtransfersize are added

* Update sp_DatabaseRestore.sql

* Update sp_BlitzIndex.sql (#2126)

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* #2130 sp_Blitz blocked due to DMV bug (#2131)

Added new SkipBlockingChecks parameter. Closes #2130.

* Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3. (#2133)

* Update sp_BlitzIndex.sql

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* Update sp_BlitzIndex.sql

Fix Conversion failed when converting the varchar value 'x' to data type int.

* #2135 sp_BlitzFirst log message dates (#2138)

Closes #2135.

* #2136 Fix BlitzQS DB Name Comparison for Query Store Check. (#2137)

* #2141 sp_Blitz UNC backup check (#2142)

Closes #2141.

* #2143 sp_BlitzIndex missing index sort (#2144)

Now ignores the old is_low column. Closes #2143.

* corrected fix for issue #2149 (#2151)

* fix for issue #2149

unused heaps were reported as used, see #2149

* corrected fix for issue #2149

* README.md clarifying StopAt parameter

Clarifying sp_DatabaseRestore's StopAt parameter for #2152.

* #2156 sp_BlitzCache query hash sorting (#2157)

Can now sort by query hash plus a second sort field, and avoids calling the proc again. Closes #2156.

* #2147 sp_BlitzLock in local time (#2158)

Filters & displays local time instead of UTC. Closes #2147.

* #2159 sp_BlitzFirst calling sp_BlitzWho (#2160)

Fixes a few different related bugs - see the issue for details. Closes #2159.

* #2155 sp_BlitzFirst adding SkipAnalysis param (#2161)

Passes BlitzCacheSkipAnalysis parameter to sp_BlitzCache. Closes #2155.

* #2162 add JoinKey columns to output tables (#2163)

Closes #2162.

* #2164 sp_BlitzFirst prepping BlitzCache joins (#2165)

Adding query hash to outputs to join to sp_BlitzCache data. Also updating 2017 Hekaton counters while I'm in here. Closes #2162.

* #2166 sp_BlitzWho alter table order (#2167)

Create the table, THEN alter it, you moron. Closes #2166.

* #2168 sp_BlitzCache MinutesBack (#2171)

Now works with SortOrder = 'all'. Closes #2168.

* #2170 sp_BlitzCache SortOrder All Dupes (#2173)

Plans from the SortOrder = 'spills' were being classified as 'memory grant'. Closes #2170.

* Updating README.md for SortOrder = all

Clarifying how sp_BlitzCache SortOrder All works. Related to #2170.

* 2019-10 Release

Bumping version numbers.

* #2190 update readme (#2192)

To show sp_BlitzIndex support for OutputTableName is only for Mode = 2. Closes #2190.

* Various Typo Fixes (#2186)

* Added Uninstaller Script

Fulfills request #2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Update SqlServerVersions.sql

Fixes #2181

* Fix Typo in BlitzFirst

FIxes #2184

* Fixed dumb decisions

* Update SqlServerVersions.sql (#2195)

Adding SQL 2019 GDR for #2181.

* #2183 sp_BlitzIndex ginormous index support (#2196)

When logging to table, use MAX data sizes for drop_tsql, create_tsql, index_definition. Closes #2183.

* sp_Blitz - removing sp_foreachdb

Since we no longer need to check whether it's outdated.

* #2177 sp_BlitzIndex add drop T-SQL (#2197)

To table-level output. Closes #2177.

* #2172 sp_BlitzCache BringThePain (#2201)

If you use SortOrder = all and Top > 10, you now have to set BringThePain = 1. Closes #2172.

* sp_BlitzCache tweaks to Unicode string building

* #2203 prepping 2019_12 release (#2204)

Bumping version numbers, dates, building combined installer script. Closes #2203.
BrentOzar added a commit that referenced this pull request Dec 2, 2019
* #2005 sp_Blitz version numbers (#2006)

Working on #2005.

* #2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes #2005.

* #2010 sp_Blitz paused online index operations (#2011)

Add warning for rows in sys.index_resumable_operations. Closes #2010.

* Fix collation error. (#2014)

* #2015 sp_BlitzCache sorting in Azure SQL DB (#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes #2015.

* #2024 sp_BlitzQueryStore s.is_cursor error (#2025)

Changed alias on a temp table to match other nearby aliases. Closes #2024.

* First responder consistency check (#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* #1994 sp_Blitz version checking (#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes #1994.

* #1944 sp_BlitzIndex ignore databases (#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes #1944.

* #2009 sp_BlitzFirst call BC differently (#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes #2009.

* #2026 sp_BlitzCache show multiple plan count (#2031)

Closes #2026.

* #2017 sp_Blitz Evaluation Edition expiration check (#2032)

Closes #2017.

* #2018 sp_BlitzCache arith overflow (#2033)

Changing MONEY on totals to BIGINT. Closes #2018.

* #2019 sp_BlitzCache air_quote_actual plans (#2034)

Closes #2019.

* Add END in the right spot for IF @Help = 1 (#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* #2037 sp_BlitzLock support for AWS RDS (#2038)

Skips update stats with options that RDS doesn't support. Closes #2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (#2040)

* #2042 implicit transaction troubleshooting (#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes #2042.

* edit hyperlink (#2056)

* add @OutputType = 'XML' (#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue #2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* #2067 Updating directory "/" fixing to work with URLs (#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* #2076 sp_BlitzIndex columnstore to table (#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes #2076.

* @2060 sp_BlitzFirst 2TB RAM (#2086)

Casting RAM as a BIGINT instead of INT. Closes #2060.

* #2053 sp_BlitzIndex ignoring databases (#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes #2053.

* #2022 sp_BlitzCache disabling air_quote_actuals (#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes #2022.

* #2044 sp_Blitz new power mode (#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes #2044.

* #2062 sp_BlitzFirst false alarm on index reorgs (#2091)

Filtering for sql_text not like %alter index%'. Closes #2062 with duct tape.

* #2052 sp_BlitzCache prioritization (#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes #2052.

* #2070 sp_BlitzCache duplicated index count (#2093)

Filters index recommendations by spid. Closes #2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.

* #2097 sp_DatabaseRestore sysname caps (#2100)

Change from uppercase to lowercase for case-sensitive systems. Closes #2097.

* Issue 2063 selects with writes (#2101)

* Update sp_BlitzCache.sql

Adds check for selects that cause writes.

* Update BC docs

Adds a line to the documentation for BlitzCache, tidies up warning table message.

* Fix compression query perf (#2103)

Breaking this up into #temp tables has made it much faster on servers with many partitions.

* Issue 2051 query hash sort (#2102)

* Add query hash sort order

Grabs top10 highest cpu consuming plans with highest count of query hashes (multiple plans), and runs BlitsCache to find them.

* add a word

why not?

* Tweaks for query hash

* URL housekeeping (#2098)

* New Zealand is a real place and it's offensive for you to suggest otherwise 🥝

* revert edits to Install* scripts

* #2111 sp_BlitzCache missing union all (#2112)

Cleans up the documentation, closes #2111.

* Added Uninstaller Script (#2105)

* Added Uninstaller Script

Fulfills request #2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Remove stray semicolon (#2115)

Closes #2114 

Semicolon throws syntax error.

* Fix roll up where clause (#2116)

Closes #2113 

Where clause should only look at flagged lines.

* #2096 sp_BlitzFirst BST compatibility (#2117)

Not really about BST, heh, but just using the wrong date/time format. Closes #2096.

* 2109_sp_BlitzCache_AirQuoteActuals (#2118)

If the AirQuoteActual plan is longer than the regular plan, use it. Closes #2109.

* #2119 2019-09 release prep (#2120)

Bumping version numbers, dates, install scripts. Closes #2119.

* #2122 deprecating sp_foreachdb (#2123)

Moving into the deprecated folder. Closes #2122.

* #2124 Fix BlitzQueryStore Edition Check Comparison (#2125)

* Issue 2127/fvanderhaegen (#2129)

* #2127 sp_DatabaseRestore added parameters

Blocksize, buffercount and maxtransfersize are added

* Update sp_DatabaseRestore.sql

* Update sp_BlitzIndex.sql (#2126)

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* #2130 sp_Blitz blocked due to DMV bug (#2131)

Added new SkipBlockingChecks parameter. Closes #2130.

* Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3. (#2133)

* Update sp_BlitzIndex.sql

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* Update sp_BlitzIndex.sql

Fix Conversion failed when converting the varchar value 'x' to data type int.

* #2135 sp_BlitzFirst log message dates (#2138)

Closes #2135.

* #2136 Fix BlitzQS DB Name Comparison for Query Store Check. (#2137)

* #2141 sp_Blitz UNC backup check (#2142)

Closes #2141.

* #2143 sp_BlitzIndex missing index sort (#2144)

Now ignores the old is_low column. Closes #2143.

* corrected fix for issue #2149 (#2151)

* fix for issue #2149

unused heaps were reported as used, see #2149

* corrected fix for issue #2149

* README.md clarifying StopAt parameter

Clarifying sp_DatabaseRestore's StopAt parameter for #2152.

* #2156 sp_BlitzCache query hash sorting (#2157)

Can now sort by query hash plus a second sort field, and avoids calling the proc again. Closes #2156.

* #2147 sp_BlitzLock in local time (#2158)

Filters & displays local time instead of UTC. Closes #2147.

* #2159 sp_BlitzFirst calling sp_BlitzWho (#2160)

Fixes a few different related bugs - see the issue for details. Closes #2159.

* #2155 sp_BlitzFirst adding SkipAnalysis param (#2161)

Passes BlitzCacheSkipAnalysis parameter to sp_BlitzCache. Closes #2155.

* #2162 add JoinKey columns to output tables (#2163)

Closes #2162.

* #2164 sp_BlitzFirst prepping BlitzCache joins (#2165)

Adding query hash to outputs to join to sp_BlitzCache data. Also updating 2017 Hekaton counters while I'm in here. Closes #2162.

* #2166 sp_BlitzWho alter table order (#2167)

Create the table, THEN alter it, you moron. Closes #2166.

* #2168 sp_BlitzCache MinutesBack (#2171)

Now works with SortOrder = 'all'. Closes #2168.

* #2170 sp_BlitzCache SortOrder All Dupes (#2173)

Plans from the SortOrder = 'spills' were being classified as 'memory grant'. Closes #2170.

* Updating README.md for SortOrder = all

Clarifying how sp_BlitzCache SortOrder All works. Related to #2170.

* 2019-10 Release

Bumping version numbers.

* #2190 update readme (#2192)

To show sp_BlitzIndex support for OutputTableName is only for Mode = 2. Closes #2190.

* Various Typo Fixes (#2186)

* Added Uninstaller Script

Fulfills request #2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Update SqlServerVersions.sql

Fixes #2181

* Fix Typo in BlitzFirst

FIxes #2184

* Fixed dumb decisions

* Update SqlServerVersions.sql (#2195)

Adding SQL 2019 GDR for #2181.

* #2183 sp_BlitzIndex ginormous index support (#2196)

When logging to table, use MAX data sizes for drop_tsql, create_tsql, index_definition. Closes #2183.

* sp_Blitz - removing sp_foreachdb

Since we no longer need to check whether it's outdated.

* #2177 sp_BlitzIndex add drop T-SQL (#2197)

To table-level output. Closes #2177.

* #2172 sp_BlitzCache BringThePain (#2201)

If you use SortOrder = all and Top > 10, you now have to set BringThePain = 1. Closes #2172.

* sp_BlitzCache tweaks to Unicode string building

* #2203 prepping 2019_12 release (#2204)

Bumping version numbers, dates, building combined installer script. Closes #2203.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Dec 26, 2019
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Dec 26, 2019
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Dec 26, 2019
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.

* BrentOzarULTD#2097 sp_DatabaseRestore sysname caps (BrentOzarULTD#2100)

Change from uppercase to lowercase for case-sensitive systems. Closes BrentOzarULTD#2097.

* Issue 2063 selects with writes (BrentOzarULTD#2101)

* Update sp_BlitzCache.sql

Adds check for selects that cause writes.

* Update BC docs

Adds a line to the documentation for BlitzCache, tidies up warning table message.

* Fix compression query perf (BrentOzarULTD#2103)

Breaking this up into #temp tables has made it much faster on servers with many partitions.

* Issue 2051 query hash sort (BrentOzarULTD#2102)

* Add query hash sort order

Grabs top10 highest cpu consuming plans with highest count of query hashes (multiple plans), and runs BlitsCache to find them.

* add a word

why not?

* Tweaks for query hash

* URL housekeeping (BrentOzarULTD#2098)

* New Zealand is a real place and it's offensive for you to suggest otherwise 🥝

* revert edits to Install* scripts

* BrentOzarULTD#2111 sp_BlitzCache missing union all (BrentOzarULTD#2112)

Cleans up the documentation, closes BrentOzarULTD#2111.

* Added Uninstaller Script (BrentOzarULTD#2105)

* Added Uninstaller Script

Fulfills request BrentOzarULTD#2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Remove stray semicolon (BrentOzarULTD#2115)

Closes BrentOzarULTD#2114 

Semicolon throws syntax error.

* Fix roll up where clause (BrentOzarULTD#2116)

Closes BrentOzarULTD#2113 

Where clause should only look at flagged lines.

* BrentOzarULTD#2096 sp_BlitzFirst BST compatibility (BrentOzarULTD#2117)

Not really about BST, heh, but just using the wrong date/time format. Closes BrentOzarULTD#2096.

* 2109_sp_BlitzCache_AirQuoteActuals (BrentOzarULTD#2118)

If the AirQuoteActual plan is longer than the regular plan, use it. Closes BrentOzarULTD#2109.

* BrentOzarULTD#2119 2019-09 release prep (BrentOzarULTD#2120)

Bumping version numbers, dates, install scripts. Closes BrentOzarULTD#2119.

* BrentOzarULTD#2122 deprecating sp_foreachdb (BrentOzarULTD#2123)

Moving into the deprecated folder. Closes BrentOzarULTD#2122.

* BrentOzarULTD#2124 Fix BlitzQueryStore Edition Check Comparison (BrentOzarULTD#2125)

* Issue 2127/fvanderhaegen (BrentOzarULTD#2129)

* BrentOzarULTD#2127 sp_DatabaseRestore added parameters

Blocksize, buffercount and maxtransfersize are added

* Update sp_DatabaseRestore.sql

* Update sp_BlitzIndex.sql (BrentOzarULTD#2126)

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* BrentOzarULTD#2130 sp_Blitz blocked due to DMV bug (BrentOzarULTD#2131)

Added new SkipBlockingChecks parameter. Closes BrentOzarULTD#2130.

* Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3. (BrentOzarULTD#2133)

* Update sp_BlitzIndex.sql

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* Update sp_BlitzIndex.sql

Fix Conversion failed when converting the varchar value 'x' to data type int.

* BrentOzarULTD#2135 sp_BlitzFirst log message dates (BrentOzarULTD#2138)

Closes BrentOzarULTD#2135.

* BrentOzarULTD#2136 Fix BlitzQS DB Name Comparison for Query Store Check. (BrentOzarULTD#2137)

* BrentOzarULTD#2141 sp_Blitz UNC backup check (BrentOzarULTD#2142)

Closes BrentOzarULTD#2141.

* BrentOzarULTD#2143 sp_BlitzIndex missing index sort (BrentOzarULTD#2144)

Now ignores the old is_low column. Closes BrentOzarULTD#2143.

* corrected fix for issue BrentOzarULTD#2149 (BrentOzarULTD#2151)

* fix for issue BrentOzarULTD#2149

unused heaps were reported as used, see BrentOzarULTD#2149

* corrected fix for issue BrentOzarULTD#2149

* README.md clarifying StopAt parameter

Clarifying sp_DatabaseRestore's StopAt parameter for BrentOzarULTD#2152.

* BrentOzarULTD#2156 sp_BlitzCache query hash sorting (BrentOzarULTD#2157)

Can now sort by query hash plus a second sort field, and avoids calling the proc again. Closes BrentOzarULTD#2156.

* BrentOzarULTD#2147 sp_BlitzLock in local time (BrentOzarULTD#2158)

Filters & displays local time instead of UTC. Closes BrentOzarULTD#2147.

* BrentOzarULTD#2159 sp_BlitzFirst calling sp_BlitzWho (BrentOzarULTD#2160)

Fixes a few different related bugs - see the issue for details. Closes BrentOzarULTD#2159.

* BrentOzarULTD#2155 sp_BlitzFirst adding SkipAnalysis param (BrentOzarULTD#2161)

Passes BlitzCacheSkipAnalysis parameter to sp_BlitzCache. Closes BrentOzarULTD#2155.

* BrentOzarULTD#2162 add JoinKey columns to output tables (BrentOzarULTD#2163)

Closes BrentOzarULTD#2162.

* BrentOzarULTD#2164 sp_BlitzFirst prepping BlitzCache joins (BrentOzarULTD#2165)

Adding query hash to outputs to join to sp_BlitzCache data. Also updating 2017 Hekaton counters while I'm in here. Closes BrentOzarULTD#2162.

* BrentOzarULTD#2166 sp_BlitzWho alter table order (BrentOzarULTD#2167)

Create the table, THEN alter it, you moron. Closes BrentOzarULTD#2166.

* BrentOzarULTD#2168 sp_BlitzCache MinutesBack (BrentOzarULTD#2171)

Now works with SortOrder = 'all'. Closes BrentOzarULTD#2168.

* BrentOzarULTD#2170 sp_BlitzCache SortOrder All Dupes (BrentOzarULTD#2173)

Plans from the SortOrder = 'spills' were being classified as 'memory grant'. Closes BrentOzarULTD#2170.

* Updating README.md for SortOrder = all

Clarifying how sp_BlitzCache SortOrder All works. Related to BrentOzarULTD#2170.

* 2019-10 Release

Bumping version numbers.

* BrentOzarULTD#2190 update readme (BrentOzarULTD#2192)

To show sp_BlitzIndex support for OutputTableName is only for Mode = 2. Closes BrentOzarULTD#2190.

* Various Typo Fixes (BrentOzarULTD#2186)

* Added Uninstaller Script

Fulfills request BrentOzarULTD#2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Update SqlServerVersions.sql

Fixes BrentOzarULTD#2181

* Fix Typo in BlitzFirst

FIxes BrentOzarULTD#2184

* Fixed dumb decisions

* Update SqlServerVersions.sql (BrentOzarULTD#2195)

Adding SQL 2019 GDR for BrentOzarULTD#2181.

* BrentOzarULTD#2183 sp_BlitzIndex ginormous index support (BrentOzarULTD#2196)

When logging to table, use MAX data sizes for drop_tsql, create_tsql, index_definition. Closes BrentOzarULTD#2183.

* sp_Blitz - removing sp_foreachdb

Since we no longer need to check whether it's outdated.

* BrentOzarULTD#2177 sp_BlitzIndex add drop T-SQL (BrentOzarULTD#2197)

To table-level output. Closes BrentOzarULTD#2177.

* BrentOzarULTD#2172 sp_BlitzCache BringThePain (BrentOzarULTD#2201)

If you use SortOrder = all and Top > 10, you now have to set BringThePain = 1. Closes BrentOzarULTD#2172.

* sp_BlitzCache tweaks to Unicode string building

* BrentOzarULTD#2203 prepping 2019_12 release (BrentOzarULTD#2204)

Bumping version numbers, dates, building combined installer script. Closes BrentOzarULTD#2203.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Dec 26, 2019
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Dec 26, 2019
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Dec 26, 2019
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Dec 26, 2019
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Jan 8, 2020
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Jan 8, 2020
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Jan 8, 2020
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.

* BrentOzarULTD#2097 sp_DatabaseRestore sysname caps (BrentOzarULTD#2100)

Change from uppercase to lowercase for case-sensitive systems. Closes BrentOzarULTD#2097.

* Issue 2063 selects with writes (BrentOzarULTD#2101)

* Update sp_BlitzCache.sql

Adds check for selects that cause writes.

* Update BC docs

Adds a line to the documentation for BlitzCache, tidies up warning table message.

* Fix compression query perf (BrentOzarULTD#2103)

Breaking this up into #temp tables has made it much faster on servers with many partitions.

* Issue 2051 query hash sort (BrentOzarULTD#2102)

* Add query hash sort order

Grabs top10 highest cpu consuming plans with highest count of query hashes (multiple plans), and runs BlitsCache to find them.

* add a word

why not?

* Tweaks for query hash

* URL housekeeping (BrentOzarULTD#2098)

* New Zealand is a real place and it's offensive for you to suggest otherwise 🥝

* revert edits to Install* scripts

* BrentOzarULTD#2111 sp_BlitzCache missing union all (BrentOzarULTD#2112)

Cleans up the documentation, closes BrentOzarULTD#2111.

* Added Uninstaller Script (BrentOzarULTD#2105)

* Added Uninstaller Script

Fulfills request BrentOzarULTD#2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Remove stray semicolon (BrentOzarULTD#2115)

Closes BrentOzarULTD#2114 

Semicolon throws syntax error.

* Fix roll up where clause (BrentOzarULTD#2116)

Closes BrentOzarULTD#2113 

Where clause should only look at flagged lines.

* BrentOzarULTD#2096 sp_BlitzFirst BST compatibility (BrentOzarULTD#2117)

Not really about BST, heh, but just using the wrong date/time format. Closes BrentOzarULTD#2096.

* 2109_sp_BlitzCache_AirQuoteActuals (BrentOzarULTD#2118)

If the AirQuoteActual plan is longer than the regular plan, use it. Closes BrentOzarULTD#2109.

* BrentOzarULTD#2119 2019-09 release prep (BrentOzarULTD#2120)

Bumping version numbers, dates, install scripts. Closes BrentOzarULTD#2119.

* BrentOzarULTD#2122 deprecating sp_foreachdb (BrentOzarULTD#2123)

Moving into the deprecated folder. Closes BrentOzarULTD#2122.

* BrentOzarULTD#2124 Fix BlitzQueryStore Edition Check Comparison (BrentOzarULTD#2125)

* Issue 2127/fvanderhaegen (BrentOzarULTD#2129)

* BrentOzarULTD#2127 sp_DatabaseRestore added parameters

Blocksize, buffercount and maxtransfersize are added

* Update sp_DatabaseRestore.sql

* Update sp_BlitzIndex.sql (BrentOzarULTD#2126)

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* BrentOzarULTD#2130 sp_Blitz blocked due to DMV bug (BrentOzarULTD#2131)

Added new SkipBlockingChecks parameter. Closes BrentOzarULTD#2130.

* Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3. (BrentOzarULTD#2133)

* Update sp_BlitzIndex.sql

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* Update sp_BlitzIndex.sql

Fix Conversion failed when converting the varchar value 'x' to data type int.

* BrentOzarULTD#2135 sp_BlitzFirst log message dates (BrentOzarULTD#2138)

Closes BrentOzarULTD#2135.

* BrentOzarULTD#2136 Fix BlitzQS DB Name Comparison for Query Store Check. (BrentOzarULTD#2137)

* BrentOzarULTD#2141 sp_Blitz UNC backup check (BrentOzarULTD#2142)

Closes BrentOzarULTD#2141.

* BrentOzarULTD#2143 sp_BlitzIndex missing index sort (BrentOzarULTD#2144)

Now ignores the old is_low column. Closes BrentOzarULTD#2143.

* corrected fix for issue BrentOzarULTD#2149 (BrentOzarULTD#2151)

* fix for issue BrentOzarULTD#2149

unused heaps were reported as used, see BrentOzarULTD#2149

* corrected fix for issue BrentOzarULTD#2149

* README.md clarifying StopAt parameter

Clarifying sp_DatabaseRestore's StopAt parameter for BrentOzarULTD#2152.

* BrentOzarULTD#2156 sp_BlitzCache query hash sorting (BrentOzarULTD#2157)

Can now sort by query hash plus a second sort field, and avoids calling the proc again. Closes BrentOzarULTD#2156.

* BrentOzarULTD#2147 sp_BlitzLock in local time (BrentOzarULTD#2158)

Filters & displays local time instead of UTC. Closes BrentOzarULTD#2147.

* BrentOzarULTD#2159 sp_BlitzFirst calling sp_BlitzWho (BrentOzarULTD#2160)

Fixes a few different related bugs - see the issue for details. Closes BrentOzarULTD#2159.

* BrentOzarULTD#2155 sp_BlitzFirst adding SkipAnalysis param (BrentOzarULTD#2161)

Passes BlitzCacheSkipAnalysis parameter to sp_BlitzCache. Closes BrentOzarULTD#2155.

* BrentOzarULTD#2162 add JoinKey columns to output tables (BrentOzarULTD#2163)

Closes BrentOzarULTD#2162.

* BrentOzarULTD#2164 sp_BlitzFirst prepping BlitzCache joins (BrentOzarULTD#2165)

Adding query hash to outputs to join to sp_BlitzCache data. Also updating 2017 Hekaton counters while I'm in here. Closes BrentOzarULTD#2162.

* BrentOzarULTD#2166 sp_BlitzWho alter table order (BrentOzarULTD#2167)

Create the table, THEN alter it, you moron. Closes BrentOzarULTD#2166.

* BrentOzarULTD#2168 sp_BlitzCache MinutesBack (BrentOzarULTD#2171)

Now works with SortOrder = 'all'. Closes BrentOzarULTD#2168.

* BrentOzarULTD#2170 sp_BlitzCache SortOrder All Dupes (BrentOzarULTD#2173)

Plans from the SortOrder = 'spills' were being classified as 'memory grant'. Closes BrentOzarULTD#2170.

* Updating README.md for SortOrder = all

Clarifying how sp_BlitzCache SortOrder All works. Related to BrentOzarULTD#2170.

* 2019-10 Release

Bumping version numbers.

* BrentOzarULTD#2190 update readme (BrentOzarULTD#2192)

To show sp_BlitzIndex support for OutputTableName is only for Mode = 2. Closes BrentOzarULTD#2190.

* Various Typo Fixes (BrentOzarULTD#2186)

* Added Uninstaller Script

Fulfills request BrentOzarULTD#2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Update SqlServerVersions.sql

Fixes BrentOzarULTD#2181

* Fix Typo in BlitzFirst

FIxes BrentOzarULTD#2184

* Fixed dumb decisions

* Update SqlServerVersions.sql (BrentOzarULTD#2195)

Adding SQL 2019 GDR for BrentOzarULTD#2181.

* BrentOzarULTD#2183 sp_BlitzIndex ginormous index support (BrentOzarULTD#2196)

When logging to table, use MAX data sizes for drop_tsql, create_tsql, index_definition. Closes BrentOzarULTD#2183.

* sp_Blitz - removing sp_foreachdb

Since we no longer need to check whether it's outdated.

* BrentOzarULTD#2177 sp_BlitzIndex add drop T-SQL (BrentOzarULTD#2197)

To table-level output. Closes BrentOzarULTD#2177.

* BrentOzarULTD#2172 sp_BlitzCache BringThePain (BrentOzarULTD#2201)

If you use SortOrder = all and Top > 10, you now have to set BringThePain = 1. Closes BrentOzarULTD#2172.

* sp_BlitzCache tweaks to Unicode string building

* BrentOzarULTD#2203 prepping 2019_12 release (BrentOzarULTD#2204)

Bumping version numbers, dates, building combined installer script. Closes BrentOzarULTD#2203.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Jan 9, 2020
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Jan 9, 2020
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Jan 9, 2020
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.

* BrentOzarULTD#2097 sp_DatabaseRestore sysname caps (BrentOzarULTD#2100)

Change from uppercase to lowercase for case-sensitive systems. Closes BrentOzarULTD#2097.

* Issue 2063 selects with writes (BrentOzarULTD#2101)

* Update sp_BlitzCache.sql

Adds check for selects that cause writes.

* Update BC docs

Adds a line to the documentation for BlitzCache, tidies up warning table message.

* Fix compression query perf (BrentOzarULTD#2103)

Breaking this up into #temp tables has made it much faster on servers with many partitions.

* Issue 2051 query hash sort (BrentOzarULTD#2102)

* Add query hash sort order

Grabs top10 highest cpu consuming plans with highest count of query hashes (multiple plans), and runs BlitsCache to find them.

* add a word

why not?

* Tweaks for query hash

* URL housekeeping (BrentOzarULTD#2098)

* New Zealand is a real place and it's offensive for you to suggest otherwise 🥝

* revert edits to Install* scripts

* BrentOzarULTD#2111 sp_BlitzCache missing union all (BrentOzarULTD#2112)

Cleans up the documentation, closes BrentOzarULTD#2111.

* Added Uninstaller Script (BrentOzarULTD#2105)

* Added Uninstaller Script

Fulfills request BrentOzarULTD#2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Remove stray semicolon (BrentOzarULTD#2115)

Closes BrentOzarULTD#2114 

Semicolon throws syntax error.

* Fix roll up where clause (BrentOzarULTD#2116)

Closes BrentOzarULTD#2113 

Where clause should only look at flagged lines.

* BrentOzarULTD#2096 sp_BlitzFirst BST compatibility (BrentOzarULTD#2117)

Not really about BST, heh, but just using the wrong date/time format. Closes BrentOzarULTD#2096.

* 2109_sp_BlitzCache_AirQuoteActuals (BrentOzarULTD#2118)

If the AirQuoteActual plan is longer than the regular plan, use it. Closes BrentOzarULTD#2109.

* BrentOzarULTD#2119 2019-09 release prep (BrentOzarULTD#2120)

Bumping version numbers, dates, install scripts. Closes BrentOzarULTD#2119.

* BrentOzarULTD#2122 deprecating sp_foreachdb (BrentOzarULTD#2123)

Moving into the deprecated folder. Closes BrentOzarULTD#2122.

* BrentOzarULTD#2124 Fix BlitzQueryStore Edition Check Comparison (BrentOzarULTD#2125)

* Issue 2127/fvanderhaegen (BrentOzarULTD#2129)

* BrentOzarULTD#2127 sp_DatabaseRestore added parameters

Blocksize, buffercount and maxtransfersize are added

* Update sp_DatabaseRestore.sql

* Update sp_BlitzIndex.sql (BrentOzarULTD#2126)

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* BrentOzarULTD#2130 sp_Blitz blocked due to DMV bug (BrentOzarULTD#2131)

Added new SkipBlockingChecks parameter. Closes BrentOzarULTD#2130.

* Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3. (BrentOzarULTD#2133)

* Update sp_BlitzIndex.sql

Fix Cannot resolve collation conflict between "Language_A" and "Language_B" in add operator occurring in ORDER BY statement column 3.

* Update sp_BlitzIndex.sql

Fix Conversion failed when converting the varchar value 'x' to data type int.

* BrentOzarULTD#2135 sp_BlitzFirst log message dates (BrentOzarULTD#2138)

Closes BrentOzarULTD#2135.

* BrentOzarULTD#2136 Fix BlitzQS DB Name Comparison for Query Store Check. (BrentOzarULTD#2137)

* BrentOzarULTD#2141 sp_Blitz UNC backup check (BrentOzarULTD#2142)

Closes BrentOzarULTD#2141.

* BrentOzarULTD#2143 sp_BlitzIndex missing index sort (BrentOzarULTD#2144)

Now ignores the old is_low column. Closes BrentOzarULTD#2143.

* corrected fix for issue BrentOzarULTD#2149 (BrentOzarULTD#2151)

* fix for issue BrentOzarULTD#2149

unused heaps were reported as used, see BrentOzarULTD#2149

* corrected fix for issue BrentOzarULTD#2149

* README.md clarifying StopAt parameter

Clarifying sp_DatabaseRestore's StopAt parameter for BrentOzarULTD#2152.

* BrentOzarULTD#2156 sp_BlitzCache query hash sorting (BrentOzarULTD#2157)

Can now sort by query hash plus a second sort field, and avoids calling the proc again. Closes BrentOzarULTD#2156.

* BrentOzarULTD#2147 sp_BlitzLock in local time (BrentOzarULTD#2158)

Filters & displays local time instead of UTC. Closes BrentOzarULTD#2147.

* BrentOzarULTD#2159 sp_BlitzFirst calling sp_BlitzWho (BrentOzarULTD#2160)

Fixes a few different related bugs - see the issue for details. Closes BrentOzarULTD#2159.

* BrentOzarULTD#2155 sp_BlitzFirst adding SkipAnalysis param (BrentOzarULTD#2161)

Passes BlitzCacheSkipAnalysis parameter to sp_BlitzCache. Closes BrentOzarULTD#2155.

* BrentOzarULTD#2162 add JoinKey columns to output tables (BrentOzarULTD#2163)

Closes BrentOzarULTD#2162.

* BrentOzarULTD#2164 sp_BlitzFirst prepping BlitzCache joins (BrentOzarULTD#2165)

Adding query hash to outputs to join to sp_BlitzCache data. Also updating 2017 Hekaton counters while I'm in here. Closes BrentOzarULTD#2162.

* BrentOzarULTD#2166 sp_BlitzWho alter table order (BrentOzarULTD#2167)

Create the table, THEN alter it, you moron. Closes BrentOzarULTD#2166.

* BrentOzarULTD#2168 sp_BlitzCache MinutesBack (BrentOzarULTD#2171)

Now works with SortOrder = 'all'. Closes BrentOzarULTD#2168.

* BrentOzarULTD#2170 sp_BlitzCache SortOrder All Dupes (BrentOzarULTD#2173)

Plans from the SortOrder = 'spills' were being classified as 'memory grant'. Closes BrentOzarULTD#2170.

* Updating README.md for SortOrder = all

Clarifying how sp_BlitzCache SortOrder All works. Related to BrentOzarULTD#2170.

* 2019-10 Release

Bumping version numbers.

* BrentOzarULTD#2190 update readme (BrentOzarULTD#2192)

To show sp_BlitzIndex support for OutputTableName is only for Mode = 2. Closes BrentOzarULTD#2190.

* Various Typo Fixes (BrentOzarULTD#2186)

* Added Uninstaller Script

Fulfills request BrentOzarULTD#2080

Deletes all the FirstResponderKit procedures from the current DB or all DBs via parameter

* Case sensitive collation fixes

Gotta love those case sensitive servers.

* Update SqlServerVersions.sql

Fixes BrentOzarULTD#2181

* Fix Typo in BlitzFirst

FIxes BrentOzarULTD#2184

* Fixed dumb decisions

* Update SqlServerVersions.sql (BrentOzarULTD#2195)

Adding SQL 2019 GDR for BrentOzarULTD#2181.

* BrentOzarULTD#2183 sp_BlitzIndex ginormous index support (BrentOzarULTD#2196)

When logging to table, use MAX data sizes for drop_tsql, create_tsql, index_definition. Closes BrentOzarULTD#2183.

* sp_Blitz - removing sp_foreachdb

Since we no longer need to check whether it's outdated.

* BrentOzarULTD#2177 sp_BlitzIndex add drop T-SQL (BrentOzarULTD#2197)

To table-level output. Closes BrentOzarULTD#2177.

* BrentOzarULTD#2172 sp_BlitzCache BringThePain (BrentOzarULTD#2201)

If you use SortOrder = all and Top > 10, you now have to set BringThePain = 1. Closes BrentOzarULTD#2172.

* sp_BlitzCache tweaks to Unicode string building

* BrentOzarULTD#2203 prepping 2019_12 release (BrentOzarULTD#2204)

Bumping version numbers, dates, building combined installer script. Closes BrentOzarULTD#2203.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Jan 9, 2020
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.
CubsRep pushed a commit to CubsRep/SQL-Server-First-Responder-Kit that referenced this pull request Jan 9, 2020
* BrentOzarULTD#2005 sp_Blitz version numbers (BrentOzarULTD#2006)

Working on BrentOzarULTD#2005.

* BrentOzarULTD#2005 easier merges for versions

Putting Version, VersionDate variables on a single line. Closes BrentOzarULTD#2005.

* BrentOzarULTD#2010 sp_Blitz paused online index operations (BrentOzarULTD#2011)

Add warning for rows in sys.index_resumable_operations. Closes BrentOzarULTD#2010.

* Fix collation error. (BrentOzarULTD#2014)

* BrentOzarULTD#2015 sp_BlitzCache sorting in Azure SQL DB (BrentOzarULTD#2016)

Instead of checking version numbers, look at sys.all_columns for the grant and spill columns. Closes BrentOzarULTD#2015.

* BrentOzarULTD#2024 sp_BlitzQueryStore s.is_cursor error (BrentOzarULTD#2025)

Changed alias on a temp table to match other nearby aliases. Closes BrentOzarULTD#2024.

* First responder consistency check (BrentOzarULTD#1997)

* sp_Blitz update compile and runs on MSSQL 2014

* Update sp_Blitz.sql

Added @debug handling - bug found for missing mandatory component

* Update sp_Blitz.sql

* Update sp_Blitz.sql


CheckId familly:

226 - FRK consistency

Messages:
2260 - First Responder kit consistency check has been unexpectedly modified (check names)
2261 - First Responder kit consistency check has been unexpectedly modified (dynamic query failure)
2262 - First Responder kit mandatory component called %s is missing
2263 - First Responder kit consistency check has been unexpectedly modified (checks ordering)
2264 - Component %s is not at the minimum version required to run this procedure
2265 - First Responder kit consistency check (Failed dynamic SP call to %s)
2266 - First Responder kit consistency: outdated component (%s)

removed "everything ok message"

* Resolves almost all Brent's comments except CHAR(92) change

removed 2264 - Component %s is not at the minimum version required to run this procedure
changed detailled finding message for previous 2264 message

Checked compilation on SQL Server 2014

* BrentOzarULTD#1994 sp_Blitz version checking (BrentOzarULTD#2028)

Changed wording from "consistency check" to "version check," updated check IDs, removed mandatory scripts. Closes BrentOzarULTD#1994.

* BrentOzarULTD#1944 sp_BlitzIndex ignore databases (BrentOzarULTD#2029)

Adds new IgnoreDatabases parameter, and skips databases with >100 partitions. Closes BrentOzarULTD#1944.

* BrentOzarULTD#2009 sp_BlitzFirst call BC differently (BrentOzarULTD#2030)

Use SkipAnalysis = 1, SortOrder = all when calling sp_BlitzCache. Closes BrentOzarULTD#2009.

* BrentOzarULTD#2026 sp_BlitzCache show multiple plan count (BrentOzarULTD#2031)

Closes BrentOzarULTD#2026.

* BrentOzarULTD#2017 sp_Blitz Evaluation Edition expiration check (BrentOzarULTD#2032)

Closes BrentOzarULTD#2017.

* BrentOzarULTD#2018 sp_BlitzCache arith overflow (BrentOzarULTD#2033)

Changing MONEY on totals to BIGINT. Closes BrentOzarULTD#2018.

* BrentOzarULTD#2019 sp_BlitzCache air_quote_actual plans (BrentOzarULTD#2034)

Closes BrentOzarULTD#2019.

* Add END in the right spot for IF @Help = 1 (BrentOzarULTD#2035)

The END for IF @Help = 1 was in the wrong place, making the procedure a no-op *unless* you also specify @Help = 1.

* BrentOzarULTD#2037 sp_BlitzLock support for AWS RDS (BrentOzarULTD#2038)

Skips update stats with options that RDS doesn't support. Closes BrentOzarULTD#2037.

* 2019_04_release_prep

Bumping version numbers, building installation scripts.

* Moved SQL header build outside of If block (BrentOzarULTD#2040)

* BrentOzarULTD#2042 implicit transaction troubleshooting (BrentOzarULTD#2043)

Clarify warnings in sp_Blitz, sp_BlitzFirst. Closes BrentOzarULTD#2042.

* edit hyperlink (BrentOzarULTD#2056)

* add @OutputType = 'XML' (BrentOzarULTD#2048)

* Update sp_blitzcache to avoid arithmetic overflow errors (BrentOzarULTD#2046)

Updated sp_blitzcache to avoid arithmetic overflow errors - tabel definitions had changed to BIGINT but the actual logic in this section still casted values as money which was breaking the ceiling for this on our setup.  I've pretty much blanket chantged everything except averages to be bigint and have been running for a few days with no failrues since so looks ok and worth someone who knows what they're doing casting an eye over it!

* Update sp_ineachdb.sql (BrentOzarULTD#2061)

Added 2 Variables 
@SQLVersion: This was implemented so that large organizations with SQL Server 2008 and R2 can use this sproc.  Currently without this change SQL Server versions 2008 and 2008R2 will error with the following.  Msg 208, Level 16, State 1, Procedure sp_ineachdb, Line 176
Invalid object name 'sys.dm_hadr_database_replica_states'.

@ServerName:  This was added to account for VMware SnapShots at times @@ServerName will either come up NULL or with old server name.  CONVERT(sysname, SERVERPROPERTY('ServerName')) is a better option and reduces minor nuisances.  

Feel free to blend in the code if you feel this brings value to the project.

* ignore readable secondaries in sp_blitzcache (BrentOzarULTD#2049)

* ignore readable secondaries in sp_blitzcache

this is a fix for issue BrentOzarULTD#2027

* Checking for is_primary_replica column

In sys.dm_hadr_database_replica_states.

* 2019_07 Release

Bumping version numbers and updating install scripts.

* Set DBOwner after restoring database (BrentOzarULTD#2082)

* Default @RestoreDiff = NULL
If @RestoreDiff IS NULL and @BackupPathDiff != null: treat RestoreDiff=1

* Set database owner after restore

* Revert restorediff change from dev branch

* Exclude Readable secondary DBs (BrentOzarULTD#2073)

Temp table added (#ReadableDBs) this table is populated with all read intent database id's which is used to filter out these database when querying against dm_exec_requests or sessions with a cross apply against a plan cache function.

* BrentOzarULTD#2067 Updating directory "/" fixing to work with URLs (BrentOzarULTD#2071)

* Updating directory "/" fixing to work with URLs

Also correcting incorrect logging message for fixing @MoveLogDrive slashes

* Fixing variable typo

Data should be log

* BrentOzarULTD#2076 sp_BlitzIndex columnstore to table (BrentOzarULTD#2085)

When saving columnstore definitions to table, trim them to 4000 characters to avoid an overflow. Closes BrentOzarULTD#2076.

* @2060 sp_BlitzFirst 2TB RAM (BrentOzarULTD#2086)

Casting RAM as a BIGINT instead of INT. Closes BrentOzarULTD#2060.

* BrentOzarULTD#2053 sp_BlitzIndex ignoring databases (BrentOzarULTD#2087)

Strip out CR/LF from @IgnoreDatabases, trim spaces afterwards. Closes BrentOzarULTD#2053.

* BrentOzarULTD#2022 sp_BlitzCache disabling air_quote_actuals (BrentOzarULTD#2088)

This SQL 2019 & Azure SQL DB feature isn't ready yet, so disabling til Microsoft is ready. Closes BrentOzarULTD#2022.

* BrentOzarULTD#2044 sp_Blitz new power mode (BrentOzarULTD#2089)

Adds Windows 10's new Ultimate Performance Power Mode, whatever that is. Closes BrentOzarULTD#2044.

* BrentOzarULTD#2062 sp_BlitzFirst false alarm on index reorgs (BrentOzarULTD#2091)

Filtering for sql_text not like %alter index%'. Closes BrentOzarULTD#2062 with duct tape.

* BrentOzarULTD#2052 sp_BlitzCache prioritization (BrentOzarULTD#2092)

Fixes bug in AirQuoteActual plans, plus if plan cache is 75% new as of today, raise priority 1 warning. Closes BrentOzarULTD#2052.

* BrentOzarULTD#2070 sp_BlitzCache duplicated index count (BrentOzarULTD#2093)

Filters index recommendations by spid. Closes BrentOzarULTD#2070.

* sp_DatabaseRestore case bug

Inconsistent case sensitivity.

* 2019-09 release prep

Bumping version numbers and dates.

* 2019-08 release

Updating multi-script installs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sp_BlitzFirst: index reorgs reported as CHECKDB running
1 participant