数据库权限管理

格式化查询db权限
db2 " SELECT SUBSTR(GRANTOR, 1, 10) AS GRANTOR, -- Grantor of the authority
SUBSTR(GRANTEE, 1, 10) AS GRANTEE, -- Holder of the authority
-- G = Grantee is a group R = Grantee is a role
GRANTEETYPE, -- U = Grantee is an individual user
BINDADDAUTH,
CONNECTAUTH,
CREATETABAUTH,
DBADMAUTH,
IMPLSCHEMAAUTH,
DATAACCESSAUTH,
LOADAUTH
FROM SYSCAT.DBAUTH
ORDER BY GRANTEE WITH UR "


db2 "select GRANTEE,GRANTEETYPE,SECURITYADMAUTH,DBADMAUTH,ACCESSCTRLAUTH,DATAACCESSAUTH from syscat.dbauth where grantee=‘DB2INST1‘ or grantee=‘ROOT‘"
db2 "grant secadm,dbadm,accessctrl,dataaccess on database to user root"

实例本身没有访问数据的权限时,无法管理权限
. /home/db2inst1/.profile
db2 "select GRANTEE,GRANTEETYPE,SECURITYADMAUTH,DBADMAUTH,ACCESSCTRLAUTH,DATAACCESSAUTH from syscat.dbauth where grantee=‘DB2INST1‘ or grantee=‘ROOT‘"
db2 "grant secadm,dbadm,accessctrl,dataaccess on database to user db2inst1"
db2 "revoke secadm,dbadm,accessctrl,dataaccess on database from user root"

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。