3

有人可以告诉我为什么会发生以下行为(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> 

删除分区后同义词变得无效,我不知道为什么。

感谢您的任何想法。

4

2 回答 2

6

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

从 part_test 中选择 count(*);

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

包、过程和函数也是如此。当您执行它们并且它们无效时,Oracle 将尝试自动编译它们。

于 2009-01-14T06:37:46.943 回答
2

它不在 11.1.0.6 中它可能是一个已修复的错误。这可能是必要的(例如,基于同义词重新验证视图......)但使用了改进的技术。

于 2009-01-14T04:44:22.803 回答