If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Sysibm.syskeys ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-21-10, 07:03
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Sysibm.syskeys ??

Hi,

DB2V9.5 Fixpack 5 on Win2K3 Server

I just saw an old post Show all indexes on the table as report

Can some one tell me what happened to SYSIBM.SYSKEYS

I cannot use that query because I do not have SYSIBM.SYSKEYS

Thanks in advance

DBFinder
Reply With Quote
  #2 (permalink)  
Old 04-21-10, 07:38
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
The supported method of accessing the catalog is via SYSCAT.* views, precisely for this reason.
Reply With Quote
  #3 (permalink)  
Old 04-21-10, 07:44
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thanks, but my concern is to use that indexes query, just replacing by syscat.views may not help.

Regards
Reply With Quote
  #4 (permalink)  
Old 04-21-10, 16:05
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Send a note to Lenny and ask him to update his query for DB2 LUW 9.5.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 04-21-10, 17:22
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Thumbs up Now query improved and became more informative

Now this query a little bit modified and become more informative:

Code:
select 
       case 
         when (mn.minix = si.name and sk.colseq = 1) then si.tbname
         else ' '
        end  table_nme,
       case 
         when (sk.colseq = 1) then si.name 
         else ' '
       end index_nme,
       sk.colname, 
       case
          when sc.coltype = 'CHAR' 
         then  strip(sc.coltype) || '(' || varchar(sc.length) || ')' 
          when sc.coltype = 'FLOAT' and sc.length = 2
         then  'DOUBLE'
          when sc.coltype = 'VARCHAR' 
         then  strip(sc.coltype) || '(' || varchar(sc.length) || ')'
          when sc.coltype = 'DECIMAL' 
         then  strip(sc.coltype) || '(' || varchar(sc.length) || ', ' 
                                        || varchar(scale) || ')'
         else  sc.coltype 
       end    as coltype,      
       sk.colseq,
       case 
         when (sk.colseq = 1) then '      ' || si.UNIQUERULE
         else ' '
       end UNIQUERULE
 from sysibm.sysindexes  si
   join
      sysibm.syskeys     sk 
   on si.name      = sk.ixname
   join  
      sysibm.syscolumns  sc 
   on sc.tbname    = si.tbname    
      and
      sc.name      = sk.colname
	and
	sc.tbcreator = si.tbcreator
   join table
      (select min(name) minix, tbname
         from sysibm.sysindexes mn
         where   mn.tbcreator = sc.tbcreator 
         group by tbname) mn
   on
       mn.tbname = si.tbname    
           
where     
si.tbname in (ucase('your_tab1'), 
                   ucase('your_tab2'))                      
and
 si.tbcreator = ucase('your_creator')

order by si.tbname, si.name, sk.colseq
with ur;
Lenny

Last edited by Lenny77; 04-21-10 at 17:29.
Reply With Quote
  #6 (permalink)  
Old 04-21-10, 17:28
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by Lenny77 View Post
Now this query a little bit modified and become more informative:
Is it still "working in all system of DB2 and good for all DB2 versions"?
Reply With Quote
  #7 (permalink)  
Old 04-21-10, 17:33
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Smile I remember tale about Bear-painter

Quote:
Originally Posted by n_i View Post
Is it still "working in all system of DB2 and good for all DB2 versions"?
I am using this query heavy.

At least it's good for one man in Universe.

I know somebody in my company who use it also.

Lenny
Reply With Quote
  #8 (permalink)  
Old 04-21-10, 18:18
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
It looks like no one had tried running Lenny's original query on DB2 LUW.

The SYSIBM.SYSKEYS table contains one row for each column of an index key:
IBM Information Management Software for z/OS Solutions Information Center


SYSCAT.INDEXCOLUSE catalog view - Each row represents a column that participates in an index:
IBM DB2 9.5 Information Center for Linux, UNIX, and Windows


I guess DBFinder could modify the query to use this view instead of syskeys.
Reply With Quote
  #9 (permalink)  
Old 04-22-10, 03:04
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
If you use any of the tables in schema SYSIBM (except for SYSIBM.SYSDUMMY1), you are begging for problems in the long run. You should only use the documented interfaces, i.e. SYSCAT.INDEXES.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #10 (permalink)  
Old 04-22-10, 07:23
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Quote:
Originally Posted by Lenny77 View Post
I am using this query heavy.

At least it's good for one man in Universe.

I know somebody in my company who use it also.

Lenny
What version DB2 ?

I am on V9.5.5, this does not have sysibm.syskeys.

Will work around, just wanted to make sure that I am not making any mistake !!

Thanks Lenny, this was a good contribution.

DBFinder
Reply With Quote
  #11 (permalink)  
Old 04-22-10, 10:57
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Thumbs down V8...

Quote:
Originally Posted by DBFinder View Post
What version DB2 ?

I am on V9.5.5, this does not have sysibm.syskeys.

Will work around, just wanted to make sure that I am not making any mistake !!

Thanks Lenny, this was a good contribution.

DBFinder
Unfortunately for our common business, I am working for huge and conservative organization. Maybe the biggest in the world.

We still use Version 8 of DB2.

Lenny
Reply With Quote
  #12 (permalink)  
Old 04-22-10, 11:30
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Quote:
Originally Posted by Lenny77 View Post
Unfortunately for our common business, I am working for huge and conservative organization. Maybe the biggest in the world.

Lenny
Not bad, as long as you are progressive.

I wish, ever, me and the girl visit your wonderful organization.

BTW: I have upgraded all servers in our small company, I am still suffering. May be your guys are not willing to take risk.
Let me make clear, suffering means that I had hard time fixing incompatibilities by work-arounds. We have IBM support but by the time they really help you ; you cannot afford even 1 hour downtime on your production databases.

Cheers
DBFinder

Last edited by DBFinder; 04-22-10 at 11:36.
Reply With Quote
  #13 (permalink)  
Old 04-22-10, 12:24
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Wink Nashe delo pravoe - pobeda budet za nami !

Quote:
Originally Posted by DBFinder View Post
Not bad, as long as you are progressive.

I wish, ever, me and the girl visit your wonderful organization.

BTW: I have upgraded all servers in our small company, I am still suffering. May be your guys are not willing to take risk.
Let me make clear, suffering means that I had hard time fixing incompatibilities by work-arounds. We have IBM support but by the time they really help you ; you cannot afford even 1 hour downtime on your production databases.

Cheers
DBFinder
Remember what said Molotov on June 22 1941 !

Lenny
Reply With Quote
  #14 (permalink)  
Old 04-22-10, 13:38
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Quote:
Originally Posted by DBFinder View Post
What version DB2 ?

I am on V9.5.5, this does not have sysibm.syskeys.

DBFinder

Lenny is using mainframe so he doesn't need to worry about those syscat views.
Reply With Quote
  #15 (permalink)  
Old 04-22-10, 13:41
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Lenny, you would need to translate "Nashe ....." for DBFinder
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On