SQL-Server-First-Responder-Kit icon indicating copy to clipboard operation
SQL-Server-First-Responder-Kit copied to clipboard

sp_BlitzFirst Check 44 in Azure Managed Instance fails with error

Open dmonlineuk opened this issue 3 years ago • 3 comments

Version of the script Version '8.10', VersionDate '20220718'

What is the current behavior? Runs through until check 44 then reports "Database '?' does not exist. Make sure the name is entered correctly."

If the current behavior is a bug, please provide the steps to reproduce. execute sp_BlitzFirst @expertMode = 1 in an Azure MI

What is the expected behavior? No error

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures? New user, so no previous versions tested. I believe Azure MI is in constant state of revision but I think I have a fix:

Unless I am misunderstanding the purpose of the IF...ELSE checks for 'SQL Azure' prior to the population of @StringToExecute and similarly the use of sp_MSForeachdb, shouldn't line 2478 be updated to not include 'USE [?]; '? as it's being appended if required first?

Thank you:-)

dmonlineuk avatar Jul 22 '22 15:07 dmonlineuk

After further testing, the use of sp_MSForeachdb appears to be supported in Azure MI. Maybe " IF SERVERPROPERTY('Edition') <> 'SQL Azure' " is meant to prevent the use of USE in Azure DBs? In which case, along with the change for line 2478, can the lines 2473 and 2522 also be updated as follows: " IF SERVERPROPERTY('EngineEdition') <> ? " (not sure what value to put here yet - I shall return)

dmonlineuk avatar Jul 22 '22 16:07 dmonlineuk

Hi! Sure, you're welcome to put in a pull request. We don't take code contributions here in the issues, so just make sure to read the contributing guide on the home page of the repo. Thanks!

BrentOzar avatar Jul 22 '22 16:07 BrentOzar

Apologies and thanks - I think I've managed to do this correct. - #3130

dmonlineuk avatar Jul 22 '22 17:07 dmonlineuk

Thanks for the pull request! Looks good, merging into the dev branch. Will be in the next release with credit to you in the release notes.

BrentOzar avatar Oct 13 '22 12:10 BrentOzar