-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmp_ocu.sql
41 lines (38 loc) · 1.23 KB
/
tmp_ocu.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
----------------------------------------------------------------------------------------
--
-- File name: tmp_ocu.sql
--
-- Purpose: List temporary tablespace usage.
--
-- Author: jpsaraiva
--
-- Version: 2017/02/13
--
-- Example: @tmp_ocu.sql
--
-- Notes: Developed and tested on 11.2.0.4.
--
---------------------------------------------------------------------------------------
--
set pagesize 100 lines 120 pages 1000 heading on feed off null '' ver off
col tablespace_name for a30
col status for a10
col "TOTAL MB" for 999999.99
col "USED MB" for 999999.99
col "FREE MB" for 999999.99
col "CURRENT USERS" for 999999
select
t.TABLESPACE_NAME,
t.status,
sum(TOTAL_BLOCKS*b.bs/1024/1024) "TOTAL MB",
sum(used_blocks*b.bs/1024/1024) "USED MB",
sum(FREE_BLOCKS*b.bs/1024/1024) "FREE MB",
sum(CURRENT_USERS) "CURRENT USERS"
from gv$sort_segment s,
(SELECT tablespace_name, status, sum(bytes)/1024/1024 total FROM dba_temp_files GROUP BY tablespace_name, status) t,
(select value bs from v$parameter where name='db_block_size') b
where s.tablespace_name(+)=t.tablespace_name
group by
t.TABLESPACE_NAME,
t.status,
t.total;