Policy Based Management and Central Management Server feature can be used together to monitor some best practices over all SQL Server environment.

[more]

Today we are going to talk about how can we use policy based management to monitor Last Successful DBCC CheckDB date for all databases.

Basically we will use DBCC DBINFO() command to check last successful DBCC CheckDB date. In the result set, we will use the value of “dbi_dbcclastknowngood” field.

Here is the script which is used for condition;

ExecuteSql('Numeric', '
CREATE TABLE #tmp
	(ParentObject varchar(1000) NULL,Object varchar(1000) NULL,Field varchar(1000) NULL,Value varchar(1000) NULL)
insert into #tmp
EXEC (''DBCC DBINFO() WITH TABLERESULTS'')
select cast(value as datetime) from #tmp where field=''dbi_dbcclastknowngood''
drop table #tmp
')

Condition;

pbm1

and the policy;

pbm2

and a sample evaluation report for this policy;

pbm3

Not : Blog haricinde, faydali gördügüm yazilari ve linkleri twitter adresimden paylasiyorum. Beni twitter'da takip etmek için : twitter.com/turgaysahtiyan