drox
drox

Reputation: 8263

How to find the type of a DB2 object

I'm trying to revoke privileges of a user and to do so I have to know the types of DB objects. For example revoke command for a table would we different of a sequence.

When I ran the following query, some objects were returned with arbitrary object names. I have given one such result below

SELECT * FROM SYSIBMADM.PRIVILEGES WHERE AUTHID = SESSION_USER AND AUTHIDTYPE = 'U'

AUTHID    AUTHIDTYPE PRIVILEGE   GRANTABLE OBJECTNAME
DB2USER   U          CONTROL     N         SQL140423185953800

How can I find the object type (e.g. table, sequence, etc) of SQL140423185953800?

Upvotes: 0

Views: 1519

Answers (1)

AngocA
AngocA

Reputation: 7693

I have created a stored procedure that tries to solve this problem. You just need to execute the code to create the procedure, and then call it with the right parameters. The code is hosted here: https://gist.github.com/angoca/7434525

It does a select in multiple tables, looking for the object you are passing as parameter.

Upvotes: 1

Related Questions