Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / December 2007

Tip: Looking for answers? Try searching our database.

Number of applications only growing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Burkhard Schultheis - 20 Dec 2007 16:38 GMT
I've installed a fresh DB2 V9.1 server (Express-C). Now I see, that the
number of applications (db2 list applications) is growing all the times
when a script is run which makes some database operations. This is on
Linux.

I tested the same script against an older DB2 V7 on AIX and the number
of applications (db2bp) is growing by one, but then the db2bp
disappears, so the number of applications is not growing all the time.

Here is the script:

#!/bin/sh
#
# CVS-ID: $Id: import_stammdaten.sh,v 1.1 2006/05/18 13:59:46 wagner
Exp $ #

init ()
{
 LANG=C
 expFormat=DEL
 connect=0

 # Kommandozeilen-Parameter abarbeiten
 while [ -n "$1" ]
 do
   case $1 in
   -del)
     expFormat=DEL
     shift;;
   -ixf)
     expFormat=IXF
     shift;;
   *)
     usage;;
   esac
 done

 db2 CONNECT TO telematx USER lzgneu USING lzg
 connect=1
 tableDeleteList="FORMATS SAMMELALARME SAMMELMELDUNG TEXTS WOERTER \
   RELATION BFST MDST MWST SWST ZWST STPRIO NETZ VERZOEGERUNG \
   VERZ_DAUER STST"
 tableInsertList="FORMATS SAMMELALARME SAMMELMELDUNG WOERTER TEXTS \
   STST STPRIO MDST BFST MWST SWST ZWST RELATION NETZ VERZ_DAUER \
   VERZOEGERUNG"
}

usage ()
{
 echo ""
 echo "usage : import_stammdaten.sh <-del|-ixf>"
 echo ""
 fine 0
}

fine ()
{
 if [ $connect -eq 1 ]
 then
   db2 terminate >> /dev/null 2>&1
 fi
 exit $1
}

fatalError ()
{
 echo ""
 echo "    ES IST EIN FATALER FEHLER AUFGETRETEN"
 echo "    TROTZDEM FORTFAHREN ? (y/n)"
 read x
 if [ "$x" != y ]
 then
   fine 1
 fi
}

db2Command ()
{
 echo "$1" | tr '[:blank:]' ' '
 rv=`db2 "$1" | egrep -v "$2|----|selected" | tr '\n' ' ' \
   | tr -s '[:blank:]'`
 echo $rv

 if [ $? -ne 0 ]
 then
   fatalError
 fi
}

main ()
{
 gzFiles=`ls *.gz 2>>/dev/null`
 if [ $? -eq 0 ]
 then
   for fileName in `echo *.gz 2>>/dev/null`
   do
     gzip -d $fileName
     echo "    Unzipping $fileName"
   done
 fi

 mkdir -p temp
 for fileName in *
 do
   if [ -f $fileName ]
   then
     newFileName=`echo $fileName | tr '[:lower:]' '[:upper:]'`
     ln -f $fileName temp/$newFileName
   fi
 done
 cd temp
 echo *

 for tabName in $tableDeleteList
 do
   echo $tabName
   if [ ! -f $tabName.$expFormat ]
   then
     echo "Datei $tabName.$expFormat wurde nicht gefunden"
     echo "Die Daten aus der Tabelle werden jedoch später gelöscht!"
     fatalError
   fi
 done

 echo "SOLLEN JETZT ALLE STAMMDATEN GELÖSCHT WERDEN? (y/n)"
 read x
 if [ "$x" = y ]
 then
   for tabName in $tableDeleteList
   do
     if [ "$tabName" = "TEXTS" -o "$tabName" = "WOERTER" ]
     then
       db2Command "SELECT COALESCE (MAX(nr), 1) AS MAXIMUM FROM \
    lzgneu.$tabName" MAXIMUM
       maxNr=$rv
       if [ "$maxNr" = " -" -o "$maxNr" = "-" -o "$maxNr" = "- " ]
       then
         maxNr=0
       fi
       aktNr=0
       while [ $aktNr -lt $maxNr ]
       do
         aktNr=`expr $aktNr + 1000`
         db2Command "DELETE FROM lzgneu.$tabName \
           WHERE nr <= $aktNr" dummie
         sleep 1
       done
     elif [ "$tabName" = "RELATION" ]
     then
       aktNr=0
       while [ $aktNr -lt 260 ]
       do
         aktNr=`expr $aktNr + 20`
         db2Command "DELETE FROM lzgneu.$tabName WHERE \
           lfdnr < $aktNr" dummie
         sleep 1
       done
     elif [ "$tabName" = "NETZ" ]
     then
       aktNr=0
       while [ $aktNr -lt 260 ]
       do
         aktNr=`expr $aktNr + 20`
         db2Command "DELETE FROM lzgneu.$tabName WHERE \
           lfdnr_start < $aktNr" dummie
         sleep 1
       done
     fi
     db2Command "DELETE FROM lzgneu.$tabName" dummie
     sleep 1
     db2Command "REORG TABLE lzgneu.$tabName" dummie
     sleep 1
   done
 fi

 echo "SOLLEN JETZT DIE STAMMDATEN IMPORTIERT WERDEN? (y/n)"
 read x
 if [ "$x" = y ]
 then
   for tabName in $tableInsertList
   do
     if [ -f $tabName.$expFormat.gz ]
     then
       echo "    Unzipping $tabName.$expFormat.gz"
       gzip -d $tabName.$expFormat.gz   
     fi

     db2Command "IMPORT from $tabName.$expFormat OF $expFormat \
       COMMITCOUNT 10000 INSERT INTO lzgneu.$tabName" dummie
     sleep 1
     db2Command "REORG TABLE lzgneu.$tabName" dummie
     sleep 1
   done
 fi

 echo "SOLLEN JETZT DIE PACKAGES NEU GEBUNDEN WERDEN? (y/n)"
 read x
 if [ "$x" = y ]
 then
   for j in `db2 -x "SELECT pkgname FROM syscat.packages \
     WHERE pkgschema != 'NULLID'"`
   do
     db2Command "REBIND lzgneu.$j" dummie
     sleep 1
   done
 fi
 cd ..
 rm -rf temp
}

init $*
main
fine 0

During the delete loop I see the number of db2bp growing, I thing 1 for
every db2 statement. Why?

It's a big problem for me. I've never seen such a behavior before!

Regards,
Burkhard
Burkhard Schultheis - 20 Dec 2007 22:02 GMT
Burkhard Schultheis schrieb:
> I've installed a fresh DB2 V9.1 server (Express-C). Now I see, that the
> number of applications (db2 list applications) is growing all the times
[quoted text clipped - 214 lines]
>
> It's a big problem for me. I've never seen such a behavior before!

On a second machine with DB2 V9 it's the same problem! :-( For every
statement there is a new process until the maximum number of connections
is reached. Bug in 9.1?

Regards,
Burkhard
Larry - 20 Dec 2007 23:36 GMT
> Burkhard Schultheis schrieb:
>
[quoted text clipped - 223 lines]
> Regards,
> Burkhard
Did you try searching the APAR list for V9 fixpaks for candidates? Or
perhaps just applying the latest fixpak?

Larry
Burkhard Schultheis - 21 Dec 2007 05:55 GMT
Larry schrieb:

>> Burkhard Schultheis schrieb:
>>
[quoted text clipped - 225 lines]
> Did you try searching the APAR list for V9 fixpaks for candidates? Or
> perhaps just applying the latest fixpak?

Nothing found for "connect" and "maximum". :-( Today I'll try 9.5.

Regards,
Burkhard
Burkhard Schultheis - 21 Dec 2007 08:45 GMT
Now I have tested some scripts with 9.1:

Burkhard Schultheis schrieb:

An here is the problem:

> db2Command ()
> {
[quoted text clipped - 8 lines]
>  fi
> }

If I change it to
db2Command ()
{
 db2 "$1"
}

then I got no extra processes!

Any idea why? As I wrote, on AIX with V7.x it was ok with the original
script!

Regards,
Burkhard
Lennart - 21 Dec 2007 12:04 GMT
On Dec 21, 9:45 am, Burkhard Schultheis <schulth...@tde-online.de>
wrote:
[...]

> Any idea why? As I wrote, on AIX with V7.x it was ok with the original
> script!

Not really. But you might be able to track your problem by executing
your script with -x (or add -x to the first line in your script as in
#!/bin/sh -x)

/Lennart
Ian - 22 Dec 2007 05:31 GMT
> Now I have tested some scripts with 9.1:
>
[quoted text clipped - 24 lines]
> Any idea why? As I wrote, on AIX with V7.x it was ok with the original
> script!

The difference here is that using the backticks causes the db2 command
to execute in a different shell.

Therefore, each time you execute db2Command(), the 'db2' command will
create a separate db2bp.  Normally, when the shell goes away, the db2bp
process automatically goes away -- so it would seem that something is
awry here.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.