Forum
Bildirimler
Hepsini Temizle
İpucu
1
Yazılar
1
Üyeler
0
Reactions
1,131
Görüntüleme
Konu başlatıcı
SQL Server servisinin en son restart edildiği zamandan itibaren kullanılmayan tabloları veren script aşağıdaki gibidir:
select object_schema_name(t.object_id) + '.' + t.name as TableName
from sys.dm_db_index_usage_stats i right outer join
sys.tables t on (t.object_id = i.object_id)
group by object_schema_name(t.object_id) + '.' + t.name
having sum(isnull(i.user_seeks,0)+isnull(i.system_seeks,0)+isnull(i.user_scans,0)+ isnull(i.system_scans,0)
+ isnull(i.user_lookups,0) + isnull(i.system_lookups,0)+ isnull(i.user_updates,0)+ isnull(i.system_updates,0))=0
order by object_schema_name(t.object_id) + '.' + t.name
Gönderildi : 17/03/2011 02:53