File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-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 Tables' Segments Size in a given Tablespace
17+ --
18+ -- Tested on Oracle 19c
19+
20+ SELECT
21+ segment_name,
22+ segment_type,
23+ tablespace_name,
24+ bytes/ 1024 / 1024 / 1024 AS size_gb,
25+ blocks
26+ FROM
27+ dba_segments
28+ WHERE
29+ owner = ' USERS' -- XXX: Edit this
30+ AND
31+ segment_type = ' TABLE'
32+ AND
33+ blocks > 8
34+ -- to look at only specific tables
35+ -- AND
36+ -- segment_name IN
37+ -- ('MY_TABLE_1',
38+ -- 'MY_TABLE_2',
39+ -- 'MY_TABLE_3',
40+ -- 'MY_TABLE_4')
41+ ORDER BY
42+ size_gb DESC ;
You can’t perform that action at this time.
0 commit comments