Skip to content

Commit

Permalink
Merge pull request #3361 from Montro1981/SQL-Server-First-Responder-K…
Browse files Browse the repository at this point in the history
…it_3356_xp_readerrorlog

#3356 Fix for xp_readerrorlog
  • Loading branch information
BrentOzar authored Oct 10, 2023
2 parents 11a0dd1 + fb0d8fd commit 7c39562
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 @@ -8697,12 +8697,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 @@ -8718,7 +8728,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 7c39562

Please sign in to comment.