Outer Join Query Over Dblink Can Fail With ORA-904 (Doc ID 730256.1)

Click to add to Favorites To BottomTo Bottom

03-May-2013PROBLEM
Rate this document Email link to this document Open document in new window Printable Page

In this Document

  Symptoms
  Changes
  Cause
  Solution
  References

 

APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.2.0.1 to 11.1.0.7 [Release 10.2 to 11.1]
Information in this document applies to any platform.

SYMPTOMS


Following query over dblink having Local database 9iR2 and remote 10gR2 works..

select *
from ctps3.institutions@ctps3 i,
ctps3.state_types@ctps3 s,ods.institutions oi
where s.stt_state_type_id (+) = i.stt_state_type_id
and oi.ctps_insttn_id = i.inst_insttn_id
and i.inst_modifd_dt = trunc(sysdate)
and (nvl (oi.inst_state_txt, 'x') <> nvl (s.stt_state_type_nm, 'x'))
and (nvl (oi.inst_phone_txt, 17) <> nvl (i.inst_phone_txt, 17));

The same query fails when both local and remote databases are 10g R2, with following errors:

ERROR at line 2:
ORA-00904: "OI"."INST_STATE_TXT": invalid identifier
ORA-02063: preceding line from CTPS3


 

CHANGES

 

 

CAUSE

Outer join query over dblink can fail with ORA-904, as referenced in:

BUG 6620988 QUERY OVER DBLINK FAILS WITH ORA-904 SELECTING DATE

Predicates are not checked to verify if they belong to same network node when we attempt to colocate the remote tables. This results in wrongly generating remote query and ORA-904

REDISCOVERY INFORMATION:
1. ORA-904
2. DB link
3. OJ predicates across network nodes
4. predicates wrongly pushed network nodes

 

SOLUTION

-- To implement the solution, please execute the following steps::

Use the workaround of disabling colocated joins via event 10176 and force a hard parse to happen
(ie by flushing the shared pool), ie:

SQL> alter session set events '10176 trace name context forever';
SQL> alter system flush shared_pool;

or

For a permanent fix, request a One-Off Backport of 6620988 for the appropiate platform.

 

REFERENCES

BUG:6620988 - QUERY OVER DBLINK FAILS WITH ORA-904 SELECTING DATE
posted @ 2014-06-06 10:49  土鸟  阅读(1029)  评论(0编辑  收藏  举报