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

问题描述 投票:0回答:2

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

oracle oracle11g privileges
2个回答
0
投票

据我所知-不,你不能。

但是,如果可以,您可以>>

  • 创建的角色
  • 授予这些角色的特权
  • 授予用户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>

0
投票

与@Littlefoot答案有关。

© www.soinside.com 2019 - 2024. All rights reserved.