数据库权限管理
2014-12-30 15:39 Ivan的一亩三分地 阅读(786) 评论(0) 编辑 收藏 举报格式化查询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"