当前位置:  开发笔记 > 数据库 > 正文

在Oracle中,为什么在删除表分区时公共同义词变得无效

如何解决《在Oracle中,为什么在删除表分区时公共同义词变得无效》经验,为你挑选了1个好方法。

可以有人告诉我为什么会出现以下行为(Oracle 10.2):

SQL> create table part_test (
        i int primary key,
        d date
)
partition by range (d) (partition part_test_1 values less than (to_date('  2    3    4    5  1980-01-01', 'yyyy-mm-dd')));

create public synonym part_test for part_test;

select object_name, object_type, status from all_objects where object_name = 'PART_TEST';

alter table part_test add partition part_test_2 values less than (to_date('1981-01-01', 'yyyy-mm-dd'));

select object_name, object_type, status from all_objects where object_name = 'PART_TEST';

alter table part_test drop partition part_test_1;

select object_name, object_type, status from all_objects where object_name = 'PART_TEST';

drop public synonym part_test;
drop table part_test;

Table created.

SQL> SQL> 
Synonym created.

SQL> SQL> 
OBJECT_NAME                    OBJECT_TYPE         STATUS
------------------------------ ------------------- -------
PART_TEST                      TABLE               VALID
PART_TEST                      TABLE PARTITION     VALID
PART_TEST                      SYNONYM             VALID

SQL> SQL> 
Table altered.

SQL> SQL> 
OBJECT_NAME                    OBJECT_TYPE         STATUS
------------------------------ ------------------- -------
PART_TEST                      TABLE               VALID
PART_TEST                      TABLE PARTITION     VALID
PART_TEST                      TABLE PARTITION     VALID
PART_TEST                      SYNONYM             VALID

SQL> SQL> 
Table altered.

SQL> SQL> 
OBJECT_NAME                    OBJECT_TYPE         STATUS
------------------------------ ------------------- -------
PART_TEST                      TABLE               VALID
PART_TEST                      TABLE PARTITION     VALID
PART_TEST                      SYNONYM             INVALID

SQL> SQL> 
Synonym dropped.

SQL> 
Table dropped.

SQL> 

删除分区后,同义词变为无效,我无法解决原因.

谢谢你的任何想法.



1> tuinstoel..:

我已经使用Oracle 10.2进行了测试,同义词确实无效,但是当其他用户使用同义词时

从part_test中选择count(*);

Oracle自动编译同义词,同义词变为有效.

包,程序和功能都是一样的.当您执行它们并且它们无效时,Oracle将尝试自动编译它们.

推荐阅读
吻过彩虹的脸_378
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有