Oracle- 授予所有特权?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36446661/
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
Oracle- GRANT ALL PRIVILEGES?
提问by java123999
Whenever I give a user "all privileges" in ORACLE (example below), what does this actually do?
每当我在 ORACLE 中授予用户“所有权限”(下面的示例)时,这实际上是做什么的?
My understanding is that it gives a user any privilege, e.g inserting, deleting etc within that schemabut notto any schema in the DB?
我的理解是它赋予用户任何特权,例如在该架构中插入、删除等,但不授予数据库中的任何架构?
grant all privileges to my_user;
回答by Alex Poole
You can grant all [privileges] on <some object>
, but you aren't specifying an object; so you are granting system privileges:
你可以grant all [privileges] on <some object>
,但你没有指定一个对象;所以你要授予系统权限:
The documentation for system privilegessays:
Oracle Database provides the ALL PRIVILEGES shortcut for granting all the system privileges listed in Table 18-1, except the SELECT ANY DICTIONARY, ALTER DATABASE LINK, and ALTER PUBLIC DATABASE LINK privileges.
Oracle 数据库提供了 ALL PRIVILEGES 快捷方式,用于授予表 18-1 中列出的所有系统权限,但 SELECT ANY DICTIONARY、ALTER DATABASE LINK 和 ALTER PUBLIC DATABASE LINK 权限除外。
System privileges are not always restricted to a schema. That table includes a lot of ANY
privileges, which are specifically notrestricted to a schema. If you grant all privileges
to a user they will be able to create or alter a table in any schema, for example. That probably isn't what you want.
系统权限并不总是限于模式。该表包含许多ANY
特权,这些特权并不仅限于模式。例如,如果您grant all privileges
是用户,他们将能够在任何模式中创建或更改表。那可能不是你想要的。
There is no shortcut to grant only schema-restricted privileges. You'll need to grant CREATE TABLE
, CREATE INDEX
, etc. explicitly.
没有捷径可以只授予架构限制的权限。你需要授予CREATE TABLE
,CREATE INDEX
明确等。
It's common practice to create a roleto which you grant the necessary privileges, and then you just have to grant that role to your users. (Although you sometimes still need to grant privileges directly to users, e.g. if they are required in a stored procedure).
通常的做法是创建一个角色,您为其授予必要的权限,然后您只需将该角色授予您的用户。(尽管有时您仍然需要直接向用户授予权限,例如,如果在存储过程中需要权限)。