Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Mariusz asked for a script to get database size on IDS 7.30. Jonathan Leffler urged upgrading to 7.31 and searching the IIUG archive. Linwood Jarratt posted a sysmaster query joining systabnames and sysptnext, summing pe_size times 4 per database, tested on 7.31 and 9.4. Chen Bin also posted a script, but its content was not included.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
"Mariusz " <SlowinskiM@prokom.pl> wrote on
09/10/2004 04:34:48 AM:
> I am looking for the script to get the size of given database in
Informix
> IDS 7.30xx
Please upgrade - IDS 7.30 should be replaced by IDS 7.31.UDx (for fairly
large values of x).
Poke around the IIUG Software Archive and/or Google in groups.google.com
for such information.
It is a fairly frequently asked question.
--
Jonathan Leffler (jleffler@us.ibm.com)
STSM, Informix Database Engineering, IBM Data Management
4100 Bohannon Drive, Menlo Park, CA 94025
Tel: +1 650-926-6921 Tie-Line: 630-6921
"I don't suffer from insanity; I enjoy every minute of it!"
Run
this against your sysmaster database. This works for me in 7.31 and
9.4. This does all databases, but you can modify it to get just the 1 you
wnat.
SELECT dbsname,
(sum( pe_size )) * 4 total_size
FROM systabnames, sysptnext
WHERE partnum = pe_partnum
AND tabname NOT MATCHES "sys*"
AND tabname <> "TBLSpace"
AND dbsname <> "pws"
AND dbsname NOT LIKE 'port%'
AND dbsname NOT LIKE 'sys%'
AND dbsname NOT LIKE "%TEMP"
GROUP BY 1
ORDER BY 1;
Lennie
-----Original Message-----
From: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org]On
Behalf Of Mariusz
Sent: Friday, September 10, 2004 6:35 AM
To: ids@iiug.org
Subject: size of database [3405]
I am looking for the script to get the size of given database in Informix
IDS 7.30xx
Thanks...
the following script is used to count a database
size:
(quoted by some resource)
------------------------------------------------------------------------------
#!/usr/bin/sh
if [ $# -ne 1 ]
then
echo " Usage: dbsize.sh DBNAME "
exit
fi
DBNAME=$1; export DBNAME
TMPFILE=/tmp/dbsize.tmp
RESULT=dbsize.out
export TMPFILE RESULT
dbaccess << !
database sysmaster;
unload to $TMPFILE delimiter "|" select dbsname, tabname, count(*)
num_of_extents, sum( pe_size ) total_size from systabnames, sysptnext wherepartnum = pe_partnum and dbsname="$DBNAME" group by 1, 2 order by 3 desc, 4
desc;
!
awk -F '|' ' \\\\
BEGIN {
size=0;
}
{
size = size + $4
}
END {
size = size * 4 / 1024
printf ("%d M %s \\
", size,ENVIRON["DBNAME"])
}
' $TMPFILE >> $RESULT
cat $TMPFILE >> $RESULT
view $RESULT
rm -f $TMPFILE
-------------------------------------------------------
it may be overwritten for counting a table size.
hope it helps.
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.