Oracle查询表空间使用率很慢

问题描述

执行查询表空间的语句,需要接近2min的时间才能执行完成。

以前也在其他客户的生产库遇到过一样的情况,当时是由于回收站的内容过多引起的。

不过这次的情况却不是这样,因为回收站的内容并不多。

调试分析

老方法,设置statistics_level=all获取详细的执行情况,如下:

20:32:05 SYS@anonymous> SELECT a.tablespace_name,
20:32:05 2 ROUND (a.bytes_alloc / 1024 / 1024, 2) megs_alloc,
20:32:05 3 ROUND (NVL (b.bytes_free, 0) / 1024 / 1024, 2) megs_free,
20:32:05 4 ROUND ((a.bytes_alloc - NVL (b.bytes_free, 0)) / 1024 / 1024, 2 ) megs_used,
20:32:05 5 ROUND ((NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) pct_free,
20:32:05 6 100 - ROUND ((NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) pct_used,
20:32:05 7 ROUND (maxbytes / 1048576, 2) MAX
20:32:05 8 FROM
20:32:05 9 (SELECT f.tablespace_name,
20:32:05 10 SUM (f.BYTES) bytes_alloc,
20:32:05 11 SUM (DECODE (f.autoextensible, 'YES', f.maxbytes, 'NO', f.BYTES ) ) maxbytes
20:32:05 12 FROM dba_data_files f
20:32:05 13 GROUP BY tablespace_name
20:32:05 14 ) a,
20:32:05 15 (SELECT f.tablespace_name,
20:32:05 16 SUM (f.BYTES) bytes_free
20:32:05 17 FROM dba_free_space f
20:32:05 18 GROUP BY tablespace_name
20:32:05 19 ) b
20:32:05 20 WHERE a.tablespace_name = b.tablespace_name(+)
20:32:05 21 UNION ALL
20:32:05 22 SELECT h.tablespace_name,
20:32:05 23 ROUND (SUM (h.bytes_free + h.bytes_used) / 1048576, 2) megs_alloc,
20:32:05 24 ROUND ( SUM ((h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0)) / 1048576, 2 ) megs_free,
20:32:05 25 ROUND (SUM (NVL (p.bytes_used, 0)) / 1048576, 2) megs_used,
20:32:05 26 ROUND ( ( SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0) ) / SUM (h.bytes_used + h.bytes_free) ) * 100, 2 ) pct_free,
20:32:05 27 100 - ROUND ( ( SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0) ) / SUM (h.bytes_used + h.bytes_free) ) * 100, 2 ) pct_used,
20:32:05 28 ROUND (SUM (f.maxbytes) / 1048576, 2) MAX
20:32:05 29 FROM SYS.v_$temp_space_header h,
20:32:05 30 SYS.v_$temp_extent_pool p,
20:32:05 31 dba_temp_files f
20:32:05 32 WHERE p.file_id(+) = h.file_id
20:32:06 33 AND p.tablespace_name(+) = h.tablespace_name
20:32:06 34 AND f.file_id = h.file_id
20:32:06 35 AND f.tablespace_name = h.tablespace_name
20:32:06 36 GROUP BY h.tablespace_name
20:32:06 37 ORDER BY 1 ; TABLESPACE_NAME MEGS_ALLOC MEGS_FREE MEGS_USED PCT_FREE PCT_USED MAX
------------------------------ ---------- ---------- ---------- ---------- ---------- ----------
xxxxxxxxxxxxxxxx 4096 4019 77 98.12 1.88 4096
xxxxxxxxxxxxxxxx 8192 2283 5909 27.87 72.13 8192
xxxxxxxxxxxxxxxx 2048 1113 935 54.35 45.65 2048
xxxxxxxxxxxxxxxx 24576 16092 8484 65.48 34.52 24576
xxxxxxxxxxxxxxxx 4096 4095 1 99.98 .02 4096
xxxxxxxxxxxxxxxx 8192 8187 5 99.94 .06 8192
xxxxxxxxxxxxxxxx 4000 3373 627 84.33 15.67 4000
xxxxxxxxxxxxxxxx 546304 346561 199743 63.44 36.56 546304
xxxxxxxxxxxxxxxx 4096 2969 1127 72.49 27.51 4096
xxxxxxxxxxxxxxxx 4096 4086 10 99.76 .24 4096
xxxxxxxxxxxxxxxx 8192 3047 5145 37.19 62.81 8192
xxxxxxxxxxxxxxxx 276608 77078 199530 27.87 72.13 276608
xxxxxxxxxxxxxxxx 16384 8605 7779 52.52 47.48 16384
xxxxxxxxxxxxxxxx 4096 2944 1152 71.88 28.12 4096
xxxxxxxxxxxxxxxx 16384 3575 12809 21.82 78.18 16384
xxxxxxxxxxxxxxxx 4096 1074 3022 26.22 73.78 4096
xxxxxxxxxxxxxxxx 4096 4071 25 99.39 .61 4096
xxxxxxxxxxxxxxxx 4096 3915 181 95.58 4.42 4096
xxxxxxxxxxxxxxxx 16384 15984 400 97.56 2.44 16384
xxxxxxxxxxxxxxxx 32760 8390.88 24369.13 25.61 74.39 32767.98
xxxxxxxxxxxxxxxx 5360 34.13 5325.88 .64 99.36 32767.98
xxxxxxxxxxxxxxxx 4096 2946 1150 71.92 28.08 4096
xxxxxxxxxxxxxxxx 4096 4052 44 98.93 1.07 4096
xxxxxxxxxxxxxxxx 20096 13860 6236 68.97 31.03 20096
xxxxxxxxxxxxxxxx 16384 13068 3316 79.76 20.24 16384
xxxxxxxxxxxxxxxx 208192 40933 167259 19.66 80.34 208192
xxxxxxxxxxxxxxxx 20096 16143 3953 80.33 19.67 20096
xxxxxxxxxxxxxxxx 2048 1898 150 92.68 7.32 2048
xxxxxxxxxxxxxxxx 20096 16138 3958 80.3 19.7 20096
xxxxxxxxxxxxxxxx 68096 13300 54796 19.53 80.47 68096
xxxxxxxxxxxxxxxx 8192 8179 13 99.84 .16 8192
xxxxxxxxxxxxxxxx 32767 31971 796 97.57 2.43 32767.98
xxxxxxxxxxxxxxxx 10240 2371.75 7868.25 23.16 76.84 10240
xxxxxxxxxxxxxxxx 10390 9292.25 1097.75 89.43 10.57 32767.98
xxxxxxxxxxxxxxxx 4356.25 209.38 4146.88 4.81 95.19 32767.98 35 rows selected. Elapsed: 00:01:54.62 20:34:00 SYS@anonymous> select * from table(dbms_xplan.display_cursor(null,null,'allstats last')); PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 8ks58zbpgra00, child number 1
-------------------------------------
SELECT a.tablespace_name, ROUND (a.bytes_alloc / 1024 /
1024, 2) megs_alloc, ROUND (NVL (b.bytes_free, 0) / 1024 / 1024, 2)
megs_free, ROUND ((a.bytes_alloc - NVL (b.bytes_free, 0)) /
1024 / 1024, 2 ) megs_used, ROUND ((NVL (b.bytes_free, 0) /
a.bytes_alloc) * 100, 2) pct_free, 100 -
ROUND ((NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) pct_used,
ROUND (maxbytes / 1048576, 2) MAX FROM (SELECT
f.tablespace_name, SUM (f.BYTES) bytes_alloc, SUM (DECODE
(f.autoextensible, 'YES', f.maxbytes, 'NO', f.BYTES ) ) maxbytes FROM
dba_data_files f GROUP BY tablespace_name ) a, (SELECT
f.tablespace_name, SUM (f.BYTES) bytes_free FROM dba_free_space f
GROUP BY tablespace_name ) b WHERE a.tablespace_name =
b.tablespace_name(+) UNION ALL SELECT h.tablespace_name, ROUND (SUM
(h.bytes_free + h.bytes_used) / 1048576, 2) megs_alloc,
ROUND ( SUM ((h.bytes_free + h.bytes_used) - NVL (p.b Plan hash value: 2506036241 ------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem | Used-Mem |
------------------------------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | 35 |00:01:54.53 | 53354 | 4865 | | | |
| 1 | SORT ORDER BY | | 1 | 3 | 35 |00:01:54.53 | 53354 | 4865 | 4096 | 4096 | 4096 (0)|
| 2 | UNION-ALL | | 1 | | 35 |00:01:54.53 | 53354 | 4865 | | | |
|* 3 | HASH JOIN OUTER | | 1 | 2 | 34 |00:01:54.18 | 53310 | 4865 | 1229K| 1229K| 1243K (0)|
| 4 | VIEW | | 1 | 2 | 34 |00:00:00.66 | 444 | 0 | | | |
| 5 | HASH GROUP BY | | 1 | 2 | 34 |00:00:00.66 | 444 | 0 | 941K| 941K| 1349K (0)|
| 6 | VIEW | DBA_DATA_FILES | 1 | 2 | 108 |00:00:00.65 | 444 | 0 | | | |
| 7 | UNION-ALL | | 1 | | 108 |00:00:00.65 | 444 | 0 | | | |
| 8 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.57 | 112 | 0 | | | |
| 9 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.57 | 112 | 0 | | | |
| 10 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.57 | 112 | 0 | | | |
|* 11 | FIXED TABLE FULL | X$KCCFN | 1 | 1 | 108 |00:00:00.57 | 0 | 0 | | | |
|* 12 | TABLE ACCESS BY INDEX ROWID| FILE$ | 108 | 1 | 0 |00:00:00.01 | 112 | 0 | | | |
|* 13 | INDEX UNIQUE SCAN | I_FILE1 | 108 | 1 | 108 |00:00:00.01 | 4 | 0 | | | |
|* 14 | FIXED TABLE FIXED INDEX | X$KCCFE (ind:1) | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
| 15 | TABLE ACCESS CLUSTER | TS$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 16 | INDEX UNIQUE SCAN | I_TS# | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
| 17 | NESTED LOOPS | | 1 | 1 | 108 |00:00:00.08 | 332 | 0 | | | |
| 18 | NESTED LOOPS | | 1 | 1 | 108 |00:00:00.08 | 220 | 0 | | | |
| 19 | NESTED LOOPS | | 1 | 1 | 108 |00:00:00.01 | 220 | 0 | | | |
| 20 | NESTED LOOPS | | 1 | 1 | 108 |00:00:00.01 | 108 | 0 | | | |
|* 21 | FIXED TABLE FULL | X$KCCFN | 1 | 1 | 108 |00:00:00.01 | 0 | 0 | | | |
|* 22 | FIXED TABLE FIXED INDEX | X$KTFBHC (ind:1) | 108 | 1 | 108 |00:00:00.01 | 108 | 0 | | | |
|* 23 | TABLE ACCESS BY INDEX ROWID| FILE$ | 108 | 1 | 108 |00:00:00.01 | 112 | 0 | | | |
|* 24 | INDEX UNIQUE SCAN | I_FILE1 | 108 | 1 | 108 |00:00:00.01 | 4 | 0 | | | |
|* 25 | FIXED TABLE FIXED INDEX | X$KCCFE (ind:1) | 108 | 1 | 108 |00:00:00.08 | 0 | 0 | | | |
| 26 | TABLE ACCESS CLUSTER | TS$ | 108 | 1 | 108 |00:00:00.01 | 112 | 0 | | | |
|* 27 | INDEX UNIQUE SCAN | I_TS# | 108 | 1 | 108 |00:00:00.01 | 4 | 0 | | | |
| 28 | VIEW | | 1 | 31 | 34 |00:01:53.52 | 52866 | 4865 | | | |
| 29 | HASH GROUP BY | | 1 | 31 | 34 |00:01:53.52 | 52866 | 4865 | 9291K| 2834K| 1346K (0)|
| 30 | VIEW | DBA_FREE_SPACE | 1 | 140 | 100K|00:01:53.50 | 52866 | 4865 | | | |
| 31 | UNION-ALL | | 1 | | 100K|00:01:53.48 | 52866 | 4865 | | | |
| 32 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 38 | 0 | | | |
| 33 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 38 | 0 | | | |
| 34 | TABLE ACCESS FULL | FET$ | 1 | 1 | 0 |00:00:00.01 | 38 | 0 | | | |
|* 35 | TABLE ACCESS CLUSTER | TS$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 36 | INDEX UNIQUE SCAN | I_TS# | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 37 | INDEX UNIQUE SCAN | I_FILE2 | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
| 38 | NESTED LOOPS | | 1 | 88 | 84440 |00:00:00.15 | 394 | 0 | | | |
| 39 | NESTED LOOPS | | 1 | 88 | 84440 |00:00:00.06 | 390 | 0 | | | |
|* 40 | TABLE ACCESS FULL | TS$ | 1 | 31 | 34 |00:00:00.01 | 38 | 0 | | | |
|* 41 | FIXED TABLE FIXED INDEX | X$KTFBFE (ind:1) | 34 | 3 | 84440 |00:00:00.05 | 352 | 0 | | | |
|* 42 | INDEX UNIQUE SCAN | I_FILE2 | 84440 | 1 | 84440 |00:00:00.06 | 4 | 0 | | | |
|* 43 | HASH JOIN | | 1 | 50 | 16133 |00:01:53.30 | 52396 | 4865 | 2297K| 2297K| 2426K (0)|
| 44 | NESTED LOOPS | | 1 | 50 | 16133 |00:01:53.29 | 52358 | 4865 | | | |
|* 45 | HASH JOIN | | 1 | 808 | 16133 |00:01:53.26 | 52354 | 4865 | 1753K| 1753K| 1511K (0)|
|* 46 | TABLE ACCESS FULL | RECYCLEBIN$ | 1 | 152 | 191 |00:00:00.01 | 4 | 0 | | | |
| 47 | FIXED TABLE FULL | X$KTFBUE | 1 | 100K| 723K|00:01:52.95 | 52350 | 4865 | | | |
|* 48 | INDEX UNIQUE SCAN | I_FILE2 | 16133 | 1 | 16133 |00:00:00.01 | 4 | 0 | | | |
|* 49 | TABLE ACCESS FULL | TS$ | 1 | 31 | 34 |00:00:00.01 | 38 | 0 | | | |
| 50 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 38 | 0 | | | |
| 51 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 38 | 0 | | | |
| 52 | MERGE JOIN CARTESIAN | | 1 | 425 | 0 |00:00:00.01 | 38 | 0 | | | |
|* 53 | TABLE ACCESS FULL | TS$ | 1 | 3 | 0 |00:00:00.01 | 38 | 0 | | | |
| 54 | BUFFER SORT | | 0 | 152 | 0 |00:00:00.01 | 0 | 0 | 73728 | 73728 | |
|* 55 | TABLE ACCESS FULL | RECYCLEBIN$ | 0 | 152 | 0 |00:00:00.01 | 0 | 0 | | | |
| 56 | TABLE ACCESS CLUSTER | UET$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 57 | INDEX UNIQUE SCAN | I_FILE#_BLOCK# | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 58 | INDEX UNIQUE SCAN | I_FILE2 | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
| 59 | HASH GROUP BY | | 1 | 1 | 1 |00:00:00.35 | 44 | 0 | 856K| 856K| 463K (0)|
| 60 | NESTED LOOPS OUTER | | 1 | 1 | 1 |00:00:00.35 | 44 | 0 | | | |
|* 61 | HASH JOIN | | 1 | 1 | 1 |00:00:00.35 | 42 | 0 | 1281K| 1281K| 402K (0)|
| 62 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.35 | 3 | 0 | | | |
| 63 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.35 | 1 | 0 | | | |
| 64 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.35 | 0 | 0 | | | |
|* 65 | FIXED TABLE FULL | X$KCCFN | 1 | 1 | 1 |00:00:00.34 | 0 | 0 | | | |
|* 66 | FIXED TABLE FIXED INDEX | X$KCCTF (ind:1) | 1 | 1 | 1 |00:00:00.01 | 0 | 0 | | | |
|* 67 | FIXED TABLE FIXED INDEX | X$KTFTHC (ind:1) | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
| 68 | TABLE ACCESS CLUSTER | TS$ | 1 | 1 | 1 |00:00:00.01 | 2 | 0 | | | |
|* 69 | INDEX UNIQUE SCAN | I_TS# | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
| 70 | VIEW | V_$TEMP_SPACE_HEADER | 1 | 1 | 1 |00:00:00.01 | 39 | 0 | | | |
| 71 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.01 | 39 | 0 | | | |
|* 72 | TABLE ACCESS FULL | TS$ | 1 | 1 | 1 |00:00:00.01 | 38 | 0 | | | |
|* 73 | FIXED TABLE FIXED INDEX | X$KTFTHC (ind:2) | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
|* 74 | VIEW PUSHED PREDICATE | V_$TEMP_EXTENT_POOL | 1 | 1 | 1 |00:00:00.01 | 2 | 0 | | | |
| 75 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.01 | 2 | 0 | | | |
|* 76 | TABLE ACCESS BY INDEX ROWID | TS$ | 1 | 1 | 1 |00:00:00.01 | 2 | 0 | | | |
|* 77 | INDEX UNIQUE SCAN | I_TS1 | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
|* 78 | FIXED TABLE FIXED INDEX | X$KTSTFC (ind:1) | 1 | 1 | 1 |00:00:00.01 | 0 | 0 | | | |
------------------------------------------------------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id):
--------------------------------------------------- 3 - access("A"."TABLESPACE_NAME"="B"."TABLESPACE_NAME")
11 - filter(("FNNAM" IS NOT NULL AND "FNTYP"=4 AND "INST_ID"=USERENV('INSTANCE') AND BITAND("FNFLG",4)<>4))
12 - filter("F"."SPARE1" IS NULL)
13 - access("FNFNO"="F"."FILE#")
14 - filter("FE"."FENUM"="F"."FILE#")
16 - access("F"."TS#"="TS"."TS#")
21 - filter(("FNNAM" IS NOT NULL AND "FNTYP"=4 AND "INST_ID"=USERENV('INSTANCE') AND BITAND("FNFLG",4)<>4))
22 - filter("FNFNO"="HC"."KTFBHCAFNO")
23 - filter("F"."SPARE1" IS NOT NULL)
24 - access("FNFNO"="F"."FILE#")
25 - filter("FE"."FENUM"="F"."FILE#")
27 - access("HC"."KTFBHCTSN"="TS"."TS#")
35 - filter("TS"."BITMAPPED"=0)
36 - access("TS"."TS#"="F"."TS#")
37 - access("F"."TS#"="FI"."TS#" AND "F"."FILE#"="FI"."RELFILE#")
40 - filter(("TS"."BITMAPPED"<>0 AND "TS"."CONTENTS$"=0 AND INTERNAL_FUNCTION("TS"."ONLINE$")))
41 - filter("TS"."TS#"="F"."KTFBFETSN")
42 - access("F"."KTFBFETSN"="FI"."TS#" AND "F"."KTFBFEFNO"="FI"."RELFILE#")
43 - access("TS"."TS#"="RB"."TS#")
45 - access("U"."KTFBUESEGTSN"="RB"."TS#" AND "U"."KTFBUESEGFNO"="RB"."FILE#" AND "U"."KTFBUESEGBNO"="RB"."BLOCK#")
46 - filter(("RB"."TS#" IS NOT NULL AND "RB"."FILE#" IS NOT NULL AND "RB"."BLOCK#" IS NOT NULL))
48 - access("RB"."TS#"="FI"."TS#" AND "U"."KTFBUEFNO"="FI"."RELFILE#")
49 - filter(("TS"."BITMAPPED"<>0 AND "TS"."CONTENTS$"=0 AND INTERNAL_FUNCTION("TS"."ONLINE$")))
53 - filter("TS"."BITMAPPED"=0)
55 - filter(("RB"."TS#" IS NOT NULL AND "RB"."FILE#" IS NOT NULL AND "RB"."BLOCK#" IS NOT NULL))
57 - access("U"."TS#"="RB"."TS#" AND "U"."SEGFILE#"="RB"."FILE#" AND "U"."SEGBLOCK#"="RB"."BLOCK#")
filter("TS"."TS#"="U"."TS#")
58 - access("U"."TS#"="FI"."TS#" AND "U"."SEGFILE#"="FI"."RELFILE#")
61 - access("HC"."KTFTHCTFNO"="H"."FILE_ID" AND "TS"."NAME"="H"."TABLESPACE_NAME")
65 - filter(("V"."FNNAM" IS NOT NULL AND "V"."FNTYP"=7))
66 - filter(("TF"."TFDUP"<>0 AND BITAND("TF"."TFSTA",32)<>32 AND "V"."FNFNO"="TF"."TFNUM" AND "TF"."TFFNH"="V"."FNNUM"))
67 - filter("V"."FNFNO"="HC"."KTFTHCTFNO")
69 - access("HC"."KTFTHCTSN"="TS"."TS#")
72 - filter(("TS"."CONTENTS$"=1 AND "TS"."BITMAPPED"<>0 AND "TS"."ONLINE$"=1))
73 - filter(("HC"."KTFTHCCVAL"=0 AND "HC"."INST_ID"=USERENV('INSTANCE') AND "TS"."TS#"="HC"."KTFTHCTSN"))
74 - filter("P"."FILE_ID"="H"."FILE_ID")
76 - filter(("TS"."CONTENTS$"=1 AND "TS"."BITMAPPED"<>0 AND "TS"."ONLINE$"=1))
77 - access("TS"."NAME"="H"."TABLESPACE_NAME")
78 - filter(("FC"."INST_ID"=USERENV('INSTANCE') AND "TS"."TS#"="FC"."KTSTFCTSN")) 147 rows selected. Elapsed: 00:00:00.08

可以发现,慢的步骤在于对表X$KTFBUE的全表扫描,这个问题也引起了另外一个问题,可以看我另外一篇博文->Oracle查询dba_extents视图很慢

从执行计划很容易得出由于该表缺乏统计信息或统计信息不准确导致的。

原本尝试想要用hint强制使用索引的,但是不行,而且这固定表的索引本身就很奇葩。用/*+cardinality(dba_free_space.x$ktfbue 999) */  /*+cardinality(u.x$ktfbue 999) */之类的hint都不行。

mos的一篇关于该问题的文章:Query Against Dictionary Views Extracting Tablespace Information is Slow or Appears to Hang (Doc ID 1292253.1)

直接收集统计信息:

EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME =>'SYS',DEGREE => 40,TABNAME => 'X$KTFBUE',ESTIMATE_PERCENT=>100,NO_INVALIDATE => FALSE);

Elapsed: 00:10:24.03

20:24:43 sys@anonymous(eportdb01)> select LAST_ANALYZED,NUM_ROWS,BLOCKS,EMPTY_BLOCKS,AVG_ROW_LEN from dba_tab_statistics where owner='SYS' and table_name='X$KTFBUE';

LAST_ANALYZED         NUM_ROWS     BLOCKS EMPTY_BLOCKS AVG_ROW_LEN
------------------- ---------- ---------- ------------ -----------
2020-05-15 20:24:43 730407 69

再次执行发现对固定表X$KTFBUE已经可以用上索引了,查询表空间使用率的sql大概3s所有可以执行完。

22:54:11 sys@anonymous(eportdb01)> SELECT a.tablespace_name,
22:54:36 2 ROUND (a.bytes_alloc / 1024 / 1024, 2) megs_alloc,
22:54:36 3 ROUND (NVL (b.bytes_free, 0) / 1024 / 1024, 2) megs_free,
22:54:36 4 ROUND ((a.bytes_alloc - NVL (b.bytes_free, 0)) / 1024 / 1024, 2 ) megs_used,
22:54:36 5 ROUND ((NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) pct_free,
22:54:36 6 100 - ROUND ((NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) pct_used,
22:54:36 7 ROUND (maxbytes / 1048576, 2) MAX
22:54:36 8 FROM
22:54:36 9 (SELECT f.tablespace_name,
22:54:36 10 SUM (f.BYTES) bytes_alloc,
22:54:36 11 SUM (DECODE (f.autoextensible, 'YES', f.maxbytes, 'NO', f.BYTES ) ) maxbytes
22:54:36 12 FROM dba_data_files f
22:54:36 13 GROUP BY tablespace_name
22:54:37 14 ) a,
22:54:37 15 (SELECT f.tablespace_name,
22:54:37 16 SUM (f.BYTES) bytes_free
22:54:37 17 FROM dba_free_space f
22:54:37 18 GROUP BY tablespace_name
22:54:37 19 ) b
22:54:37 20 WHERE a.tablespace_name = b.tablespace_name(+)
22:54:37 21 UNION ALL
22:54:37 22 SELECT h.tablespace_name,
22:54:37 23 ROUND (SUM (h.bytes_free + h.bytes_used) / 1048576, 2) megs_alloc,
22:54:37 24 ROUND ( SUM ((h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0)) / 1048576, 2 ) megs_free,
22:54:37 25 ROUND (SUM (NVL (p.bytes_used, 0)) / 1048576, 2) megs_used,
22:54:37 26 ROUND ( ( SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0) ) / SUM (h.bytes_used + h.bytes_free) ) * 100, 2 ) pct_free,
22:54:37 27 100 - ROUND ( ( SUM ( (h.bytes_free + h.bytes_used) - NVL (p.bytes_used, 0) ) / SUM (h.bytes_used + h.bytes_free) ) * 100, 2 ) pct_used,
22:54:37 28 ROUND (SUM (f.maxbytes) / 1048576, 2) MAX
22:54:37 29 FROM SYS.v_$temp_space_header h,
22:54:37 30 SYS.v_$temp_extent_pool p,
22:54:37 31 dba_temp_files f
22:54:37 32 WHERE p.file_id(+) = h.file_id
22:54:37 33 AND p.tablespace_name(+) = h.tablespace_name
22:54:37 34 AND f.file_id = h.file_id
22:54:37 35 AND f.tablespace_name = h.tablespace_name
22:54:37 36 GROUP BY h.tablespace_name
22:54:37 37 ORDER BY 1 ; TABLESPACE_NAME MEGS_ALLOC MEGS_FREE MEGS_USED PCT_FREE PCT_USED MAX
------------------ ---------- ---------- ---------- ---------- ---------- ----------
XXXXXXXXXXXXXXXX 6144 1621 4523 26.38 73.62 6144
XXXXXXXXXXXXXXXX 4096 4019 77 98.12 1.88 4096
XXXXXXXXXXXXXXXX 8192 2283 5909 27.87 72.13 8192
XXXXXXXXXXXXXXXX 2048 1113 935 54.35 45.65 2048
XXXXXXXXXXXXXXXX 24576 16075 8501 65.41 34.59 24576
XXXXXXXXXXXXXXXX 4096 4095 1 99.98 .02 4096
XXXXXXXXXXXXXXXX 8192 8187 5 99.94 .06 8192
XXXXXXXXXXXXXXXX 4000 3373 627 84.33 15.67 4000
XXXXXXXXXXXXXXXX 546304 345709 200595 63.28 36.72 546304
XXXXXXXXXXXXXXXX 4096 2969 1127 72.49 27.51 4096
XXXXXXXXXXXXXXXX 4096 4086 10 99.76 .24 4096
XXXXXXXXXXXXXXXX 8192 3047 5145 37.19 62.81 8192
XXXXXXXXXXXXXXXX 276608 76905 199703 27.8 72.2 276608
XXXXXXXXXXXXXXXX 16384 8599 7785 52.48 47.52 16384
XXXXXXXXXXXXXXXX 4096 2944 1152 71.88 28.12 4096
XXXXXXXXXXXXXXXX 16384 3552 12832 21.68 78.32 16384
XXXXXXXXXXXXXXXX 4096 1074 3022 26.22 73.78 4096
XXXXXXXXXXXXXXXX 4096 4071 25 99.39 .61 4096
XXXXXXXXXXXXXXXX 4096 3915 181 95.58 4.42 4096
XXXXXXXXXXXXXXXX 16384 15979 405 97.53 2.47 16384
XXXXXXXXXXXXXXXX 32760 8045.38 24714.63 24.56 75.44 32767.98
XXXXXXXXXXXXXXXX 5360 4442.44 917.56 82.88 17.12 32767.98
XXXXXXXXXXXXXXXX 4096 2946 1150 71.92 28.08 4096
XXXXXXXXXXXXXXXX 4096 4052 44 98.93 1.07 4096
XXXXXXXXXXXXXXXX 20096 13843 6253 68.88 31.12 20096
XXXXXXXXXXXXXXXX 16384 13068 3316 79.76 20.24 16384
XXXXXXXXXXXXXXXX 208192 40288 167904 19.35 80.65 208192
XXXXXXXXXXXXXXXX 20096 16087 4009 80.05 19.95 20096
XXXXXXXXXXXXXXXX 2048 1874 174 91.5 8.5 2048
XXXXXXXXXXXXXXXX 20096 16111 3985 80.17 19.83 20096
XXXXXXXXXXXXXXXX 68096 12626 55470 18.54 81.46 68096
XXXXXXXXXXXXXXXX 8192 8167 25 99.69 .31 8192
XXXXXXXXXXXXXXXX 32767 31952 815 97.51 2.49 32767.98
XXXXXXXXXXXXXXXX 10240 2491.5 7748.5 24.33 75.67 10240
XXXXXXXXXXXXXXXX 10390 10144.31 245.69 97.64 2.36 32767.98
XXXXXXXXXXXXXXXX 4356.25 209.38 4146.88 4.81 95.19 32767.98 36 rows selected. Elapsed: 00:00:03.13
22:54:40 sys@anonymous(eportdb01)> select * from table(dbms_xplan.display_cursor(null,null,'allstats last')); PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 8ks58zbpgra00, child number 2
-------------------------------------
SELECT a.tablespace_name, ROUND (a.bytes_alloc / 1024 /
1024, 2) megs_alloc, ROUND (NVL (b.bytes_free, 0) / 1024 / 1024, 2)
megs_free, ROUND ((a.bytes_alloc - NVL (b.bytes_free, 0)) /
1024 / 1024, 2 ) megs_used, ROUND ((NVL (b.bytes_free, 0) /
a.bytes_alloc) * 100, 2) pct_free, 100 -
ROUND ((NVL (b.bytes_free, 0) / a.bytes_alloc) * 100, 2) pct_used,
ROUND (maxbytes / 1048576, 2) MAX FROM (SELECT
f.tablespace_name, SUM (f.BYTES) bytes_alloc, SUM (DECODE
(f.autoextensible, 'YES', f.maxbytes, 'NO', f.BYTES ) ) maxbytes FROM
dba_data_files f GROUP BY tablespace_name ) a, (SELECT
f.tablespace_name, SUM (f.BYTES) bytes_free FROM dba_free_space f
GROUP BY tablespace_name ) b WHERE a.tablespace_name =
b.tablespace_name(+) UNION ALL SELECT h.tablespace_name, ROUND (SUM
(h.bytes_free + h.bytes_used) / 1048576, 2) megs_alloc,
ROUND ( SUM ((h.bytes_free + h.bytes_used) - NVL (p.b Plan hash value: 3723612910 ----------------------------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem | Used-Mem |
----------------------------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | 36 |00:00:03.12 | 17525 | 96 | | | |
| 1 | SORT ORDER BY | | 1 | 38 | 36 |00:00:03.12 | 17525 | 96 | 4096 | 4096 | 4096 (0)|
| 2 | UNION-ALL | | 1 | | 36 |00:00:03.12 | 17525 | 96 | | | |
|* 3 | HASH JOIN OUTER | | 1 | 37 | 35 |00:00:03.11 | 17478 | 96 | 1229K| 1229K| 1596K (0)|
| 4 | VIEW | | 1 | 37 | 35 |00:00:00.25 | 154 | 0 | | | |
| 5 | HASH GROUP BY | | 1 | 37 | 35 |00:00:00.25 | 154 | 0 | 941K| 941K| 1372K (0)|
| 6 | VIEW | DBA_DATA_FILES | 1 | 109 | 109 |00:00:00.25 | 154 | 0 | | | |
| 7 | UNION-ALL | | 1 | | 109 |00:00:00.25 | 154 | 0 | | | |
| 8 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 2 | 0 | | | |
| 9 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 2 | 0 | | | |
|* 10 | HASH JOIN | | 1 | 1 | 0 |00:00:00.01 | 2 | 0 | 1079K| 1079K| 192K (0)|
|* 11 | TABLE ACCESS FULL | FILE$ | 1 | 1 | 0 |00:00:00.01 | 2 | 0 | | | |
|* 12 | FIXED TABLE FULL | X$KCCFN | 0 | 108 | 0 |00:00:00.01 | 0 | 0 | | | |
| 13 | TABLE ACCESS CLUSTER | TS$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 14 | INDEX UNIQUE SCAN | I_TS# | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 15 | FIXED TABLE FIXED INDEX | X$KCCFE (ind:1) | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
| 16 | NESTED LOOPS | | 1 | 108 | 109 |00:00:00.25 | 152 | 0 | | | |
|* 17 | HASH JOIN | | 1 | 108 | 109 |00:00:00.16 | 152 | 0 | 1393K| 1393K| 1573K (0)|
| 18 | TABLE ACCESS FULL | TS$ | 1 | 37 | 37 |00:00:00.01 | 41 | 0 | | | |
| 19 | NESTED LOOPS | | 1 | 108 | 109 |00:00:00.16 | 111 | 0 | | | |
|* 20 | HASH JOIN | | 1 | 108 | 109 |00:00:00.16 | 2 | 0 | 2440K| 2440K| 1647K (0)|
|* 21 | FIXED TABLE FULL | X$KCCFN | 1 | 108 | 109 |00:00:00.15 | 0 | 0 | | | |
|* 22 | TABLE ACCESS FULL | FILE$ | 1 | 109 | 109 |00:00:00.01 | 2 | 0 | | | |
|* 23 | FIXED TABLE FIXED INDEX | X$KTFBHC (ind:1) | 109 | 1 | 109 |00:00:00.01 | 109 | 0 | | | |
|* 24 | FIXED TABLE FIXED INDEX | X$KCCFE (ind:1) | 109 | 1 | 109 |00:00:00.09 | 0 | 0 | | | |
| 25 | VIEW | | 1 | 33 | 35 |00:00:02.85 | 17324 | 96 | | | |
| 26 | HASH GROUP BY | | 1 | 33 | 35 |00:00:02.85 | 17324 | 96 | 9291K| 2834K| 2511K (0)|
| 27 | VIEW | DBA_FREE_SPACE | 1 | 78687 | 100K|00:00:02.82 | 17324 | 96 | | | |
| 28 | UNION-ALL | | 1 | | 100K|00:00:02.81 | 17324 | 96 | | | |
| 29 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 41 | 0 | | | |
| 30 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 41 | 0 | | | |
| 31 | TABLE ACCESS FULL | FET$ | 1 | 1 | 0 |00:00:00.01 | 41 | 0 | | | |
|* 32 | TABLE ACCESS CLUSTER | TS$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 33 | INDEX UNIQUE SCAN | I_TS# | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 34 | INDEX UNIQUE SCAN | I_FILE2 | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 35 | HASH JOIN | | 1 | 78675 | 83871 |00:00:00.11 | 397 | 0 | 1969K| 1969K| 1573K (0)|
| 36 | INDEX FULL SCAN | I_FILE2 | 1 | 109 | 109 |00:00:00.01 | 1 | 0 | | | |
| 37 | NESTED LOOPS | | 1 | 78675 | 83871 |00:00:00.06 | 396 | 0 | | | |
|* 38 | TABLE ACCESS FULL | TS$ | 1 | 33 | 35 |00:00:00.01 | 41 | 0 | | | |
|* 39 | FIXED TABLE FIXED INDEX | X$KTFBFE (ind:1) | 35 | 2397 | 83871 |00:00:00.05 | 355 | 0 | | | |
| 40 | NESTED LOOPS | | 1 | 10 | 16133 |00:00:02.65 | 16845 | 96 | | | |
| 41 | NESTED LOOPS | | 1 | 10 | 16133 |00:00:02.60 | 708 | 96 | | | |
| 42 | NESTED LOOPS | | 1 | 157 | 16133 |00:00:02.57 | 704 | 96 | | | |
|* 43 | TABLE ACCESS FULL | RECYCLEBIN$ | 1 | 157 | 191 |00:00:00.01 | 4 | 0 | | | |
|* 44 | FIXED TABLE FIXED INDEX | X$KTFBUE (ind:1) | 191 | 1 | 16133 |00:00:02.57 | 700 | 96 | | | |
|* 45 | INDEX UNIQUE SCAN | I_FILE2 | 16133 | 1 | 16133 |00:00:00.02 | 4 | 0 | | | |
|* 46 | TABLE ACCESS CLUSTER | TS$ | 16133 | 1 | 16133 |00:00:00.05 | 16137 | 0 | | | |
|* 47 | INDEX UNIQUE SCAN | I_TS# | 16133 | 1 | 16133 |00:00:00.01 | 4 | 0 | | | |
| 48 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 41 | 0 | | | |
| 49 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 41 | 0 | | | |
| 50 | MERGE JOIN CARTESIAN | | 1 | 438 | 0 |00:00:00.01 | 41 | 0 | | | |
|* 51 | TABLE ACCESS FULL | TS$ | 1 | 3 | 0 |00:00:00.01 | 41 | 0 | | | |
| 52 | BUFFER SORT | | 0 | 157 | 0 |00:00:00.01 | 0 | 0 | 73728 | 73728 | |
|* 53 | TABLE ACCESS FULL | RECYCLEBIN$ | 0 | 157 | 0 |00:00:00.01 | 0 | 0 | | | |
| 54 | TABLE ACCESS CLUSTER | UET$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 55 | INDEX UNIQUE SCAN | I_FILE#_BLOCK# | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 56 | INDEX UNIQUE SCAN | I_FILE2 | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
| 57 | HASH GROUP BY | | 1 | 1 | 1 |00:00:00.02 | 47 | 0 | 856K| 856K| 491K (0)|
| 58 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.02 | 47 | 0 | | | |
| 59 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.02 | 46 | 0 | | | |
| 60 | NESTED LOOPS OUTER | | 1 | 1 | 1 |00:00:00.02 | 45 | 0 | | | |
|* 61 | HASH JOIN | | 1 | 1 | 1 |00:00:00.02 | 43 | 0 | 1451K| 1451K| 716K (0)|
| 62 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.02 | 1 | 0 | | | |
| 63 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.02 | 0 | 0 | | | |
|* 64 | FIXED TABLE FULL | X$KCCTF | 1 | 1 | 1 |00:00:00.02 | 0 | 0 | | | |
|* 65 | FIXED TABLE FIXED INDEX | X$KCCFN (ind:1) | 1 | 1 | 1 |00:00:00.01 | 0 | 0 | | | |
|* 66 | FIXED TABLE FIXED INDEX | X$KTFTHC (ind:1) | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
| 67 | VIEW | V_$TEMP_SPACE_HEADER | 1 | 1 | 1 |00:00:00.01 | 42 | 0 | | | |
| 68 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.01 | 42 | 0 | | | |
|* 69 | TABLE ACCESS FULL | TS$ | 1 | 1 | 1 |00:00:00.01 | 41 | 0 | | | |
|* 70 | FIXED TABLE FIXED INDEX | X$KTFTHC (ind:2) | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
|* 71 | VIEW PUSHED PREDICATE | V_$TEMP_EXTENT_POOL | 1 | 1 | 1 |00:00:00.01 | 2 | 0 | | | |
| 72 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.01 | 2 | 0 | | | |
|* 73 | TABLE ACCESS BY INDEX ROWID| TS$ | 1 | 1 | 1 |00:00:00.01 | 2 | 0 | | | |
|* 74 | INDEX UNIQUE SCAN | I_TS1 | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
|* 75 | FIXED TABLE FIXED INDEX | X$KTSTFC (ind:1) | 1 | 1 | 1 |00:00:00.01 | 0 | 0 | | | |
|* 76 | INDEX UNIQUE SCAN | I_TS1 | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
|* 77 | TABLE ACCESS BY INDEX ROWID | TS$ | 1 | 1 | 1 |00:00:00.01 | 1 | 0 | | | |
---------------------------------------------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 3 - access("A"."TABLESPACE_NAME"="B"."TABLESPACE_NAME")
10 - access("FNFNO"="F"."FILE#")
11 - filter("F"."SPARE1" IS NULL)
12 - filter(("FNTYP"=4 AND "FNNAM" IS NOT NULL AND "INST_ID"=USERENV('INSTANCE') AND BITAND("FNFLG",4)<>4))
14 - access("F"."TS#"="TS"."TS#")
15 - filter("FE"."FENUM"="F"."FILE#")
17 - access("HC"."KTFBHCTSN"="TS"."TS#")
20 - access("FNFNO"="F"."FILE#")
21 - filter(("FNTYP"=4 AND "FNNAM" IS NOT NULL AND "INST_ID"=USERENV('INSTANCE') AND BITAND("FNFLG",4)<>4))
22 - filter("F"."SPARE1" IS NOT NULL)
23 - filter("FNFNO"="HC"."KTFBHCAFNO")
24 - filter("FE"."FENUM"="F"."FILE#")
32 - filter("TS"."BITMAPPED"=0)
33 - access("TS"."TS#"="F"."TS#")
34 - access("F"."TS#"="FI"."TS#" AND "F"."FILE#"="FI"."RELFILE#")
35 - access("F"."KTFBFETSN"="FI"."TS#" AND "F"."KTFBFEFNO"="FI"."RELFILE#")
38 - filter(("TS"."BITMAPPED"<>0 AND "TS"."CONTENTS$"=0 AND INTERNAL_FUNCTION("TS"."ONLINE$")))
39 - filter("TS"."TS#"="F"."KTFBFETSN")
43 - filter(("RB"."TS#" IS NOT NULL AND "RB"."FILE#" IS NOT NULL AND "RB"."BLOCK#" IS NOT NULL))
44 - filter(("U"."KTFBUESEGTSN"="RB"."TS#" AND "U"."KTFBUESEGFNO"="RB"."FILE#" AND "U"."KTFBUESEGBNO"="RB"."BLOCK#"))
45 - access("RB"."TS#"="FI"."TS#" AND "U"."KTFBUEFNO"="FI"."RELFILE#")
46 - filter(("TS"."BITMAPPED"<>0 AND "TS"."CONTENTS$"=0 AND INTERNAL_FUNCTION("TS"."ONLINE$")))
47 - access("TS"."TS#"="RB"."TS#")
51 - filter("TS"."BITMAPPED"=0)
53 - filter(("RB"."TS#" IS NOT NULL AND "RB"."FILE#" IS NOT NULL AND "RB"."BLOCK#" IS NOT NULL))
55 - access("U"."TS#"="RB"."TS#" AND "U"."SEGFILE#"="RB"."FILE#" AND "U"."SEGBLOCK#"="RB"."BLOCK#")
filter("TS"."TS#"="U"."TS#")
56 - access("U"."TS#"="FI"."TS#" AND "U"."SEGFILE#"="FI"."RELFILE#")
61 - access("HC"."KTFTHCTFNO"="H"."FILE_ID")
64 - filter((BITAND("TF"."TFSTA",32)<>32 AND "TF"."TFDUP"<>0))
65 - filter(("V"."FNTYP"=7 AND "V"."FNNAM" IS NOT NULL AND "V"."FNFNO"="TF"."TFNUM" AND "TF"."TFFNH"="V"."FNNUM"))
66 - filter("V"."FNFNO"="HC"."KTFTHCTFNO")
69 - filter(("TS"."CONTENTS$"=1 AND "TS"."BITMAPPED"<>0 AND "TS"."ONLINE$"=1))
70 - filter(("HC"."INST_ID"=USERENV('INSTANCE') AND "HC"."KTFTHCCVAL"=0 AND "TS"."TS#"="HC"."KTFTHCTSN"))
71 - filter("P"."FILE_ID"="H"."FILE_ID")
73 - filter(("TS"."CONTENTS$"=1 AND "TS"."BITMAPPED"<>0 AND "TS"."ONLINE$"=1))
74 - access("TS"."NAME"="H"."TABLESPACE_NAME")
75 - filter(("FC"."INST_ID"=USERENV('INSTANCE') AND "TS"."TS#"="FC"."KTSTFCTSN"))
76 - access("TS"."NAME"="H"."TABLESPACE_NAME")
77 - filter("HC"."KTFTHCTSN"="TS"."TS#") 147 rows selected. Elapsed: 00:00:00.87

Oracle查询表空间使用率很慢的更多相关文章

  1. Oracle表空间不足;查询表空间使用率(unable to extend lob segment SYS_LOB0000076749C00006$$ by 8192 in tablespace USERS)

    查询表空间对应地址 *),) total_space from dba_data_files order by tablespace_name; //方案一:修改表空间大小(32000可改为想要的数值 ...

  2. Oracle查询表空间使用情况

    --查询表空间使用情况 SELECT UPPER(F.TABLESPACE_NAME) "表空间名", D.TOT_GROOTTE_MB "表空间大小(M)", ...

  3. oracle表空间使用率统计查询

    今天发现有一张采样表从1月5号开始不记录数据了,所以想查看一下表空间使用率,在网上零零散散找了很多资料,现在记录如下,也不知道哪一个最准确.还有一个就是网上拷贝的sql代码格式太乱了,不好看,找到一个 ...

  4. (转)oracle表空间使用率统计查询

    转自:http://www.cnblogs.com/xwdreamer/p/3511047.html 参考文献 文献1:http://blog.itpub.net/24104518/viewspace ...

  5. 回收站引发ORACLE查询表空间使用缓慢

    一个哥们问我 ,他们查询 表空间使用率 跑了一个多小时,这个太坑爹了,让我 帮忙优化一下. SQL语句如下 select * from ( select ts.tablespace_name,ts.c ...

  6. oracle 查询表空间

    测试用户连接C:\Users\ZP>sqlplus /nologconn hbcxuser/hbcxpass --查看所有表空间 select * from user_tablespaces-- ...

  7. oracle查询表空间的空间占用情况

    ,) percent_used from (select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespac ...

  8. oracle查询表空间的位置

    SELECT * FROM Dba_Data_Files ddf WHERE ddf.tablespace_name = 'TablespaceName'; 以上SQL代码可以查询出表空间的所在路径和 ...

  9. Oracle 查询表空间使用情况

    select *   from (Select a.tablespace_name,                to_char(a.bytes / 1024 / 1024, '99,999.999 ...

随机推荐

  1. Java实现 LeetCode 235 二叉搜索树的最近公共祖先

    235. 二叉搜索树的最近公共祖先 给定一个二叉搜索树, 找到该树中两个指定节点的最近公共祖先. 百度百科中最近公共祖先的定义为:"对于有根树 T 的两个结点 p.q,最近公共祖先表示为一个 ...

  2. Java实现 LeetCode 337 打家劫舍 III(三)

    337. 打家劫舍 III 在上次打劫完一条街道之后和一圈房屋后,小偷又发现了一个新的可行窃的地区.这个地区只有一个入口,我们称之为"根". 除了"根"之外,每 ...

  3. Java实现 洛谷 P2118 比例简化

    import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.i ...

  4. iOS-Core Foundation框架到Foundation桥接的三种方式

    温故知新.勤总结,才能生巧!这次总结一下 :Core Foundation框架到Foundation桥接的三种方式 Foundation提供OC的基础类(像NSObject).基本数据类型等. Cor ...

  5. 第二个hibernate Annotation版本的helloworld

    经过第一次的 hibernate  我发现每一个数据库表都对应了一个类,并且每一个类都要新建一个文件进行配置 很麻烦!  于是便出现了Annotation版本的hibernate. 具体如下: 1.同 ...

  6. 【1】svn 指令总结

    [1]svn log 1.svn log 2. [2]svn di [3]

  7. spring cloud系列教程第八篇-修改服务名称及获取注册中心注册者的信息

    spring cloud系列教程第八篇-修改服务名称及获取注册中心注册者的信息 本文主要内容: 1:管理页面主机名及访问ip信息提示修改 2:获取当前注册中心的服务列表及每个服务对于的服务提供者列表 ...

  8. Android学习笔记基于监听的事件处理

    事件处理流程 代码格式: Button btn1 = findViewById(R.id.btn1); btn1.setOnClickListener(new View.OnClickListener ...

  9. startActivityForResult调用另外一个Activity获取返回结果

    startActivityForResult(intent,requestCode)可以调用另外一个Activity,并返回结果. 换头像案例 activity_main.xml <?xml v ...

  10. 深入理解JVM(③)ZGC收集器

    前言 ZGC是一款在JDK11中新加入的具有实验性质的低延迟垃圾收集器,目前仅支持Linux/x86-64.ZGC收集器是一款基于Region内存布局的,(暂时)不设分代的,使用了读屏障.染色指针和内 ...