sqlserver-kit icon indicating copy to clipboard operation
sqlserver-kit copied to clipboard

sp_BlitzInMemoryOLTP Fails to run -- 2 Issues

Open mmcdonald-1 opened this issue 3 years ago • 2 comments

First issue is @VersionDate. It should be '20220718' instead of '202204718'.

The second is the data loaded into #moduleSplit -- the format for the check point files changed from 2017 to 2019. The below correction starts at line 992

`

        /*
        #####################################################
            List *loaded* natively compiled modules in this database, i.e. executed at least 1x
        #####################################################
        */

        /*
            the format for checkpoint files changed from SQL 2014 to SQL 2016

            SQL 2014 format:
            database_id = 5
            object_id = 309576141

            H:\SQLDATA\xtp\5\xtp_p_5_309576141.dll

            SQL 2016+ format
            database_id = 9
            object_id = 1600880920

            H:\SQLDATA\xtp\9\xtp_p_9_1600880920_185048689287400_1.dll

            the following code should handle all versions
        */
        -- NOTE: disabling this for Azure SQL DB
        IF @tableName IS NULL AND @RunningOnAzureSQLDB = 0
        BEGIN
           SELECT @sql =
                CONCAT
                (
                    ';WITH nativeModuleObjectID AS
                     (
                        SELECT DISTINCT REPLACE(value, ''.dll'', '''') AS object_id
                        FROM #moduleSplit
                        WHERE rowNumber % ' 
                 ,CASE WHEN @MSSQLVersion = 12 THEN ' 4 = 0'
--                           ELSE ' 6 = 4'  -- @MSSQLVersion >= 13 
/*Change because 2019 differs from 2016 & 2017*/
			 WHEN @MSSQLVersion IN (13,14) THEN ' 6 = 4'		/*SQL2016 & 2017*/
			 ELSE ' 7 = 5'			/*SQL2019*/
                  END 
                    ,')'
                );

`

Plus two additional changes -- #resultsContainerFileDetails -- sizeGB. The data going in is actually in MB

`

CREATE TABLE #resultsContainerFileDetails 
(
     [object] NVARCHAR(256)
    ,databaseName NVARCHAR(256)
    ,containerName NVARCHAR(256)
    ,container_id BIGINT
    ,fileType NVARCHAR(256)
    ,fileState NVARCHAR(256)
    ,sizeBytes NVARCHAR(256)
    ,sizeMB NVARCHAR(256)            /*Change from sizeGB to sizeMB*/
    ,fileCount INT 
    ,fileGroupState NVARCHAR(256)
);

`

And near 1523 ,FORMAT(ContainerFileDetails.sizeinBytes / 1048576., ''###,###,###'') AS sizeMB /Change from sizeGB/

Originally raised in FRK -- https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/3152

mmcdonald-1 avatar Oct 13 '22 11:10 mmcdonald-1

@mmcdonald-1 Hello, thanks for issue, could you create PR with this changes? I will test it

ktaranov avatar Oct 18 '22 12:10 ktaranov

Will do.

mmcdonald-1 avatar Oct 19 '22 11:10 mmcdonald-1