如何使用SQL显示IBM DB2 Z/OS中表上的当前权限



是否有一种SQL方法来显示DB2 Z/OS中表或视图上存在的特权?我想实现这样的东西:

select * from sysibm.magic_table where table_name = 'users'
|TABLE_NAME|PRIVILEGE_TYPE|USER_OR_GROUP_NAME|
|     USERS|        INSERT|              ANDI|
|     USERS|        SELECT|            ADMINS|

这可能吗?

这个查询告诉grantee列中的用户/角色名以及Y = right present, G = right present和授予他人权限的...auth列中分配的各种权限。

SELECT
    grantee,
    screator,
    stname,
    tcreator,
    ttname,
    updatecols,
    alterauth,
    deleteauth,
    indexauth,
    insertauth,
    selectauth,
    updateauth
FROM
    SYSIBM.SYSTABAUTH
WHERE
    TTNAME = 'MY_TABLE'
    AND TCREATOR = 'MY_SCHEMA' 

示例结果集:

|GRANTEE  |SCREATOR |STNAME  |TCREATOR |TTNAME  |UPDATECOLS|ALTERAUTH|DELETEAUTH|INDEXAUTH|INSERTAUTH|SELECTAUTH|UPDATEAUTH|
============================================================================================================================
|MY_SCHEMA|MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE|          |         |         G|         |         G|         G|         G|
|USER2    |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE|          |         |         Y|         |         Y|         Y|         Y|
|USER3    |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE|          |         |         Y|         |         Y|         Y|         Y|
|GROUP1   |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE|          |         |         Y|         |         Y|         Y|         Y|
|GROUP2   |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE|          |         |         Y|         |         Y|         Y|         Y|
|GROUP3   |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE|          |         |          |         |          |         Y|          |
|GROUP4   |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE|          |         |         Y|         |         Y|         Y|         Y|

SYSIBM的IBM文档。SYSTABAUTH(感谢@mustaccio)

相关内容

  • 没有找到相关文章

最新更新