File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ --
2+ -- Author: Hari Sekhon
3+ -- Date: 2024-10-11 03:24:48 +0300 (Fri, 11 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 Table Candidates to Move / Shrink in a given Tablespace
17+ --
18+ -- where the tables are over 20% utilized
19+ --
20+ -- Tested on Oracle 19c
21+
22+ SELECT
23+ segment_name,
24+ segment_type,
25+ ROUND(SUM (bytes)/ 1024 / 1024 / 1024 , 2 ) AS size_gb
26+ FROM
27+ dba_segments
28+ WHERE
29+ tablespace_name = ' USERS' -- XXX: Edit
30+ GROUP BY
31+ segment_name,
32+ segment_type
33+ HAVING
34+ SUM (bytes)/ 1024 / 1024 / 1024 > 1
35+ ORDER BY
36+ size_gb DESC ;
You can’t perform that action at this time.
0 commit comments