Page 1 of 1

Suggestions to retrieve db size?

Posted: Wed Jul 16, 2003 11:11 am
by jkj2001
The bosses here want to get a report of all our texis database sizes. By that, I'm assuming all .tbl and .blb files, although it might be good to include all the index files and their extensions too.

I know it's possible to write shell scripts, perl and/or python scripts to pull this information, but before going down that road I thought I'd ask to see if maybe your API has a getdatabasesize() function I'd missed, or conversely, if you knew a good way to get this info using a vortex script, with maybe a quick pseudocode example and or vortex function listing(s) of interest?

I'd like to keep the queries as Thunderstone-centric as possible and avoid other dependencies, which is why I'd like to do this with vortex or your API. Thanks for the tips.

Suggestions to retrieve db size?

Posted: Wed Jul 16, 2003 11:51 am
by mark
There's no call to do that directly. You should query SYSTABLES and SYSINDEX to get the filenames then use <stat> to do wildcard expansion and get file sizes to add up.

Suggestions to retrieve db size?

Posted: Thu Jul 17, 2003 5:56 pm
by jkj2001
Thanks Mark.

One thing I'm trying to do is use <stat> with a couple of wildcards. I believe the find command will take multiple -name parameters on the command line, but when I try it with <stat> all I get are matches on the "last" pattern, which makes sense.

For instance:

<stat ROW MAXDEPTH=1 SKIP=0 NAME="*.btr" NAME="*.dat" "/database/somedirectory/thetable">
<fmt " %s %10d\n" $ret $ret.size><br>
</stat>

The only files retrieved are .dat files. Is it possible to match multiple wildcards with <stat>?

Suggestions to retrieve db size?

Posted: Thu Jul 17, 2003 6:17 pm
by Kai
<stat> currently only supports one NAME wildcard. You could get multiple-wildcard behavior by removing the NAME and using <rex> inside the <stat> loop.

Suggestions to retrieve db size?

Posted: Thu Jul 17, 2003 9:02 pm
by jkj2001
I've got this so far:


<stat ROW MAXDEPTH=1 SKIP=0 "/database/somedirectory/thetable">
<rex "tbl=>>=" $ret>
<if $ret = "tbl">
<fmt "%10d\n" $ret.size><br>
</if>
</stat>


Problem is, my rex skills are such that I can't figure out a way to return something if the line ends with either tbl or dat or blb. Couldn't help with a tip, could you?

Suggestions to retrieve db size?

Posted: Thu Jul 17, 2003 10:05 pm
by mark
<$expr="\.tbl=>>=" "\.dat=>>=" "\.blb=>>=">
<rex $expr $ret>

Suggestions to retrieve db size?

Posted: Mon Jul 21, 2003 2:27 pm
by jkj2001
Thanks Mark-- as an aside, do you guys have some good sample scripts with regular expressions that I can go through and use to build up my knowledge? I've looked at the online docs and would like to get my hands on some more.

Suggestions to retrieve db size?

Posted: Mon Jul 21, 2003 3:01 pm
by mark
Look at the Demos page, Webinator dowalk script, and other rex questions on this board.