Skip to content

Commit

Permalink
#3356 Fix for xp_readerrorlog
Browse files Browse the repository at this point in the history
  • Loading branch information
Montro1981 committed Sep 26, 2023
1 parent 5e7f4f2 commit fb0d8fd
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions sp_Blitz.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8621,12 +8621,22 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
END
ELSE
BEGIN
INSERT INTO #ErrorLog
EXEC sys.xp_readerrorlog 0, 1, N'Database Instant File Initialization: enabled';
BEGIN TRY
INSERT INTO #ErrorLog
EXEC sys.xp_readerrorlog 0, 1, N'Database Instant File Initialization: enabled';
END TRY
BEGIN CATCH
IF @Debug IN (1, 2) RAISERROR('No permissions to execute xp_readerrorlog.', 0, 1) WITH NOWAIT;
END CATCH
END

IF @@ROWCOUNT > 0
begin
IF EXISTS
(
SELECT 1/0
FROM #ErrorLog
WHERE LEFT([Text], 45) = N'Database Instant File Initialization: enabled'
)
BEGIN
INSERT INTO #BlitzResults
( CheckID ,
[Priority] ,
Expand All @@ -8642,7 +8652,7 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
'Instant File Initialization Enabled' AS [Finding] ,
'https://www.brentozar.com/go/instant' AS [URL] ,
'The service account has the Perform Volume Maintenance Tasks permission.';
end
END;
else -- if version of sql server has instant_file_initialization_enabled column in dm_server_services, check that too
-- in the event the error log has been cycled and the startup messages are not in the current error log
begin
Expand Down

0 comments on commit fb0d8fd

Please sign in to comment.