Re: script for dbspace usage
Posted in 1996
Tony Reynolds (Acc & Purchasing Helpdesk) wrote:
>
> Has any one got a script to
> enable me to see pages free, %age used of
> dbspaces for online 7.
> I have a script but it disregards dbspaces with
> multiple chunks.
> The script I've got uses awk on the output of
> onstat -d and I dont know> enough about awk to modify it.
> Can anyone help??
> Tony Reynolds :-))
> tr-3475@necadmin.necvenues.co.uk
> The National Exhibition Centre Ltd
Tony,
I have a short bit of C code which handles this. I am not able to
provide it straight to you since it is probably considered company
property. ( They paid me to write it after all. ) But, I think that
if you look in "Informix-OnLine Dynamic Server, Administrator's Guide,
Volume 2, Version 7.1", you will find that chapter 39 talks about the
system tables. Set up a cursor on the columns that you need. Iterate
through the returned rows. Add up the totals and you will get the
percentage that you are looking for. It should take about an hour or
two to get this written. The following cursor declaration should get
you pretty close to what you want. This cursor will let you check
the "level of fullness" for each dbspace.
( Any corrections to this cursor declaration would be appreciated. )
I hope it help!!! :-)
EXEC SQL DECLARE capacity_cursor CURSOR FOR
SELECT sysmaster:syschunks.chknum,
sysmaster:syschunks.dbsnum,
sysmaster:sysdbspaces.dbsnum,
sysmaster:syschunks.chksize,
sysmaster:syschunks.nfree,
sysmaster:syschunks.fname,
sysmaster:sysdbspaces.name
INTO :global_chknum,
:global_chunk_dbsnum,
:global_dbs_dbsnum,
:global_chunk_size,
:global_blocks_free,
:global_fname,
:global_dbs_name
FROM sysmaster:syschunks,
sysmaster:sysdbspaces
WHERE sysmaster:sysdbspaces.dbsnum = sysmaster:syschunks.dbsnum
ORDER BY sysmaster:sysdbspaces.name,
sysmaster:syschunks.chknum;
--
+------------------------------+-------------------------+----------------+
| Kevin McHugh - SW Engineer | mkmchu@fax.cs.mci.com |
| MCI Telecommunications Corp. | (719) 535-5278 |
+------------------------------+-------------------------+----------------+
| ALL RIGHTS RESERVED. |
| This posting is copyright and may be used only for the purposes |
| of professional study. Use of this posting in any commercial |
| environment is explicitly prohibited. This posting may only be |
| reproduced for personal archival purposes. |
+-------------------------------------------------------------------------+