What is the option or command used in Informix for finding which dbspace a database resides?

Questions by nancyphilips   answers by nancyphilips

Showing Answers 1 - 3 of 3 Answers

jayanta.js

  • Sep 24th, 2007
 

from command line# onmonitor ->Logical-Logs->Databases
----- or ------
Following shell script, you can easily find out database name and in which
dbspace
#!/usr/bin/ksh


OUTPUT=lstdbs.out
TMPFILE=lstdbs.txt
PAGESIZE=2
BG=false



###############################################################################
if [ -f $OUTPUT ]
then
rm -f $OUTPUT
fi


if [ -f $TMPFILE ]
then
rm -f $TMPFILE
fi


echo "Collecting Database info from the sysmaster database..."


dbaccess << EOF
database sysmaster;
unload to '$TMPFILE' delimiter "|"
select
dbinfo("DBSPACE",partnum) dbspace,
name database,
owner,
is_logging,
is_buff_log
from sysdatabases
order by dbspace, name
EOF


echo "unload completed"


XDATE=`date +%D-%T`


echo
echo "Completed - formatting report..."
echo
awk '


BEGIN {
pageno=1
split (xdate,b,"-")
udate=b[1]
utime=b[2]
printf "nnn"
printf "%s %s Informix Database & DbSpace List Page: %dn", udate, utime, pageno
printf "nDatabase Name DB-Space Name Owner Login Mode"
printf "n================================================================"
printf "n"
}



###############################################################################
# FIRST LINE ONLY



###############################################################################
# ON EVERY LINE


{
split ($1,a,"|")


dbspacenm=a[1]
databasenm=a[2]
ownernm=a[3]
flg1 =a[4]
flg2 =a[5]
printf "%-13s %-13s %-10s ",databasenm,dbspacenm,ownernm
if(flg1 ==1 && flg2 == 1)
printf "Buffer Login"
else
if(flg1 ==0 && flg2==0)
printf "No Login "
else
if(flg1 ==1 && flg2==0)
printf "Un-Buffer Login "
else
if(flg1 ==0 && flg2 ==1)
printf " "
printf"n"
cntline++
}



###############################################################################


# ON LAST LINE
END {
printf "n================================================================"
}


'
pagesize=$PAGESIZE
xdate=$XDATE
$TMPFILE > $OUTPUT


if [ $BG = false ]
then
pg $OUTPUT
fi


rm -f $TMPFILE


echo
echo "Note: Output report is in $OUTPUT"

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions