oracle 创建同义词 ora-01031 权限不足

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24830023/
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-10 05:42:19  来源:igfitidea点击:

create synonym ora-01031 insufficient privileges

oracleschemaprivilegesgrantsynonym

提问by user1289330

I need help understanding what grants/privileges a user needs to CREATE a SYNONYM when it points to another (different) schema object.

我需要帮助了解用户在指向另一个(不同的)模式对象时创建同义词需要什么授予/特权。

When I try the below, I get ora-01031 insufficient privileges, so obviously I am missing and failing to apply other needed privileges. I did search as well as I could but couldn't find anything specific to cross-schema synonyms.

当我尝试以下操作时,我获得的 ora-01031 权限不足,因此显然我缺少并且无法应用其他所需的权限。我做了尽可能多的搜索,但找不到任何特定于跨模式同义词的内容。

CREATE USER test IDENTIFIED BY pw DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
ALTER USER test IDENTIFIED BY pw;
GRANT CONNECT, RESOURCE TO test;

-- ... create a bunch of stuff in test...

CREATE USER READWRITE IDENTIFIED BY pw DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE    TEMP;
ALTER USER READWRITE IDENTIFIED BY pw;
GRANT CONNECT, RESOURCE TO READWRITE;

GRANT SELECT ON GDACS.FIXALARMS TO PUBLIC;
GRANT UPDATE, INSERT ON GDACS.FIXALARMS TO READWRITE; 

CONNECT READWRITE/pw;

CREATE SYNONYM FIXALARMS for test.FIXALARMS;
ORA-01031 insufficient privileges

回答by Alex Poole

The documentation for the CREATE SYNONYMcommandincludes:

用于该文档CREATE SYNONYM命令包括:

Prerequisites

To create a private synonym in your own schema, you must have the CREATE SYNONYMsystem privilege.

To create a private synonym in another user's schema, you must have the CREATE ANY SYNONYMsystem privilege.

To create a PUBLICsynonym, you must have the CREATE PUBLIC SYNONYMsystem privilege.

先决条件

要在您自己的架构中创建私有同义词,您必须具有 CREATE SYNONYM系统权限。

要在另一个用户的架构中创建私有同义词,您必须具有CREATE ANY SYNONYM系统权限。

要创建PUBLIC同义词,您必须具有CREATE PUBLIC SYNONYM系统权限。

You're trying to create a private synonym in READWRITE's own schema, so you have to have to do:

您正在尝试在READWRITE自己的架构中创建私有同义词,因此您必须执行以下操作:

GRANT CREATE SYNONYM TO READWRITE;

The object the synonym is pointing to is in a different schema, but that isn't relevant here.

同义词指向的对象位于不同的模式中,但这与此处无关。



If your new account is only going to access objects in the GDACS schema, and particularly if you have a lot of objects you want to grant access to, then as an alternative to having to create synonyms for everything you could alter the new user's current_schemain each session - possibly via a logon trigger.

如果您的新帐户只会访问对象在GDACS模式,特别是如果你有大量的对象要授予访问权限,那么作为替代具有创造一切的同义词,你可以改变新用户的current_schema每会话 - 可能通过登录触发器