In article <72f3b6$46t$1@news.xmission.com>,
"Yan Zhu" <yan.zhu@infinity-insurance.com> wrote:
>
> hi:
> I need a command to give me a list of dbspaces and their total size and
> their used size, how do I accomplish that?
> soalris 2.6 with onlinke 7.3
> thanks
>
>
In Solaris 2.5.1 & Informix 7.2x we use script as:
#!/bin/ksh
# 1997, Joseph Shkolnik, shkolnij@hotmail.com
#
PS=2 # Page size in KB in this platform
onstat -d | nawk "
BEGIN{tI=\\"INFORMIX-OnLine\\";
}
(\\$1==\\"Dbspaces\\"){st=1}(\\$1==\\"Chunks\\"){st=2}
((st==1)&&(NF>7)&&(\\$2~/[0-9][0-9]*/)){
dbs[\\$2]=\\$NF;iW=0;
}
((st==2)&&(NF>7)&&(\\$3~/[0-9][0-9]*/)){
if(\\$(NF-1)~\\"^M\\"){M[dbs[\\$3]]=1;sizeM+=\\$5*${PS} }
else{
size[dbs[\\$3]]+=\\$5*${PS};free[dbs[\\$3]]+=\\$6*${PS}
}
}
(\\$1==tI){s=\\$0;gsub(\\"-- \\",\\"\\",s);gsub(tI,\\"\\",s);
print s}
END{TT=\\"XZ\\"
print \\"DBSPACE ALLOC,KB FREE,KB\\" \\
\\" USED,KB %FREE\\";
sort=\\"sort\\";
for(dv in size){
if(M[dv]==1){YNM=\\"M\\"}else{YNM=\\"N\\"}
if(size[dv]>0){pct=100*free[dv]/size[dv];}else{pct=0;}
printf(\\"%-16s %11ld %11ld %11ld %5.1f %s\\n\\",dv,
size[dv],free[dv],(size[dv]-free[dv]),pct,
YNM) | sort;
sizeT[TT]+=size[dv]
freeT[TT]+=free[dv]
}
s=TT;
#if(sizeT[s]==0){q=0;}{q=1/sizeT[s];}
if(1000000 * sizeT[s] < 1){q=0;}{q=1/sizeT[s];}
printf(\\"%-16s %11ld %11ld %11ld %5.1f ****************\\n\\",
\\"TOTAL\\",
sizeT[s],freeT[s],(sizeT[s]-freeT[s]),(100*freeT[s]*q))
printf(\\"%-16s %11ld M\\n\\",
\\"TOTAL MIRROR\\" ,sizeM)
printf(\\"**** `hostname` at `date` ****\\n\\")
close(sort);
}"
exit 0
#### End of script
Maybe it'll be OK.
-Joseph Shkolnik
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own