Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Total DB Size

Status
Not open for further replies.
Apr 12, 2001
46
US
Is there a command to issue in sqlplus to get the total size of a database in megs?
 
rem ********************************************************************
rem * Filename : tf.sql - Version 1.1
rem * Author : Cary Millsap (original)
rem * Rick Minutella / Craig A. Shallahamer
rem * Original : 07-NOV-93
rem * Last Update : 1/16/96 - 08:28:00
rem * Description : Report tablespace space
rem * Usage : start tf.sql
rem ********************************************************************

comp sum of nfrags totsiz avasiz on report
break on report

col tsname format a16 justify c heading 'Tablespace'
col nfrags format 999,990 justify c heading 'Free|Frags'
col mxfrag format 999,999,990 justify c heading 'Largest|Frag (KB)'
col totsiz format 999,999,990 justify c heading 'Total|(KB)'
col avasiz format 999,999,990 justify c heading 'Available|(KB)'
col pctusd format 990 justify c heading 'Pct|Used'

select
total.tablespace_name tsname,
count(free.bytes) nfrags,
nvl(max(free.bytes)/1024,0) mxfrag,
total.bytes/1024 totsiz,
nvl(sum(free.bytes)/1024,0) avasiz,
(1-nvl(sum(free.bytes),0)/total.bytes)*100 pctusd
from
aps_data_files total,
dba_free_space free
where
total.tablespace_name = free.tablespace_name(+)
group by
total.tablespace_name,
total.bytes
/
I tried to remain child-like, all I acheived was childish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top