Archive for February, 2008

fragmentation for indexes

here’s how I do it:

SELECT A.object_id
, A.index_id
, [name]
, Avg_Fragmentation_In_Percent
FROM sys.dm_db_index_physical_stats (db_id(), NULL,NULL, NULL, NULL) AS A
JOIN sys.indexes B WITH(NOLOCK)
ON A.Object_id = B.Object_id
AND A.Index_id = B.Index_id
WHERE [name] IS NOT NULL

Thursday, February 28th, 2008

Check File Growth

Check the file growth option for your databases, it also tells you the logical and physical file name, file location, etc …

Wednesday, February 27th, 2008

Rebuilding indexes

Script to rebuild indexes. it splits the tasks out into an online and offline reindexing. I made some modifications to it. You have to create this store procedure in the database you are looking to indexed.

Wednesday, February 27th, 2008

usp_isJobRunning

Store Procedure to check whether a job is running or not.

Wednesday, February 27th, 2008