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

sp_BlitzLock fails when running with @DatabaseName parameter - fails on line 1762 with 'Error converting data type nvarchar to bigint' #3201

Closed
rjk opened this issue Dec 15, 2022 · 2 comments · Fixed by #3204

Comments

@rjk
Copy link

rjk commented Dec 15, 2022

Looks like the culprit is this line comparing @DatabaseName and database_id:

        AND (dow.database_id = @DatabaseName OR @DatabaseName IS NULL)  

Version of the script
Version = '8.12'
VersionDate = '20221213'

What is the current behavior?

I execute:

exec sp_BlitzLock @DatabaseName = 'master'

I get error output as below. Then I cry into my coffee, unstoppably.

@RDS = 0, updating #t with high row and page counts
@TargetSessionType is NULL, assigning for non-Azure instance
@TargetSessionType assigned as event_file for non-Azure
Grab the initial set of xml to parse at Dec 15 2022 11:06:28:823AM
Finished at Dec 15 2022 11:07:43:700AM
Initial Parse process and input buffer xml Dec 15 2022 11:07:43:700AM
Finished at Dec 15 2022 11:07:43:740AM
Final Parse process and input buffer xml Dec 15 2022 11:07:43:740AM
Finished at Dec 15 2022 11:07:43:863AM
Parse execution stack xml Dec 15 2022 11:07:43:863AM
Finished at Dec 15 2022 11:07:43:883AM
Grab the full resource list Dec 15 2022 11:07:43:883AM
Finished at Dec 15 2022 11:07:44:000AM
Parse object locks Dec 15 2022 11:07:44:000AM
Finished at Dec 15 2022 11:07:44:080AM
Parse page locks Dec 15 2022 11:07:44:080AM
Finished at Dec 15 2022 11:07:44:150AM
Parse key locks Dec 15 2022 11:07:44:150AM
Finished at Dec 15 2022 11:07:44:220AM
Parse RID locks Dec 15 2022 11:07:44:220AM
Finished at Dec 15 2022 11:07:44:283AM
Parse row group locks Dec 15 2022 11:07:44:283AM
Finished at Dec 15 2022 11:07:44:350AM
Fixing heaps in #deadlock_owner_waiter Dec 15 2022 11:07:44:350AM
Finished at Dec 15 2022 11:07:44:350AM
Parse parallel deadlocks Dec 15 2022 11:07:44:353AM
Finished at Dec 15 2022 11:07:44:433AM
Get rid of parallel noise Dec 15 2022 11:07:44:433AM
Finished at Dec 15 2022 11:07:44:437AM
Get rid of nonsense Dec 15 2022 11:07:44:437AM
Finished at Dec 15 2022 11:07:44:440AM
Update some nonsense part 1 Dec 15 2022 11:07:44:443AM
Finished at Dec 15 2022 11:07:44:453AM
Update some nonsense part 2 Dec 15 2022 11:07:44:453AM
Finished at Dec 15 2022 11:07:44:453AM
Get Agent Job and Step names Dec 15 2022 11:07:44:463AM
Finished at Dec 15 2022 11:07:44:507AM
Inserting to @sysAssObjId Dec 15 2022 11:07:44:507AM
Finished at Dec 15 2022 11:07:45:263AM
Check 1  database deadlocks Dec 15 2022 11:07:45:267AM
Finished at Dec 15 2022 11:07:45:267AM
Check 2 select deadlocks Dec 15 2022 11:07:45:270AM
Msg 8114, Level 16, State 5, Procedure sp_blitzlock, Line 1762 [Batch Start Line 0]
Error converting data type nvarchar to bigint.

Completion time: 2022-12-15T11:07:45.3322960+01:00

If the current behavior is a bug, please provide the steps to reproduce.

exec sp_blitzlock @databasename = 'master'

What is the expected behavior?

Happiness and joy, and successful completion.

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?

SQL Server 2019 - 15.0.4261.1

I've not run sp_BlitzLock for ages so not sure how long this has been a problem.

rjk added a commit to rjk/SQL-Server-First-Responder-Kit that referenced this issue Dec 15, 2022
erikdarlingdata added a commit to erikdarlingdata/SQL-Server-First-Responder-Kit that referenced this issue Dec 19, 2022
Fix database name/database id comparisons. Closes BrentOzarULTD#3201
@erikdarlingdata
Copy link
Contributor

Thanks for reporting this. It looks like a find/replace error on my part. It's been corrected in the referenced pull request.

@BrentOzar
Copy link
Member

Makes sense. Merging into the dev branch, will be in the next release with credit to you in the release notes. I'll do a release at the start of Jan just to get this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment