创建一个具有特定 SCHEMA 完全访问权限的新用户 ORACLE

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2379557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 20:07:35  来源:igfitidea点击:

Create a New user ORACLE with full access to an specific SCHEMA

sqloracleschemaoracle11gprivileges

提问by Salvador

How can create a New user in ORACLE with full access (alter, delete, select, inset, debug, etc) to an only onespecific SCHEMA.

如何在 ORACLE 中创建一个对一个特定 SCHEMA具有完全访问权限(更改、删除、选择、插入、调试等)的新用户。

回答by APC

Cannot be done. In Oracle privileges are granted on specific objects, unless you have the highpowered ANY privileges, which grant access to any object in any schema.

做不到。在 Oracle 中,权限是针对特定对象授予的,除非您拥有强大的 ANY 权限,该权限授予对任何架构中的任何对象的访问权限。

This is one of those things which seems quite annoying but actually is quite sound. There is no good business reason for granting privileges on all on the objects in a schema en masse. Either

这是看起来很烦人但实际上很合理的事情之一。授予对模式中所有对象的特权的商业理由并不充分。任何一个

  1. the second schema really needsjust a sub-set of privilges on a sub-set of objects; or
  2. the second schema is entirely unnecessary.
  1. 第二个模式实际上只需要一个对象子集的特权子集;或者
  2. 第二种模式完全没有必要。

Now it may be that the sub-set in the first instance is a very large sub-set. But laziness is not an excuse for poor security practices.

现在可能是第一个实例中的子集是一个非常大的子集。但懒惰并不是不良安全实践的借口。

What we can do is generate the grant statements from the data dictionary:

我们可以做的是从数据字典中生成授权语句:

select 'grant select on '||table_name||' to B'
from   user_tables
/

(for a script to be run by user A).

(对于要由用户 A 运行的脚本)。

This is still better than granting privileges on the schema, because it means at least any new object added by user A will not automatically be propagated to B without an additional action and, hence, without some additional thought as to whether it is appropriate.

这仍然比授予架构上的特权要好,因为这意味着至少用户 A 添加的任何新对象都不会在没有额外操作的情况下自动传播到 B,因此,无需额外考虑是否合适。

回答by Gary Myers

You could use a PROXY user. Its not quite the same thing as it allows one database user to connect as another but using their own password. You can therefore have multiple users, each with their own password, using the same schema.

您可以使用PROXY 用户。它不完全相同,因为它允许一个数据库用户作为另一个用户连接但使用他们自己的密码。因此,您可以让多个用户使用相同的架构,每个用户都有自己的密码。

An example of the code is here.

代码示例在此处