代码拉取完成,页面将自动刷新
PROMPT
PROMPT
PROMPT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROMPT------ /) (\
PROMPT------ .-._((,~~.))_.-,
PROMPT------ `-. @@ ,-'
PROMPT------ / ,o--o. \
PROMPT------ ( ( .__. ) )
PROMPT------ ) `----' (
PROMPT------ / \
PROMPT------ / \
PROMPT------ / \
PROMPT------ "The Silly Cow"
PROMPT----- Script: indexlargerthantable.sql
PROMPT----- Author: Prashant 'The FatDBA'
PROMPT----- Cat: Performance Management and Issue Identification
PROMPT----- Version: V1.6 (Date: 08-02-2019)
PROMPT-----
PROMPT-----
PROMPT-----
PROMPT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~WITH
tables AS (
SELECT
owner,
segment_name,
SUM(bytes) bytes
FROM dba_segments
WHERE 'Y' = 'Y'
AND segment_type LIKE 'TABLE%'
GROUP BY
owner,
segment_name
),
indexes AS (
SELECT
owner,
segment_name,
SUM(bytes) bytes
FROM dba_segments
WHERE 'Y' = 'Y'
AND segment_type LIKE 'INDEX%'
GROUP BY
owner,
segment_name
),
idx_tbl AS (
SELECT
d.table_owner,
d.table_name,
d.owner,
d.index_name,
SUM(i.bytes) bytes
FROM indexes i,
dba_indexes d
WHERE i.owner = d.owner
AND i.segment_name = d.index_name
GROUP BY
d.table_owner,
d.table_name,
d.owner,
d.index_name
),
total AS (
SELECT
t.owner table_owner,
t.segment_name table_name,
t.bytes t_bytes,
i.owner index_owner,
i.index_name,
i.bytes i_bytes
FROM tables t,
idx_tbl i
WHERE t.owner = i.table_owner
AND t.segment_name = i.table_name
AND i.bytes > t.bytes
AND t.bytes > POWER(10,7) /* 10M */
)
SELECT table_owner,
table_name,
ROUND(t_bytes / POWER(10,9), 3) table_gb,
index_owner,
index_name,
ROUND(i_bytes / POWER(10,9), 3) index_gb,
ROUND((i_bytes - t_bytes) / POWER(10,9), 3) dif_gb,
ROUND(100 * (i_bytes - t_bytes) / t_bytes, 1) dif_perc
FROM total
ORDER BY
table_owner,
table_name,
index_owner,
index_name;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。