Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check dbspace freespace. 1

Status
Not open for further replies.

nAtHaNs

Technical User
Feb 14, 2002
57
US
Hi gurus,

I need to know how to check from command line the %freespace of all dbspace. my OS is AIX DB Informix 7.31

Thank you.
 
Hi,

onstat utility generates dbspace and data chunk information:
onstat -d

The script below shows the summary of dbspaces in 4 columns:
Note: Page size assumed as 2K, change it according to your system.

database sysmaster;
set isolation to dirty read;

select
sysdbstab.name,
sum(syschktab.chksize*2048) total,
sum(chksize - nfree)*2048 nused,
sum(syschktab.nfree*2048) free
from
syschktab, sysdbstab
where
syschktab.dbsnum = sysdbstab.dbsnum
group by 1 ;

Regards,
Shriyan
 
Thanks for the reply Shriyan, Sorry but I really dont have much knowledge on Informix. How can i create a script and run it? is it somewhat similar to ksh scripts?

I need to check this info from the command line. Because I want to monitor the free space of my dbspaces from a third party software which can send alert via SMS or email.

thank you.
 
Hi Nathans,

You can execute:
onstat -d
from the command line to get the space/chunk info.

You can save the script below into a file called spc.sql

database sysmaster;
set isolation to dirty read;

select
sysdbstab.name,
sum(syschktab.chksize*2048) total,
sum(chksize - nfree)*2048 nused,
sum(syschktab.nfree*2048) free
from
syschktab, sysdbstab
where
syschktab.dbsnum = sysdbstab.dbsnum
group by 1 ;

To execute the script you may say:
dbaccess sysmaster spc.sql

You may also ksh script to do the job.

#!/usr/bin/ksh
OUTFILE=$PPID
dbaccess <<-EOF 2>&1 > $OUTFILE
database sysmaster;
set isolation to dirty read;

select
sysdbstab.name,
sum(syschktab.chksize*2048) total,
sum(chksize - nfree)*2048 nused,
sum(syschktab.nfree*2048) free
from
syschktab, sysdbstab
where
syschktab.dbsnum = sysdbstab.dbsnum
group by 1 ;

EOF

Regards,
Shriyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top