Database Size
Posted in 2009
Topics: Storage & Space Management, SQL Development & Query Writing, Server Administration
Can we get the correct Database size with the below method.
Create a file dbsize.sql
Copy the following below contents in dbsize.sql.
select dbsname, trunc(sum(size)*2/1024) MB fromsysextents
group by dbsname order by
1
dbaccess sysmaster dbsize.sql
Please help me.
With IDS 11.50TC6, I had to modify the query to get only the databases
from sysextents by adding a predicate. I also used substr on the database
name to make the output more readable.
select substr(dbsname,1,20) as database
, trunc(sum(size)*2/1024) as size_in_MB
from sysextents
where dbsname in (select name from sysdatabases)
group by dbsname
order by 1
;
Otherwise I had rows returned for each dbspace and each database and
something called "system". The dbspaces are the database name in
systabinfo (one of the tables used in defining the sysextents view) for
the tablespace tablespaces in each database, and "system" is the database
name for the syslicenseinfo table. If you want those entries, don't
change your query.
Cheers,
Dick
Dick Snoke
Executive IT Specialist
IBM Software Group
Tel: (404) 487-1595
Email: dsnoke@us.ibm.com
From:
"DEEPAK JOSHI" <djoshih@hotmail.com>
To:
ids@iiug.org
Date:
10/06/09 01:00 PM
Subject:
Database Size [17385]
Sent by:
ids-bounces@iiug.org
Can we get the correct Database size with the below method.
Create a file dbsize.sql
Copy the following below contents in dbsize.sql.
select dbsname, trunc(sum(size)*2/1024) MB fromsysextents
group by dbsname order by
1
dbaccess sysmaster dbsize.sql
Please help me.
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.