简体   繁体   English

Oracle:表或视图不存在?

[英]Oracle : table or view doesn't exist?

I have a schema in oracle in which I have some tables, let's say Table1 (I'm sure it exists) 我在oracle中有一个架构,其中有一些表,例如Table1(我确定它存在)

When I query the table using the same schema : 当我使用相同的 模式查询表时:

select * from Table1; 

I have the error "table or view doesn't exit" 我有错误“表格或视图无法退出”

I suspect something related to table space... because when I created the user 我怀疑与表空间有关的东西...因为当我创建用户时

CREATE USER MyUser IDENTIFIED BY password DEFAULT TABLESPACE MyTableSpace;

I set a different default table space. 我设置了另一个默认表空间。

I tried 我试过了

select * from MyTableSpace.Table1; 
select * from MyUser.Table1;  

But that was unsuccesful. 但这是不成功的。

Does anyone have an idea please ? 请问有人有主意吗?

Thanks. 谢谢。

If I understood you correctly - you have two users (schemes) -User1,User2. 如果我正确理解您-您有两个用户(方案)-User1,User2。 You logged into SQL Developer as User1 and then created Table1. 您以User1身份登录到SQL Developer,然后创建Table1。 Then You login into SQL Developer as User2 and try to execute select * from Table1 and select * from User1.Table1 and it is unsuccessful. 然后,您以User2身份登录到SQL Developer,并尝试执行select * from Table1 select * from User1.Table1成功。

So first you have to grant select access on User1.Table1 to User2. 因此,首先必须向User2授予对User1.Table1的选择访问权限。 To do this you have to login as User1 and execute 为此,您必须以User1身份登录并执行

GRANT SELECT, INSERT ON Table1 TO User2;

After this will be able to execute query (When you are logged in as User2) 之后,将能够执行查询(当您以User2身份登录时)

select * from User1.Table1;

then you have to create synonym in order not to use prefix User1. 那么您必须创建同义词才能不使用前缀User1。 To do this - loggin as User2 and execute 为此-以User2身份登录并执行

CREATE SYNONYM Table1 FOR User1.Table1;

Now you can loggin as User2 and execute: 现在,您可以以User2身份登录并执行:

select * from User1.Table1;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM