'2012/04'에 해당되는 글 1건

  1. 2012.04.06 Check procedure

Check procedure

Database 2012. 4. 6. 08:34 Posted by Jay Choi

1. 사용중인 테이블 조회

WITH sp_list AS (
    SELECT AS proc_name
           , AS table_name
           , Row_number() OVER(partition by, ORDER BY, AS row
      FROM sysdepends d
           INNER JOIN sysobjects o ON =
           INNER JOIN sysobjects oo ON = d.depid
     WHERE o.xtype = 'P'
SELECT proc_name, table_name
  FROM sp_list
 WHERE row = 1
 ORDER BY proc_name, table_name

2. 인덱스 조각화율 체크

SELECT a.index_id, name, avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID(N'Production.Product'), NULL, NULL, NULL) AS a
    JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id;


댓글을 달아 주세요