Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save EitanBlumin/1115d31ced67462fafc1317416b6cf72 to your computer and use it in GitHub Desktop.
Save EitanBlumin/1115d31ced67462fafc1317416b6cf72 to your computer and use it in GitHub Desktop.
DatabaseIntegrityCheck - Allocation and Catalog Checks Only
DECLARE @MaxEndTime datetime = DATEADD(HOUR, 2, GETDATE())
DECLARE @TimeLimitSeconds int;
SET @TimeLimitSeconds = DATEDIFF(second, GETDATE(), @MaxEndTime)
EXEC dbo.DatabaseIntegrityCheck
@Databases = 'ALL_DATABASES',
@DatabaseOrder = 'DATABASE_LAST_GOOD_CHECK_ASC',
@CheckCommands = 'CHECKALLOC,CHECKCATALOG',
--@PhysicalOnly = 'Y',
@TimeLimit = @TimeLimitSeconds,
@LogToTable= 'Y',
@Execute = 'Y'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment