-
Notifications
You must be signed in to change notification settings - Fork 741
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
usp_AdaptiveIndexDefrag - Error 911 being reported when debug mode = 1 #244
Comments
ran into the same issue today too. After looking into the code I can now see why because the variable @dbname is periodically being assigned its value from respective tbl_Adaptive tables e.g:
Dbname in these tables is stored quoted with square brackets so during the subsequent statement assignments when Quotename is being applied it is being double quoted and SQL cannot recognize the DB name. Example of the double quoting code:
As there are verious places in the code that is expecting the dbname to be quoted I imagine it is probably safer to replace all occurences
With:
It is a little messy but likely to be safer than trying to do the reverse and figuring out what actually needs to be compared against the quoted value and what doesn't as there are mixed cases throughout. I will try and get a version submitted as soon as I get some spare time, but hopefully this helps you in the meantime. |
…square brackets Removed problematic references using square brackets in dynamic SQL commands. This was also causing object names in log tables to also include the square bracket causing non-indexed statistics to fail during statistics update command, since the bracket was considered part of the stats name. Add comment proc @ver number comment inline in usp_AdaptiveIndexDefrag proc to allow users to see what version is deployed on a server.
It's noteworthy that this error in debug-mode means that the actual Update Statistics functionality of the AdaptiveIndexDefrag does not work, at all. That's how I came about finding this issue. So how come that AndrewG2's suggestion to fix this bug hasn't made it to the original repository over the past 3 years? |
Declare @errorno Integer
EXECUTE @errorno=[dbo].[usp_AdaptiveIndexDefrag] @Timelimit=720, @outputresults =1, @debugmode=1,@forceRescan=1
print @errorno
if (@errorno <0 )
RaisError('Error', @errorno,1);
.
.
.
Determining modification row counter for statistic [PK_tblrptRptUser] on table or view [tblrptRptUser] of DB [LTAArchiveDB]...
Using sys.dm_db_stats_properties DMF...
Error 911 has occurred while determining row modification counter. Message: Database '[LTAArchiveDB]' does not exist. Make sure that the name is entered correctly. (Line Number: 1)
Why is the message being outputted with an error?
The text was updated successfully, but these errors were encountered: