如何将现有用户的所有权限分配给 Oracle 11g 中的新用户?
How to assign all the privileges of existing user to new user in Oracle 11g?
我有一个用户'abc'。现在我已经创建了新用户 xyz。我可以将用户 'abc' 的所有权限一次性分配给新用户 'xyz' 吗?请帮助我。
据我所知 - 不,你不能。
但是,如果你
- 已创建角色
- 授予这些角色权限
- 向用户授予角色
abc
- 然后,在创建用户
xyz
后,您只需将这些角色授予它
如果你想这样做"manually",你首先必须找出abc
有什么权限,然后将它们授予xyz
。
在哪里看?词典有多种选择,例如
SQL> select table_name, substr(comments, 1, 50) || ' ...' comments
2 From dictionary where lower(table_name) like '%priv%';
TABLE_NAME COMMENTS
------------------------------ -------------------------------------------------------
ALL_COL_PRIVS Grants on columns for which the user is the granto ...
ALL_COL_PRIVS_MADE Grants on columns for which the user is owner or g ...
ALL_COL_PRIVS_RECD Grants on columns for which the user, PUBLIC or en ...
ALL_REPGROUP_PRIVILEGES Information about users who are registered for obj ...
ALL_TAB_PRIVS Grants on objects for which the user is the granto ...
ALL_TAB_PRIVS_MADE User's grants and grants on user's objects ...
ALL_TAB_PRIVS_RECD Grants on objects for which the user, PUBLIC or en ...
ALL_XSC_AGGREGATE_PRIVILEGE All privileges that make up an aggregate privilege ...
ALL_XSC_PRIVILEGE All mappings of privileges to security classes in ...
USER_AQ_AGENT_PRIVS ...
USER_COL_PRIVS Grants on columns for which the user is the owner, ...
USER_COL_PRIVS_MADE All grants on columns of objects owned by the user ...
USER_COL_PRIVS_RECD Grants on columns for which the user is the grante ...
USER_GOLDENGATE_PRIVILEGES Details about goldengate privileges ...
USER_NETWORK_ACL_PRIVILEGES User privileges to access network hosts through PL ...
USER_REPGROUP_PRIVILEGES Information about users who are registered for obj ...
USER_ROLE_PRIVS Roles granted to current user ...
USER_RSRC_CONSUMER_GROUP_PRIVS Switch privileges for consumer groups for the user ...
USER_RSRC_MANAGER_SYSTEM_PRIVS system privileges for the resource manager for the ...
USER_SYS_PRIVS System privileges granted to current user ...
USER_TAB_PRIVS Grants on objects for which the user is the owner, ...
USER_TAB_PRIVS_MADE All grants on objects owned by the user ...
USER_TAB_PRIVS_RECD Grants on objects for which the user is the grante ...
COLUMN_PRIVILEGES Grants on columns for which the user is the granto ...
ROLE_ROLE_PRIVS Roles which are granted to roles ...
ROLE_SYS_PRIVS System privileges granted to roles ...
ROLE_TAB_PRIVS Table privileges granted to roles ...
SESSION_PRIVS Privileges which the user currently has set ...
TABLE_PRIVILEGES Grants on objects for which the user is the granto ...
29 rows selected.
SQL>
关于@Littlefoot 的回答。
您可以从此处答案中的其中一个表格中复制用户权限 How to find the privileges and roles granted to a user in Oracle?
对于第一个用户并将它们复制到一个脚本中,该脚本将授予第二个用户所需的权限。这是一种解决方法,但应该可以正常工作
我有一个用户'abc'。现在我已经创建了新用户 xyz。我可以将用户 'abc' 的所有权限一次性分配给新用户 'xyz' 吗?请帮助我。
据我所知 - 不,你不能。
但是,如果你
- 已创建角色
- 授予这些角色权限
- 向用户授予角色
abc
- 然后,在创建用户
xyz
后,您只需将这些角色授予它
如果你想这样做"manually",你首先必须找出abc
有什么权限,然后将它们授予xyz
。
在哪里看?词典有多种选择,例如
SQL> select table_name, substr(comments, 1, 50) || ' ...' comments
2 From dictionary where lower(table_name) like '%priv%';
TABLE_NAME COMMENTS
------------------------------ -------------------------------------------------------
ALL_COL_PRIVS Grants on columns for which the user is the granto ...
ALL_COL_PRIVS_MADE Grants on columns for which the user is owner or g ...
ALL_COL_PRIVS_RECD Grants on columns for which the user, PUBLIC or en ...
ALL_REPGROUP_PRIVILEGES Information about users who are registered for obj ...
ALL_TAB_PRIVS Grants on objects for which the user is the granto ...
ALL_TAB_PRIVS_MADE User's grants and grants on user's objects ...
ALL_TAB_PRIVS_RECD Grants on objects for which the user, PUBLIC or en ...
ALL_XSC_AGGREGATE_PRIVILEGE All privileges that make up an aggregate privilege ...
ALL_XSC_PRIVILEGE All mappings of privileges to security classes in ...
USER_AQ_AGENT_PRIVS ...
USER_COL_PRIVS Grants on columns for which the user is the owner, ...
USER_COL_PRIVS_MADE All grants on columns of objects owned by the user ...
USER_COL_PRIVS_RECD Grants on columns for which the user is the grante ...
USER_GOLDENGATE_PRIVILEGES Details about goldengate privileges ...
USER_NETWORK_ACL_PRIVILEGES User privileges to access network hosts through PL ...
USER_REPGROUP_PRIVILEGES Information about users who are registered for obj ...
USER_ROLE_PRIVS Roles granted to current user ...
USER_RSRC_CONSUMER_GROUP_PRIVS Switch privileges for consumer groups for the user ...
USER_RSRC_MANAGER_SYSTEM_PRIVS system privileges for the resource manager for the ...
USER_SYS_PRIVS System privileges granted to current user ...
USER_TAB_PRIVS Grants on objects for which the user is the owner, ...
USER_TAB_PRIVS_MADE All grants on objects owned by the user ...
USER_TAB_PRIVS_RECD Grants on objects for which the user is the grante ...
COLUMN_PRIVILEGES Grants on columns for which the user is the granto ...
ROLE_ROLE_PRIVS Roles which are granted to roles ...
ROLE_SYS_PRIVS System privileges granted to roles ...
ROLE_TAB_PRIVS Table privileges granted to roles ...
SESSION_PRIVS Privileges which the user currently has set ...
TABLE_PRIVILEGES Grants on objects for which the user is the granto ...
29 rows selected.
SQL>
关于@Littlefoot 的回答。
您可以从此处答案中的其中一个表格中复制用户权限 How to find the privileges and roles granted to a user in Oracle? 对于第一个用户并将它们复制到一个脚本中,该脚本将授予第二个用户所需的权限。这是一种解决方法,但应该可以正常工作