I have a user that needs the grant option adding. I have tried the following command;
我有一个用户需要添加授权选项。我试过以下命令;
grant myrole to myuser with grant option
However I get the error;
但是我得到了错误;
Dynamic SQL Error SQL error code = -104 Token unknown - line 1, column 29 grant
I have also tried revoking the role and then granting the role again. But I get the same error.
我也尝试撤销角色,然后再次授予角色。但我得到了同样的错误。
I am only able to grant the role without the grant option. I have checked the manual for the correct syntax, but I cannot see what I am doing wrong.
我只能在没有授权选项的情况下授予角色。我已经检查了手册中的正确语法,但我看不出我做错了什么。
2 个解决方案
#1
4
The GRANT
clause with grant option
is only for privileges, not for roles. For roles you need to use with admin option
.
带有grant选项的GRANT子句仅用于特权,而不用于角色。对于您需要与admin选项一起使用的角色。
GRANT <role_granted>
TO <role_grantee_list> [WITH ADMIN OPTION]
[{GRANTED BY | AS} [USER] grantor]
The optional
WITH ADMIN OPTION
clause allows the users specified in the user list to grant the role[s] specified to other users.可选的WITH ADMIN OPTION子句允许用户列表中指定的用户授予指定给其他用户的角色[s]。
#2
2
Granting privileges seems to allow the use of 'with grant option'
授予权限似乎允许使用'with grant option'
GRANT {
<privileges> ON [TABLE] {tablename | viewname}
| EXECUTE ON PROCEDURE procname
}
TO <grantee_list>
[WITH GRANT OPTION]} | [{GRANTED BY | AS} [USER] grantor];
but granting a role doesn't seem to allow 'with grant option'. It has the 'with admin option' which is why I presume the error occurred once it came across the word 'grant' rather than 'admin' after the word 'with'.
但授予角色似乎不允许“使用授权选项”。它有'with admin选项',这就是为什么我假设错误发生一旦遇到'grant'这个词而不是'with'后面的'admin'。
GRANT <role_granted>
TO <role_grantee_list> [WITH ADMIN OPTION]
[{GRANTED BY | AS} [USER] grantor]
#1
4
The GRANT
clause with grant option
is only for privileges, not for roles. For roles you need to use with admin option
.
带有grant选项的GRANT子句仅用于特权,而不用于角色。对于您需要与admin选项一起使用的角色。
GRANT <role_granted>
TO <role_grantee_list> [WITH ADMIN OPTION]
[{GRANTED BY | AS} [USER] grantor]
The optional
WITH ADMIN OPTION
clause allows the users specified in the user list to grant the role[s] specified to other users.可选的WITH ADMIN OPTION子句允许用户列表中指定的用户授予指定给其他用户的角色[s]。
#2
2
Granting privileges seems to allow the use of 'with grant option'
授予权限似乎允许使用'with grant option'
GRANT {
<privileges> ON [TABLE] {tablename | viewname}
| EXECUTE ON PROCEDURE procname
}
TO <grantee_list>
[WITH GRANT OPTION]} | [{GRANTED BY | AS} [USER] grantor];
but granting a role doesn't seem to allow 'with grant option'. It has the 'with admin option' which is why I presume the error occurred once it came across the word 'grant' rather than 'admin' after the word 'with'.
但授予角色似乎不允许“使用授权选项”。它有'with admin选项',这就是为什么我假设错误发生一旦遇到'grant'这个词而不是'with'后面的'admin'。
GRANT <role_granted>
TO <role_grantee_list> [WITH ADMIN OPTION]
[{GRANTED BY | AS} [USER] grantor]