Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2013
    Posts
    80

    Unanswered: compare 2 databases indexes

    Greeting Everyone,
    Can anyone share with me how you compare 2 different databases schemas indexes without showing other information and send it to output ?

    Thanks.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    we have a script that reads catalog tables and compares individual entries to see if missing in any environment or if different setting for same index
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Aug 2008
    Posts
    147
    do you mean the index structure or the index contents?
    ---------------------------------
    www.sqlserver-dba.com
    www.dba-db2.com

  4. #4
    Join Date
    Mar 2003
    Posts
    280
    Quote Originally Posted by ckwan123 View Post
    Greeting Everyone,
    Can anyone share with me how you compare 2 different databases schemas indexes without showing other information and send it to output ?

    Thanks.
    Assuming the schemas reside in the same database something like:

    Code:
    (select indname, <relevant columns>, 'S1' as origin from syscat.indexes where indschema = 'S1' 
     except 
    select indname, <relevant columns>, 'S1' as origin from syscat.indexes where indschema = 'S2')
    union
    (select indname, <relevant columns>, 'S2' as origin from syscat.indexes where indschema = 'S2' 
     except 
    select indname, <relevant columns>, 'S2' as origin from syscat.indexes where indschema = 'S1')
    If they are not in the same database you can export syscat.indexes info from one db and import it to the other in a temp schema and adjust the above accordingly.
    --
    Lennart

  5. #5
    Join Date
    Aug 2013
    Posts
    80
    It is 2 different databases but same schema. The purpose of this I need to ensure the production database schema indexes consistent with the UAT environment database indexes. I am thinking using db2look to generate out from both db and perform diff but db2look contain all the tables, indexes, etc. In my case I just want only indexes different. Thanks

  6. #6
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    we have a maint environment where we define nicknames to the different catalogs (tables,indexes,columns)and check for differences between nicknames
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

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