Oracle-同义词失效能否自动编译?

客户有个问题,同义词突然失效了,第一反应是Oracle Page包失效会在下一次调用中自动编译?

测试一下同义词!

结论是可以自动编译,那么问题在于什么原因导致查询同义词没有自动编译成功! 这个可以根据具体报错排查

SQL> select count(*) from syn_a;

  COUNT(*)
----------
     37784
SQL> alter table a move;
select object_name,object_type,status from user_objects;
OBJECT_NAME          OBJECT_TYPE         STATUS
-------------------- ------------------- -------
SYN_A                SYNONYM             VALID
A                    TABLE               VALID
A_VIEW               VIEW                VALID

SQL> drop table a;
SQL> select object_name,object_type,status from user_objects;
OBJECT_NAME          OBJECT_TYPE         STATUS
-------------------- ------------------- -------
SYN_A                SYNONYM             INVALID
A_VIEW               VIEW                INVALID
SQL> create table a as select * from sys.dba_objects;
SQL> select count(*) from a_view;
  COUNT(*)
----------
     37784

SQL> select object_name,object_type,status from user_objects;
OBJECT_NAME          OBJECT_TYPE         STATUS
-------------------- ------------------- -------
A                    TABLE               VALID
SYN_A                SYNONYM             INVALID
A_VIEW               VIEW                VALID

SQL> select count(*) from syn_a;
  COUNT(*)
----------
     37784
SQL> select object_name,object_type,status from user_objects;
OBJECT_NAME          OBJECT_TYPE         STATUS
-------------------- ------------------- -------
A                    TABLE               VALID
SYN_A                SYNONYM             VALID
A_VIEW               VIEW                VALID

 

Oracle-同义词失效能否自动编译?

上一篇:Freesql查询指定字段数据


下一篇:SQL优化方向