随笔分类 -  SQL Server

How to check table locks
摘要:select object_name(P.object_id) as TableName, resource_type, resource_descriptionfrom sys.dm_tran_locks L join sys.partitions P on L.resource_associated_entity_id = p.hobt_id 阅读全文

posted @ 2012-09-01 08:18 |残阳|露 阅读(196) 评论(0) 推荐(0)

How to check fragmentation on SQL Server 2005
摘要:SELECT object_id, index_id, avg_fragmentation_in_percent, page_countFROM sys.dm_db_index_physical_stats(DB_ID('your_db_name'), OBJECT_ID('your_one_table'), NULL, NULL, NULL);Reference Values (in %)ActionSQL statementavg_fragmentation_in_percent > 5 AND < 30Reorganize IndexALTER 阅读全文

posted @ 2012-08-30 22:32 |残阳|露 阅读(220) 评论(0) 推荐(0)

导航