我看到了一些奇怪的行为,并尝试使用虚拟的和简单的代码进行复制。这是关于创建同义词的。我有这个oracle 11g脚本:
begin
execute immediate 'drop view user1.v1';
exception
when others then
null;
end;
/
begin
execute immediate 'drop view user1.v2';
exception
when others then
null;
end;
/
begin
execute immediate 'drop public synonym v1';
exception
when others then
null;
end;
/
begin
execute immediate 'drop public synonym v2';
exception
when others then
null;
end;
上面的片段应该删除任何相关的对象。为了保证这一点,我查询了select o.* from all_objects o where o.object_name = 'V1' or o.object_name = 'V2'
(让我们将此查询称为Q1),它什么也没返回。然后我运行了这个
create or replace force view user1.v1 as
select * from dual;
create or replace force view user1.v2 as
select v1.dummy || '2' as new_dummy from v1;
使用Q1,我有两个正确的视图,应该是。我测试了select * from v1,v2
(Q2)进行检查。没关系。
但是所有这些都以用户user1的身份登录,尝试用user2进行Q2显然返回了ORA-00942: table or view does not exist
。然后我想为其创建同义词:
begin
execute immediate 'create public synonym v1 for user1.v1';
end;
/
begin
execute immediate 'create public synonym v2 for user1.v2';
end;
我想删除与v1
和v2
相关的任何对象或同义词,然后创建它们,对其进行测试,最后创建一些公共同义词以供全局使用。创建它们后,标题出现错误。我做了select * from dba_users
,发现user1的EDITIONS_ENABLED
为Y
。所有这些在其他数据库的开发人员中都可以正常工作。我可以配置些什么来实现这一目标?