MainframeSupports
tip week 39/2014:

Ten weeks ago I wrote a tip about how you obtain access to create a DB2 table even though it seems you do not have authorisation in the first place. Now the time has come to write about creating indexes where it may seem impossible.

If you are the creator of the table you want to create a index on then you automatically have access to create indexes on that table. If you are denied acces despite this fact it is because you lack authorisation to use the stogroup (storarage group) or the bpool (bufferpool) connected to the database your table is created in. It is the database your table is created in that controls which storage group and bufferpool your index is created with.

Fortunately you can control which storage group and bufferpool is used when you create an index. First of all you need to find out which bufferpools and storage groups you actually have access to. Please use a:

select char(name,8) name, obtype
from sysibm.sysresauth
where grantee = 'PUBLIC' and obtype in ('B','S')
;
An example of a result:
NAME     OBTYPE
--------+------
BP0      B
BP1      B
SYSDEFLT S

OBTYPE B are the bufferpools and OBTYPE S are the storage groups you can attach to your index. Now you just need to append USING STOGROUP <stogroup> BUFFERPOOL <bpool> to your CREATE INDEX SQL statement and replace <stogroup> and <bpool> with relevant values from the result of the above select statement. If the above select did not return any rows having both OBTYPE B and S then you are not able to create any indexes on the involved DB2 subsystem. Your last resort is to contact the most friendly DBA you know on the installation and make this person help you.

Previous tip in english        Forrige danske tip        Tip list