代码拉取完成,页面将自动刷新
-- | PURPOSE : Report on top 10 tables with respect to usage and command type. |
-- | NOTE : As with any code, ensure to test this script in a development |
-- | environment before attempting to run it in production. |
-- +----------------------------------------------------------------------------+
SET PAGESIZE 9999
SET VERIFY off
COLUMN ctyp FORMAT a13 HEADING 'Command Type'
COLUMN obj FORMAT a30 HEADING 'Object Name'
COLUMN noe FORMAT 999,999,999,999,999 HEADING 'Number of Executions'
COLUMN gets FORMAT 999,999,999,999,999 HEADING 'Buffer Gets'
COLUMN rowp FORMAT 999,999,999,999,999 HEADING 'Rows Processed'
BREAK ON report
COMPUTE sum OF noe ON report
COMPUTE sum OF gets ON report
COMPUTE sum OF rowp ON report
SELECT
ctyp
, obj
, 0 - exem noe
, gets
, rowp
FROM (
select distinct exem, ctyp, obj, gets, rowp
from (select
DECODE( s.command_type
, 2, 'Insert into '
, 3, 'Select from '
, 6, 'Update of '
, 7, 'Delete from '
, 26, 'Lock of ') ctyp
, o.owner || '.' || o.name obj
, SUM(0 - s.executions) exem
, SUM(s.buffer_gets) gets
, SUM(s.rows_processed) rowp
from
v$sql s
, v$object_dependency d
, v$db_object_cache o
where
s.command_type IN (2,3,6,7,26)
and d.from_address = s.address
and d.to_owner = o.owner
and d.to_name = o.name
and o.type = 'TABLE'
group by
s.command_type
, o.owner
, o.name
)
)
WHERE rownum <= 10;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。