即使具有SELECT特权也无法选择表 [英] Not able to select a table even if having SELECT privilege
问题描述
我有两个用户,USER1
和USER2
. USER1
拥有create table
的特权,而USER2
没有此特权.
I have two users, USER1
and USER2
. USER1
has privilege to create table
and USER2
does not have this privilege.
USER1
创建了一个名为EMPLOYEE
的表,并将对该表的select
特权授予了USER2
:
USER1
has created a table called EMPLOYEE
and granted the select
privilege on that table to USER2
:
====== 使用USER1凭据 =======
====== Using USER1 credentials =======
1)创建表-
CREATE TABLE EMPLOYEE
(
EMP_ID NUMBER,
EMP_NAME VARCHAR2 (20 BYTE)
);
2)向用户2授予权限
2) Grant permission to user2
GRANT SELECT ON EMPLOYEE TO USER2;
====== 使用USER2凭据 =======
====== Using USER2 credentials =======
现在,我想使用USER2
凭据访问EMPLOYEE
表:
Now I want to access the EMPLOYEE
table using USER2
credentials:
SELECT * from EMPLOYEE
但是它给出了错误:
ORA-00942: table or view does not exist
请告诉我我在做什么错了?
Please tell me what I am doing wrong here?
推荐答案
尝试一下
SELECT * from USER1.EMPLOYEE;
如果EMPLOYEE表不存在公共同义词,则可能会发生这种情况.因此,您需要使用owner.object
This might happen if there is no public synonym present for EMPLOYEE table. So you need to refer using the owner.object
如果没有得到结果,请发布结果
If not getting results, please post the results of
SELECT
OWNER,
TABLE_NAME
FROM
ALL_TABLES
WHERE
TABLE_NAME IN ('EMPLOYEE');
这篇关于即使具有SELECT特权也无法选择表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!