DBA GENESIS
Courses
Contact
Members
More
I want to script to show if the percentage of tablespace space left free is less than 20%.
The Below script will generate output if the percentage of table space left free is less than 20%. You can easily put a shell script and program it on crontab to send alerts on a day-to-day basis.
select df.tablespace_name tspace, round(sum(fs.bytes)/(df.bytes) * 100) "%_free", round(sum(fs.bytes)/(1024*1024)) free_ts_size, df.bytes/(1024*1024) tot_ts_size from dba_free_space fs, (select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name ) df where fs.tablespace_name = df.tablespace_name group by df.tablespace_name, df.bytes having round(sum(fs.bytes)/(df.bytes) * 100) < 20;
The Below script will generate output if the percentage of table space left free is less than 20%. You can easily put a shell script and program it on crontab to send alerts on a day-to-day basis.
select df.tablespace_name tspace, round(sum(fs.bytes)/(df.bytes) * 100) "%_free", round(sum(fs.bytes)/(1024*1024)) free_ts_size, df.bytes/(1024*1024) tot_ts_size from dba_free_space fs, (select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name ) df where fs.tablespace_name = df.tablespace_name group by df.tablespace_name, df.bytes having round(sum(fs.bytes)/(df.bytes) * 100) < 20;