Suggestions to retrieve db size?

Post Reply
jkj2001
Posts: 142
Joined: Fri Mar 29, 2002 1:39 pm

Suggestions to retrieve db size?

Post 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.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Suggestions to retrieve db size?

Post 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.
jkj2001
Posts: 142
Joined: Fri Mar 29, 2002 1:39 pm

Suggestions to retrieve db size?

Post 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>?
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

Suggestions to retrieve db size?

Post 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.
jkj2001
Posts: 142
Joined: Fri Mar 29, 2002 1:39 pm

Suggestions to retrieve db size?

Post 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?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Suggestions to retrieve db size?

Post by mark »

<$expr="\.tbl=>>=" "\.dat=>>=" "\.blb=>>=">
<rex $expr $ret>
jkj2001
Posts: 142
Joined: Fri Mar 29, 2002 1:39 pm

Suggestions to retrieve db size?

Post 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.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Suggestions to retrieve db size?

Post by mark »

Look at the Demos page, Webinator dowalk script, and other rex questions on this board.
Post Reply