File tree 1 file changed +44
-0
lines changed
1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ --
2
+ -- Author: Hari Sekhon
3
+ -- Date: 2024-10-18 04:24:34 +0400 (Fri, 18 Oct 2024)
4
+ --
5
+ -- vim:ts=4:sts=4:sw=4:et:filetype=sql
6
+ --
7
+ -- https///github.com/HariSekhon/SQL-scripts
8
+ --
9
+ -- License: see accompanying Hari Sekhon LICENSE file
10
+ --
11
+ -- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
12
+ --
13
+ -- https://www.linkedin.com/in/HariSekhon
14
+ --
15
+
16
+ -- Oracle - Show Tablespace size of the Undo Tablespace
17
+ --
18
+ -- Tested on Oracle 19c
19
+
20
+ SELECT
21
+ df .tablespace_name " Tablespace" ,
22
+ df .bytes / (1024 * 1024 * 1024 ) " Size (GB)" ,
23
+ (df .bytes - SUM (fs .bytes )) / (1024 * 1024 * 1024 ) " Used Space (GB)" ,
24
+ ROUND(SUM (fs .bytes ) / (1024 * 1024 * 1024 ), 2 ) " Free Space (GB)" ,
25
+ ROUND(SUM (fs .bytes ) / df .bytes * 100 , 2 ) " Free Space %"
26
+ FROM
27
+ dba_free_space fs,
28
+ (SELECT
29
+ tablespace_name,
30
+ SUM (bytes) bytes
31
+ FROM
32
+ dba_data_files
33
+ GROUP BY
34
+ tablespace_name) df
35
+ WHERE
36
+ fs .tablespace_name (+ ) = df .tablespace_name
37
+ AND
38
+ UPPER (fs .tablespace_name ) LIKE ' %UNDO%'
39
+ GROUP BY
40
+ df .tablespace_name ,
41
+ df .bytes
42
+ ORDER BY
43
+ " Free Space (GB)" DESC ,
44
+ " Used Space (GB)" DESC ;
You can’t perform that action at this time.
0 commit comments