需要使用SYS用户登录查看
/* Formatted on 2020/12/30 上午 11:17:12 (QP5 v5.163.1008.3004) */
SELECT k.inst_id "INST_ID",
ktssoses "SADDR",
sid,
ktssosno "SERIAL#",
username "USERNAME",
osuser "OSUSER",
ktssosqlid "SQL_ID",
ktssotsn "TABLESPACE",
DECODE (ktssocnt, 0, 'PERMANENT', 1, 'TEMPORARY') "CONTENTS",
--注意在12c的v$sort_usage定义中TABLESPACE和CONTENTS已经发生变化了。
DECODE (ktssosegt,
1, 'SORT',
2, 'HASH',
3, 'DATA',
4, 'INDEX',
5, 'LOB_DATA',
6, 'LOB_INDEX',
'UNDEFINED')
"SEGTYPE",
ktssofno "SEGFILE#",
ktssobno "SEGBLK#",
ktssoexts "EXTENTS",
ktssoblks "BLOCKS",
ROUND (ktssoblks * p.VALUE / 1024 / 1024, 2) "SIZE_MB",
ktssorfno "SEGRFNO#"
FROM x$ktsso k,
v$session s,
(SELECT VALUE
FROM v$parameter
WHERE name = 'db_block_size') p
WHERE ktssoses = s.saddr AND ktssosno = s.serial#;```sql