249 views
asked in Oracle by

How to check tablespace size in Oracle database

1 Answer

answered by

inchirags@gmail.com   Chirag's Oracle DBA Tutorial           https://www.chirags.in

*****************************************************************************************

* How to check tablespace size in Oracle database *

*****************************************************************************************

Steps: ---

1. Login to your Oracle Database. (sqlplus / as sysdba)

2. run the below commands.

For setting the tablespae colum format.

 SQL> col TABLESPACE_NAME format a20

for set the lines.

 SQL> set lines 900

Now copy the below code and paste in oracle cmd.

 SQL> select avail_tname "TABLESPACE_NAME",sum(round(avail_space,2)) "ALLOCATED (MB)",((round(avail_space,2)-round(free_space,2))) "USED (MB)",(round(free_space,2)) "FREE (MB)",(round(((round(avail_space,2)-round(free_space,2))/avail_space)*100,2)) "USED (%)",(round((free_space/avail_space)*100,2)) "FREE (%)" from (select tablespace_name avail_tname,sum(bytes)/1024/1024 avail_space from dba_data_files group by tablespace_name) a,(select tablespace_name free_tname,sum(bytes)/1024/1024 free_space from dba_free_space group by tablespace_name) b where a.avail_tname=b.free_tname group by avail_tname,avail_space,free_space UNION all select avail_tname "TABLESPACE  NAME",sum(round(avail_space,2)) "ALLOCATED (MB)",((round(avail_space,2)-round(free_space,2))) "USED (MB)",(round(free_space,2)) "FREE (MB)",(round(((round(avail_space,2)-round(free_space,2))/avail_space)*100,2)) "USED (%)",(round((free_space/avail_space)*100,2)) "FREE (%)" from (select tablespace_name avail_tname,sum(bytes)/1024/1024 avail_space from dba_temp_files group by tablespace_name) a,(select tablespace_name free_tname,sum(bytes_free)/1024/1024 free_space from v$temp_space_header group by tablespace_name) b where a.avail_tname=b.free_tname group by avail_tname,avail_space,free_space order by 5 desc;
The above command give you the list of tablespace with size details like allocated, used, free and Percentages also.

Note : Flow the Process shown in video.

Subscribe and like for more videos:

https://www.youtube.com/@chiragstutorial

Don't forget to, Follow, Like,  Share &, Comment

Thanks & Regards,

Chitt Ranjan Mahto "Chirag"

_________________________________________________________________________________________

Note: All scripts used in this demo will be available in our website.

Link will be available in description.

Most popular tags

laravel postgresql laravel-10 replication ha postgresql mongodb laravel-11 mongodb database mongodb tutorial ubuntu 24.04 lts streaming-replication mysql database laravel postgresql backup laravel login register logout database mysql php laravel 11 - login with otp valid for 10 minutes. user and admin registration user and admin login multiauth technlogy asp.net asp.net c# mysql master slave replication centos linux laravel sql server schedule backup autobackup postgresql django python haproxy load balancer install self sign ssl laravel 11 gaurds zabbix 7 how to install graylog on ubuntu 24.04 lts | step-by-step asp.net core mvc .net mvc network upload c# ssl integration sql server on ubuntu 22.04 lts mssql server ms sql server sql server user access in postgres mysql password change cent os linux configure replica laravel 11 socialite login with google account google login kubernetes (k8s) install nginx load balancer install install and configure .net 8.0 in ubuntu 24.04 lts php in iis php with iis php tutorial chirags php tutorials chirags php tutorial chirags tutorial laravel 11 guards mongodb sharding metabase business analytics metabase postgresql 16 to postgresql 17 postgresql migration letsencrypt mongodb crud rocky linux laravel custom captcha laravel 11 captcha laravel captcha mongo dll php.ini debian 12 nginx apache nextcloud gitea in ubuntu git gitea npm error node js mysql ndb cluster mysql cluster ssl oracle login register logout in python debian windows shell batch file bat file time stamp date time shopping cart in laravel centos rhel swap memeory rhel 5.5
...