Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Posts
    9

    Unanswered: Need Shell Script for displaying Instances,databases,dbalias and port number

    Hi,
    I need a shell script for displaying instance names,database names and database alias names which are presenting in a particular instance(only Local databases) and port numbers in a tabular form.I had written a shell script for this but it is not displaying all alias names for databases(only 1st alias name its showing).If anybody is having it already please help me.

    I'm showing the structure by indenting but we just need a flat file generated in table-like format:

    > Server Name and IP Address
    - DB2 Instance Name and Port Number
    + Database Name and Alias
    + Database Name and Alias
    + etc

    - Next DB2 Instance Name and Port Number
    + Database Name and Alias
    + etc
    - Etc...

    Thanks&Regards

    Bade

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Can you post the script please ? Also specify where you are facing the problem.


    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Nov 2009
    Posts
    9
    Hi Satyaram thanks for ur quick reply

    I'm executing the below command :
    1. db2 list db directory

    Output:

    Database 1 entry:

    Database alias = SAMP
    Database name = SAMPLE
    Local database directory = /db2samp1
    Database release level = b.00
    Comment =
    Directory entry type = Indirect
    Catalog database partition number = 0
    Alternate server hostname =
    Alternate server port number =

    Database 2 entry:

    Database alias = DBWEB
    Database name = DBWEB
    Local database directory = /db2samp1
    Database release level = b.00
    Comment =
    Directory entry type = Indirect
    Catalog database partition number = 0
    Alternate server hostname =
    Alternate server port number =

    Database 3 entry:

    Database alias = DBPORT
    Database name = DBPORT
    Local database directory = /db2samp1
    Database release level = b.00
    Comment =
    Directory entry type = Indirect
    Catalog database partition number = 0
    Alternate server hostname =
    Alternate server port number =

    Database 2 entry:

    Database alias = SAMPLE
    Database name = SAMPLE
    Local database directory = /db2samp1
    Database release level = b.00
    Comment =
    Directory entry type = Indirect
    Catalog database partition number = 0
    Alternate server hostname =
    Alternate server port number =



    Basing on "Local database directory" of the above output, i'm executing the below command:

    2. db2 list db directory on /db2samp1 | egrep -i -e "Database alias"

    Output:

    DBWEB
    DBPORT
    SAMPLE


    Here it should also display the SAMP database alias name but it is not displaying that alias.

    Thanks in advance
    Bade

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Code:
    db2 list db directory | grep -p Indirect | egrep -i -e "Database alias"
    will do the trick
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Nov 2009
    Posts
    9
    Thanks Sathyaram
    It really help me a lot in modifying the script.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •