SELECT Owner, SUM("Tab") AS Tab, SUM("Ind") AS Ind, SUM("Syn") AS Syn, SUM("Seq") AS Seq, SUM("View") AS "View", SUM("Pkg") AS Pkg, SUM("Pkg Bds") AS "Pkg-BDs",
SUM("Pro") AS "Proc", SUM("Fun") AS "Func", SUM("Trg") AS "Trg", SUM("Type") AS "Type", SUM("LOB") AS "LOB", SUM("DBLK") AS "DBLK"
FROM (
SELECT Owner, COUNT(*) AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'TABLE' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", COUNT(*) AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_indexes
GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", COUNT(*) AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'SYNONYM' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", COUNT(*) AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'SEQUENCE' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", COUNT(*) AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'VIEW' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", COUNT(*) AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'PACKAGE' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", COUNT(*) AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'PACKAGE BODY' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", COUNT(*) AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'PROCEDURE' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", COUNT(*)
AS "Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'FUNCTION' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", COUNT(*) AS "Trg", 0 AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'TRIGGER' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", COUNT(*) AS "Type", 0 AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'TYPE' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0
AS "Fun", 0 AS "Trg", 0 AS "Type", COUNT(*) AS "LOB", 0 AS "DBLK"
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'LOB' GROUP BY Owner
UNION ALL
SELECT Owner, 0 AS "Tab", 0 AS "Ind", 0 AS "Syn", 0 AS "Seq", 0 AS "View", 0 AS "Pkg", 0 AS "Pkg Bds", 0 AS "Pro", 0 AS
"Fun", 0 AS "Trg", 0 AS "Type", 0 AS "LOB", COUNT(*) AS "DBLK"
FROM DBA_DB_LINKS
GROUP BY Owner
)
where owner not in ('DBSNMP','DBWINE','ORANGE','OUTLN','PERFSTAT','SYS','SYSTEM','ORACLE_OCM','SYSMAN','TSMSYS','WMSYS')
GROUP BY Owner
ORDER BY owner;
결과
'Oracle DB' 카테고리의 다른 글
Oracle RDS Redo Log 관리 (0) | 2021.10.12 |
---|---|
Oracle RDS File Download Query (0) | 2021.10.12 |
Oracle 파티셔닝 (Partitioning) 문법Oracle 파티셔닝 (Partitioning) 문법 (0) | 2021.04.04 |
Oracle 문법 (0) | 2021.04.04 |
오라클 .ora (listener.ora, sqlnet.ora, tnsnames.ora) (0) | 2021.04.04 |