I have a script which do it,
This script will show all the LOCAL databases either active or not active.
here you are!

Miguel Celi
DB2 DBA

Subj: [DB2EUG] find out databases available on an instance
Date: 1/23/2003 2:35:25 AM Eastern Standard Time
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent from the Internet



Hi Everybody,

If anybody know how to get databases names (both
actiated and
deactivated) available on an instance in db2 please
let me know.

I have already tested following commands which will
not serve my purpose.

1. list active databases

2.list database directory on --path--

Note : It's very urgent ..your help will be greatly
appreciated.


Thanks in Advance,


Sunil


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
-
:::  When replying to the list, please use 'Reply-All' and make sure
:::  a copy goes to the list ([EMAIL PROTECTED]).
***  To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
***  For more information, check http://www.db2eug.uni.cc






Miguel Celi
Senior IBM DB2 DBA  - Expert Solutions Certified

SYSDBA-USA, Inc.
8351 Johnson Street
Hollywood, Florida 33024
www.sysdbausa.com
#!/bin/ksh
#
. $HOME/sqllib/db2profile;
########################################
# Miguel Celi
# September 2001
#
# The parameter |sort|uniq will filter the same DB's and get the output for just one DB
##########################################
HOSTNAME="`hostname | tr [a-z] [A-Z]`"
LOGPATH=$HOME/local/reports;

################################################################
## The TEMP files will be hided to avoid be removed by mistake #
## while the SCRIPTs are running.                              #
################################################################
ALLDBNAMES="$LOGPATH/.ALLDBNAMES.`date +%b%d`_`date +%H:%M`"
DUPDBNAMES="$LOGPATH/.DUPDBNAMES.`date +%b%d`_`date +%H:%M`"
# ------------------------------------------------------------------#
#    This routine will get only the LOCAL databases, discarding all #
#    REMOTE and ALIAS DB's                                          #
#------------------------------------------------------------------ #
db2 list database directory > $ALLDBNAMES
for i in `egrep " Database name| Directory entry type " $ALLDBNAMES | awk '{print $4 
$5}'`
do
  DUPNAME=$i
  if [ "$i" == "=Indirect" ]
  then
     echo $CORNAME >> $DUPDBNAMES
  else
     CORNAME=$DUPNAME
  fi
done

LOCDBNAMES="`cat $DUPDBNAMES |sort|uniq`"

echo "\nLocal databases:"
for DBNAME in $LOCDBNAMES
do
    echo "$DBNAME"
done
rm $ALLDBNAMES $DUPDBNAMES
#

Reply via email to