| |
|
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.
|
 |
|

04-21-10, 07:03
|
|
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
|
|

04-21-10, 07:38
|
|
:-)
|
|
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.
|
|

04-21-10, 07:44
|
|
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
|
|

04-21-10, 16:05
|
|
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
|
|

04-21-10, 17:22
|
|
Registered User
|
|
Join Date: Jul 2009
Location: NY
Posts: 886
|
|
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.
|

04-21-10, 17:28
|
|
:-)
|
|
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
|
|
Quote:
Originally Posted by Lenny77
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"?
|
|

04-21-10, 17:33
|
|
Registered User
|
|
Join Date: Jul 2009
Location: NY
Posts: 886
|
|
I remember tale about Bear-painter
Quote:
Originally Posted by n_i
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
|
|

04-21-10, 18:18
|
|
∞∞∞∞∞∞
|
|
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
|
|
|
|

04-22-10, 03:04
|
|
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
|
|

04-22-10, 07:23
|
|
Registered User
|
|
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
|
|
Quote:
Originally Posted by Lenny77
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
|
|

04-22-10, 10:57
|
|
Registered User
|
|
Join Date: Jul 2009
Location: NY
Posts: 886
|
|
V8...
Quote:
Originally Posted by DBFinder
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
|
|

04-22-10, 11:30
|
|
Registered User
|
|
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
|
|
Quote:
Originally Posted by Lenny77
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.
|

04-22-10, 12:24
|
|
Registered User
|
|
Join Date: Jul 2009
Location: NY
Posts: 886
|
|
Nashe delo pravoe - pobeda budet za nami !
Quote:
Originally Posted by DBFinder
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
|
|

04-22-10, 13:38
|
|
∞∞∞∞∞∞
|
|
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
|
|
Quote:
Originally Posted by DBFinder
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.
|
|

04-22-10, 13:41
|
|
∞∞∞∞∞∞
|
|
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
|
|
Lenny, you would need to translate "Nashe ....." for DBFinder
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|