2017-07-27 108 views
0

db1上有两个db,表test_table,上下文索引按字段a。查询:Oracle上下文索引:无法通过dblink工作

select * 
    from test_table t 
where contains(t.a, 'str') > 0 

它在db1上正常工作。但是,当我尝试从其他数据库,通过DBLINK执行相同的查询:

select * 
    from [email protected] t 
where contains(t.a, 'str') > 0 

我得到这个错误:

ORA-20000:Oracle Text的错误: DRG-10599:列没有被索引

+0

你有没有考虑在DB1创建查询的视图(谓语),然后查询使用DB2数据库链接的看法? –

回答

0

您必须添加dblink才能运行。 https://docs.oracle.com/cd/E11882_01/text.112/e24436/csql.htm#CCREF0104

The CONTAINS operator also supports database links. You can identify a remote table or materialized view by appending @dblink to the end of its name. The dblink must be a complete or partial name for a database link to the database containing the remote table or materialized view. (Querying of remote views is not supported.)

select * 
    from [email protected] t 
where contains(t.a, 'str')@db1 > 0. 
+0

谢谢,它的工作,唯一的澄清 - 正确的版本看起来像这样: select * from test_table @ db1 t 其中包含@ db1(t.a,'str')> 0。 –