如何在Oracle 11g中将现有用户的所有权限分配给新用户?



我有一个用户'abc'。现在我已经创建了新用户 xyz。我可以一次性将用户"abc"的所有权限分配给新用户"xyz"吗?请帮助我。

关于@Littlefoot答案。

您可以从此处答案中的一个表中复制用户权限 如何在 Oracle 中查找授予用户的权限和角色? 并将其复制到脚本中,该脚本将授予第二个用户所需的权限。这是一种解决方法,但它应该可以正常工作

据我所知 - 不,你不能。

但是,如果你

  • 创建的角色
  • 向这些角色授予权限
  • 向用户abc授予角色
  • 然后,在创建用户xyz后,您只需将这些角色授予它

如果要"手动"执行此操作,则首先必须找出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>

最新更新