This test shows how to access a table containing Blob fields through DBLink.
I. Simulated Problems
1.1In the instance1Operation on:
Create a test table containing blob:
- /* FormattedOn10:18:05 (QP5 v5.185.11230.41888 )*/
- CREATE TABLELob1
- (
- Line NUMBERPrimary Key,
- Text CLOB
- );
- INSERT INTOLob1
- SELECT DistinctLine, textFROMAll_sourceWhereRownum: <500;
- SELECTSegment_name,
- Segment_type,
- Tablespace_name,
- SUM(Bytes)/1024/1024 |'M' AS "SIZE"
- FROMUser_segments
- WHERESegment_name ='Lob1'
- GROUP BYSegment_name, segment_type, tablespace_name;
The LOB table information is as follows:
- SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAMESIZE
- -------------------------------------------------------------------------
- LOB1TABLESYSTEM 9 M
- SQL>SetWrapOff;
- SQL>Select*FromLob1WhereRownum = 1;
- LINE TEXT
- -------------------------------------------------------------------------------
- 1 package STANDARD AUTHIDCURRENT_USER Is-- Care
1.2In the instance2On
Create DBLINK:
- CREATE PUBLIC DATABASELINK lob_linkCONNECT TODave IDENTIFIEDBYDave
- USING '(DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.2.222) (PORT = 1521 ))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = dave)
- )
- )';
- SQL>Select*FromV $ version;
- BANNER
- ----------------------------------------------------------------
- OracleDatabase10g Enterprise Edition Release 10.2.0.1.0-Prod
- PL/SQL Release 10.2.0.1.0-Production
- CORE 10.2.0.1.0 Production
- TNSForLinux: Version 10.2.0.1.0-Production
- NLSRTL Version 10.2.0.1.0-Production
- SQL>Select Count(*)FromLob1 @ lob_link;
- COUNT(*)
- ----------
- 58228
The total number of records queried here is normal. However, when we query the content in a specific LOB field, an error is reported as follows:
- SQL>Select*FromLob1 @ lob_linkWhereRownum = 1;
- ERROR:
- ORA-22992: cannot use LOB locators selectedFromRemote tables
- No RowsSelected
- [Oracle @ localhost ~] $ Oerr ora 1, 22992
- 22992,000 00,"Cannot use LOB locators selected from remote tables"
- // * Cause: A remote LOBColumnCannot be referenced.
- //*Action: RemoveReferences ToLOBsInRemote tables.