Tuesday, August 26, 2014

how to check when was the successful DBCC CheckDB run in sql server

its simple.

dbcc dbinfo ('db1') with tableresults
and then check for "dbi_dbcclastknowngood" field.

you can also get a host of other fields and values from dbinfo command.

Also the below command gets you the same answer:

dbcc page (dbname,1,9,3) with tableresults

Tuesday, May 20, 2014

Some new DMVs and new views and functions in sql server 2012

select * from sys.dm_server_services

select * from sys.dm_server_registry

select * from sys.dm_os_windows_info  - gives the service pack level and windows version, won't exactly say whether it is win 2008 or 2012, we have to figure this out by comparing with the release number

select * from sys.database_recovery_status

select * from sys.dm_clr_properties  - gives the .net CLR version

select * from sys.dm_clr_loaded_assemblies

select * from [sys].[dm_db_fts_index_physical_stats]  - for fulltext indexes

select * from [sys].[dm_db_log_space_usage]  - no need of dbcc sqlperf now

select * from [sys].[dm_tcp_listener_states]

select * from [sys].syslockinfo

select * from sys.all_sql_modules  - gives scripts of all views, sps and functions