블로그 이미지
redkite

카테고리

분류 전체보기 (291)
00.SI프로젝트 산출물 (0)
00.센터 운영 문서 (0)
01.DBMS ============.. (0)
01.오라클 (117)
01.MS-SQL (15)
01.MySQL (30)
01.PostgreSql (0)
01.DB튜닝 (28)
====================.. (0)
02.SERVER ==========.. (0)
02.서버-공통 (11)
02.서버-Linux (58)
02.서버-Unix (12)
02.서버-Windows (2)
====================.. (0)
03.APPLICATION =====.. (11)
====================.. (0)
04.ETC =============.. (0)
04.보안 (5)
====================.. (0)
05.개인자료 (1)
06.캠핑관련 (0)
07.OA관련 (1)
Total
Today
Yesterday

달력

« » 2024.12
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

공지사항

최근에 올라온 글

오라클의 OBJECT들 중 INVALID나 DISABLED된 것을 체크하는 스크립트이다.

SET PAGESIZE 1000 LINESIZE 120
COLUMN OBJECT_DV   FORMAT A10
COLUMN OWNER       FORMAT A15
COLUMN TABLE_NAME  FORMAT A30
COLUMN OBJECT_TYPE FORMAT A20
COLUMN NAME        FORMAT A30
COLUMN STATUS      FORMAT A10

 

SELECT * FROM
(
SELECT 'CONSTRAINT'    OBJECT_DV        ,
       OWNER                            ,
       TABLE_NAME      OBJECT_NAME      ,
       CONSTRAINT_TYPE OBJECT_TYPE      ,
       CONSTRAINT_NAME NAME             ,
       STATUS
  FROM SYS.DBA_CONSTRAINTS
 WHERE STATUS = 'DISABLED'
UNION ALL
SELECT 'TRIGGER'    OBJECT_DV           ,
       OWNER                            ,
       TABLE_NAME   OBJECT_NAME         ,
       'TRIGGER'    OBJECT_TYPE         ,
       TRIGGER_NAME NAME                ,
       STATUS
  FROM SYS.DBA_TRIGGERS
 WHERE STATUS = 'DISABLED'
UNION ALL
SELECT 'OBJECT'    OBJECT_DV            ,
       OWNER                            ,
       'OBJECT'    OBJECT_NAME          ,
       OBJECT_TYPE OBJECT_TYPE          ,
       OBJECT_NAME NAME                 ,
       STATUS
  FROM SYS.DBA_OBJECTS
 WHERE STATUS      = 'INVALID'
UNION ALL
SELECT 'INDEX'           OBJECT_DV      ,
       OWNER             OWNER          ,
       INDEX_NAME        OBJECT_NAME    ,
       'INDEX'           OBJECT_TYPE    ,
       INDEX_NAME        NAME           ,
       STATUS
  FROM SYS.DBA_INDEXES
 WHERE STATUS IN ('UNUSABLE','INVALID')
UNION ALL
SELECT 'PART IDX'        OBJECT_DV      ,
       INDEX_OWNER       OWNER          ,
       INDEX_NAME        OBJECT_NAME    ,
       'PART INDEX'      OBJECT_TYPE    ,
       PARTITION_NAME    NAME           ,
       STATUS
  FROM SYS.DBA_IND_PARTITIONS
 WHERE STATUS IN ('UNUSABLE','INVALID')
)
 WHERE OWNER NOT IN ('SYS','SYSTEM');

 

Posted by redkite
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함