gpt4 book ai didi

oracle - 获取 ORA-01031 : insufficient privileges while querying a table instead of ORA-00942: table or view does not exist

转载 作者:行者123 更新时间:2023-12-04 02:17:19 24 4
gpt4 key购买 nike

当我从模式 A 查询模式 C 中的表时,我得到 ORA-01031: 权限不足 当我从模式 B 查询同一个表时,我得到 ORA-00942: 表或 View 不存在 .在表上,这两个模式都没有任何权限。为什么在这种情况下我会收到不同的错误消息?

最佳答案

您可能会收到 ORA-01031: insufficient privileges而不是 ORA-00942: table or view does not exist当您在表上至少拥有一项特权,但没有必要的特权时。

创建模式

SQL> create user schemaA identified by schemaA;

User created.

SQL> create user schemaB identified by schemaB;

User created.

SQL> create user test_user identified by test_user;

User created.

SQL> grant connect to test_user;

Grant succeeded.

创建对象和权限

在不授予 SELECT 的情况下授予模式像 DELETE 这样的权限是不寻常的,但也是可能的。
SQL> create table schemaA.table1(a number);

Table created.

SQL> create table schemaB.table2(a number);

Table created.

SQL> grant delete on schemaB.table2 to test_user;

Grant succeeded.

以 TEST_USER 身份连接并尝试查询表

这表明对表具有某些特权会更改错误消息。
SQL> select * from schemaA.table1;
select * from schemaA.table1
*
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> select * from schemaB.table2;
select * from schemaB.table2
*
ERROR at line 1:
ORA-01031: insufficient privileges


SQL>

关于oracle - 获取 ORA-01031 : insufficient privileges while querying a table instead of ORA-00942: table or view does not exist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20988572/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com