Best way to handle LOBs in Oracle distributed databases

前端 未结 6 944
傲寒
傲寒 2021-02-04 07:08

If you create an Oracle dblink you cannot directly access LOB columns in the target tables.

For instance, you create a dblink with:

create database link          


        
相关标签:
6条回答
  • 2021-02-04 07:45

    The best solution by using a query as below, where column_b is a BLOB:

    SELECT (select column_b from sample_table@TEST_LINK) AS column_b FROM DUAL
    
    0 讨论(0)
  • 2021-02-04 07:47

    For query data, the solution of user2015502 is the smartest. If you want to insert or update LOB's AT the remote database (insert into xxx@yyy ...) you can easily use dynamic SQL for that. See my solution here:

    0 讨论(0)
  • 2021-02-04 07:47

    You could use materalized views to handle all the "cache" management. It´s not perfect but works in most cases :)

    0 讨论(0)
  • 2021-02-04 07:50

    Yeah, it is messy, I can't think of a way to avoid it though.
    You could hide some of the messiness from the client by putting the temporary table creation in a stored procedure (and using "execute immediate" to create they table)
    One thing you will need to watch out for is left over temporary tables (should something fail half way through a session, before you have had time to clean it up) - you could schedule an oracle job to periodically run and remove any left over tables.

    0 讨论(0)
  • 2021-02-04 07:54

    Do you have a specific scenario in mind? For example, if the LOB holds files, and you are on a company intranet, perhaps you can write a stored procedure to extract the files to a known directory on the network and access them from there.

    0 讨论(0)
  • 2021-02-04 07:57

    In this specific case can the only way the two systems can communicate is using the dblink.

    Also, the table solution is not that terrible, it's just messy to have to "cache" the data on my side of the dblink.

    0 讨论(0)
提交回复
热议问题