即使具有SELECT特权也无法选择表 [英] Not able to select a table even if having SELECT privilege

查看:174
本文介绍了即使具有SELECT特权也无法选择表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个用户,USER1USER2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆