ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 9.2上ALL_SYNONYMS中缺少指向同义词的同义词

9.2上ALL_SYNONYMS中缺少指向同义词的同义词

原创 Linux操作系统 作者:yangtingkun 时间:2011-07-02 23:53:46 0 删除 编辑

10g以前,ALL_SYNONYMS视图可能会缺少指向同义词的同义词。

 

 

看一个具体的例子:

SQL> conn u1/u1@test9i
Connected.
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
PL/SQL Release 9.2.0.4.0 - Production
CORE 9.2.0.3.0 Production
TNS for Linux: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production

SQL> create table t (id number);

Table created.

SQL> grant select on t to u2;

Grant succeeded.

SQL> create synonym s1 for t;

Synonym created.

SQL> create synonym s2 for s1;

Synonym created.

SQL> select owner, synonym_name, table_owner, table_name
2 from all_synonyms
3 where wner = user;

OWNER      SYNONYM_NAME                   TABLE_OWNE TABLE_NAME
---------- ------------------------------ ---------- ------------------------------
U1         S1                             U1         T
U1         S2                             U1         S1

SQL> conn u2/u2@test9i
Connected.
SQL> select count(*) from u1.t;

COUNT(*)
----------
0

SQL> select count(*) from u1.s1;

COUNT(*)
----------
0

SQL> select count(*) from u1.s2;

COUNT(*)
----------
0

SQL> select owner, synonym_name, table_owner, table_name
2 from all_synonyms
3 where wner = 'U1';

OWNER      SYNONYM_NAME                   TABLE_OWNE TABLE_NAME
---------- ------------------------------ ---------- ------------------------------
U1         S1                             U1         T

可以看到,这个例子中,U1用户可以看到自己创建的所有同义词,但是U2ALL_SYNONYMS视图中看不到执行同义词的同义词S2,但是U2访问这个同义词并没有问题。

这个问题在10g中已经被解决:

SQL> conn u1/u1
Connected.
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

SQL> create table t (id number);

Table created.

SQL> create synonym s1 for t;

Synonym created.

SQL> create synonym s2 for s1;

Synonym created.

SQL> select owner, synonym_name, table_owner, table_name
2 from all_synonyms
3 where wner = user;

OWNER      SYNONYM_NAME                   TABLE_OWNE TABLE_NAME
---------- ------------------------------ ---------- ------------------------------
U1         S1                             U1         T
U1         S2                             U1         S1

SQL> grant select on t to u2;

Grant succeeded.

SQL> conn u2/u2
Connected.
SQL> select count(*) from u1.t;

COUNT(*)
----------
0

SQL> select count(*) from u1.s1;

COUNT(*)
----------
0

SQL> select count(*) from u1.s2;

COUNT(*)
----------
0

SQL> select owner, synonym_name, table_owner, table_name
2 from all_synonyms
3 where wner = 'U1';

OWNER      SYNONYM_NAME                   TABLE_OWNE TABLE_NAME
---------- ------------------------------ ---------- ------------------------------
U1         S1                             U1         T
U1         S2                             U1         S1

显然10.2中已经fixed了这个bug。关于这个bug的详细描述,可以参考Bug 3369744

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4227/viewspace-701222/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1954
  • 访问量
    10652010