Skip to content

Commit

Permalink
option to run dbcc only for production databases
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-andreistefan committed Jun 25, 2019
1 parent ffeb4d1 commit 24f6de5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CREATE PROCEDURE [dbo].[usp_runDatabaseCheckDBForAllSkippedWithinLastXDays]
@maxRunningTimeInMinutes [smallint] = 0,
@skipObjectsList [nvarchar](1024) = NULL,
@executeProjectBased [bit] = 0,
@onlyForProduction [bit] = 0,
@debugMode [bit] = 0
AS

Expand Down Expand Up @@ -203,6 +204,10 @@ INSERT INTO @jobExecutionQueue ( [instance_id], [project_id], [module], [descri
AND cdn.[state_desc] IN ('ONLINE', 'READ ONLY')
AND DATEDIFF(day, sdd.[last_dbcc checkdb_time], GETDATE()) >= @dbccCheckDBAgeDays
AND sdaod.[id] IS NULL
AND ( (@onlyForProduction = 1 AND cp.[is_production] = 1)
OR @onlyForProduction = 0
OR @onlyForProduction IS NULL
)
)X


Expand Down

0 comments on commit 24f6de5

Please sign in to comment.