Search code examples
db2ddluser-permissionsdb2-luw

What minimum permissions requires to execute an undocumented stored procedure called SYSPROC.DB2LK_GENERATE_DDL?


I don't want to execute the stored procedure with admin privileges or with the instance owner. I am looking for the minimum permissions required to execute an undocumented stored procedure called SYSPROC.DB2LK_GENERATE_DDL for extracting the DDL statements from a DB2 database.

For example: I tried with SELECT and EXCEUTE permissions but it's not working:

db2 grant SELECT on SYSTOOLS.DB2LOOK_INFO to user devuser

db2 grant execute on procedure SYSPROC.DB2LK_GENERATE_DDL to user devuser`

Solution

  • You should call this routine once as some administrative user with appropriate privileges to create necessary objects implicitly in the database.
    Grant the following privileges to your user afterwards.

    grant usage on sequence SYSTOOLS.DB2LOOK_TOKEN to user myuser;
    grant select on table SYSTOOLS.DB2LOOK_INFO_V to user myuser;
    grant select, update, delete, insert on table SYSTOOLS.DB2LOOK_INFO to user myuser;