Hi John,
I run those both scripts on the BRD02 and PGISGEO databases and see below
On BRD02
oracle ovm-repodb01:/nfs01/scripts/beheer_scripts/bin -- brd02
$ sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Vr Mrt 20 12:03:57 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
select df.tablespace_name, round(df.total_bytes / 1048576) total_mb,
round(nvl(fs.free_bytes,0) / 1048576) free_mb,
round(100 * nvl(fs.free_bytes,0) / df.total_bytes, 1) percent_empty
from
(Select tablespace_name, sum(bytes) total_bytes
from dba_data_files
where tablespace_name not in ('SYSTEM')
group by tablespace_name) df,
(Select tablespace_name, sum(bytes) free_bytes
from dba_free_space
where tablespace_name not in ('SYSTEM')
group by tablespace_name) fs
where df.tablespace_name = fs.tablespace_name (+)
14 and nvl(fs.free_bytes,0) / df.total_bytes <= (10 / 100);
TABLESPACE_NAME TOTAL_MB FREE_MB PERCENT_EMPTY
UNDOTBS1 3072 164 5,3
Select tablespace_name,
current_file_size_in_mb total_mb,
free_mb_in_current free_mb,
current_file_size_pct_free percent_empty
from (select files.tablespace_name,
round(files.current_bytes / 1048576) current_file_size_in_mb,
round((files.current_bytes - free.free_bytes) / 1048576) used_mb,
round(free.free_bytes/ 1048576) free_mb_in_current,
round(100 * nvl(free.free_bytes, 0) / files.current_bytes, 1) current_file_size_pct_free,
round(files.max_bytes / 1048576) max_file_size_mb,
round((files.max_bytes - (files.current_bytes - nvl(free.free_bytes, 0))) / 1048576) free_mb_in_max,
round(100 * (files.max_bytes - (files.current_bytes - nvl(free.free_bytes, 0))) / files.max_bytes, 1) max_file_size_pct_free
from (select tablespace_name,
sum(current_bytes) current_bytes,
sum(max_bytes) max_bytes
from (Select df.tablespace_name,
df.bytes current_bytes,
decode(df.autoextensible, 'YES', df.maxbytes, 'NO', df.bytes) max_bytes
from dba_data_files df
where tablespace_name not in ('SYSTEM'))
group by tablespace_name) files,
(Select tablespace_name,
sum(bytes) free_bytes
from dba_free_space
where tablespace_name not in ('SYSTEM')
group by tablespace_name) free
where free.tablespace_name (+) = files.tablespace_name)
28 where current_file_size_pct_free < 10;
TABLESPACE_NAME TOTAL_MB FREE_MB PERCENT_EMPTY
UNDOTBS1 3072 164 5,3
sys @ brd02> exit
At another database PGISGEO
oracle ovm6p:/home/oracle -- cpgisgeo
$ sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Vr Mrt 20 12:07:27 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Verbonden met:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
sys @ cpgisgeo> @set_pdb
oud 1: alter session set container=&1
nieuw 1: alter session set container=PGISGEO
Sessie is gewijzigd.
select df.tablespace_name, round(df.total_bytes / 1048576) total_mb,
round(nvl(fs.free_bytes,0) / 1048576) free_mb,
round(100 * nvl(fs.free_bytes,0) / df.total_bytes, 1) percent_empty
from
(Select tablespace_name, sum(bytes) total_bytes
from dba_data_files
where tablespace_name not in ('SYSTEM')
group by tablespace_name) df,
(Select tablespace_name, sum(bytes) free_bytes
from dba_free_space
where tablespace_name not in ('SYSTEM')
12 group by tablespace_name) fs
where df.tablespace_name = fs.tablespace_name (+)
14 and nvl(fs.free_bytes,0) / df.total_bytes <= (10 / 100);
TABLESPACE_NAME TOTAL_MB FREE_MB PERCENT_EMPTY
CONVERSIE 19456 1390 7,1
BSGW 22016 1677 7,6
Select tablespace_name,
2 current_file_size_in_mb total_mb,
free_mb_in_current free_mb,
current_file_size_pct_free percent_empty
from (select files.tablespace_name,
round(files.current_bytes / 1048576) current_file_size_in_mb,
round((files.current_bytes - free.free_bytes) / 1048576) used_mb,
round(free.free_bytes/ 1048576) free_mb_in_current,
round(100 * nvl(free.free_bytes, 0) / files.current_bytes, 1) current_file_size_pct_free,
round(files.max_bytes / 1048576) max_file_size_mb,
round((files.max_bytes - (files.current_bytes - nvl(free.free_bytes, 0))) / 1048576) free_mb_in_max,
round(100 * (files.max_bytes - (files.current_bytes - nvl(free.free_bytes, 0))) / files.max_bytes, 1) max_file_size_pct_free
from (select tablespace_name,
sum(current_bytes) current_bytes,
sum(max_bytes) max_bytes
from (Select df.tablespace_name,
df.bytes current_bytes,
decode(df.autoextensible, 'YES', df.maxbytes, 'NO', df.bytes) max_bytes
19 from dba_data_files df
where tablespace_name not in ('SYSTEM'))
group by tablespace_name) files,
(Select tablespace_name,
sum(bytes) free_bytes
from dba_free_space
where tablespace_name not in ('SYSTEM')
group by tablespace_name) free
where free.tablespace_name (+) = files.tablespace_name)
28 where current_file_size_pct_free < 10;
TABLESPACE_NAME TOTAL_MB FREE_MB PERCENT_EMPTY
CONVERSIE 19456 1390 7,1
BSGW 22016 1677 7,6
sys @ cpgisgeo>
The same results in sql, but why not from Toad it self? And the BRD02 is a 11.2.0.4 db and PGISGEO a 12.2.0.1 db.
Gr. Jan