Clobs dblinks
Is there any way to select a clob across a dblink ? what I have to do now is select all the columns individually (can add up) and exclude the clobs ? Or can you auto-generate a select with all the columns on a remote table across a link ? I know we can drag/drop a table to the worksheet and get a select built, but how to do this for a remote table ?
Thanks,
Mark
Try to create a local synonym for the remote table.
If you still can't select the CLOB, at least you do get the table in your Tables node if you check Include Synonyms in the Apply Filter dialog on the Tables node.
Hope that helps,
K.
Similar Messages
-
How to copy a table with LONG and CLOB datatype over a dblink?
Hi All,
I need to copy a table from an external database into a local one. Note that this table has both LONG and CLOB datatypes included.
I have taken 2 approaches to do this:
1. Use the CREATE TABLE AS....
SQL> create table XXXX_TEST as select * from XXXX_INDV_DOCS@ext_db;
create table XXXX_TEST as select * from XXXX_INDV_DOCS@ext_db
ERROR at line 1:
ORA-00997: illegal use of LONG datatype
2. After reading some threads I tried to use the COPY command:
SQL> COPY FROM xxxx/pass@ext_db TO xxxx/pass@target_db REPLACE XXXX_INDV_DOCS USING SELECT * FROM XXXX_INDV_DOCS;
Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)
CPY-0012: Datatype cannot be copied
If my understanding is correct the 1st statement fails because there is a LONG datatype in XXXX_INDV_DOCS table and 2nd one fails because there is a CLOB datatype.
Is there a way to copy the entire table (all columns including both LONG and CLOB) over a dblink?
Would greatelly appriciate any workaround or ideas!
Regards,
Pawel.Hi Nicolas,
There is a reason I am not using export/import:
- I would like to have a one-script solution for this problem (meaning execute one script on one machine)
- I am not able to make an SSH connection from the target DB to the local one (although the otherway it works fine) which means I cannot copy the dump file from target server to local one.
- with export/import I need to have an SSH connection on the target DB in order to issue the exp command...
Therefore, I am looking for a solution (or a workaround) which will work over a DBLINK.
Regards,
Pawel. -
Using dblinks to access CLOB datatype
Hi ,
I am using dblink to access data data from remote database. I need to access data form a table on remote database which have fields of type VARCHAR2 and CLOB. Since I can't access CLOB data directly through dblinks, i created a view for that CLOB datatype. Now when I try to retrieve the data from remote tab1 by joining that view and tab1 ,I am getting the error
ORA-22992: cannot use LOB locators selected from remote tables .
But if I retrieve the data from view alone, I am able to retrieve the information.
And if try to access the varchar2 field alone using dblinks that also will work. But if I combine both the view and same table used in that view, it doesn't work.
I think this can be solved by puting all the required fields(CLOB and non-CLOB) in view. In real situation, the number of fileds that will not have CLOB datatype in tab1 is high.
Can someone tell some suggestion on how to resolve this?
Thanks in Advamce,
DaliaI assume that you likely do not have Metalink (Oracle Support) access. Here is the Metalink Note on this topic.
Subject: ORA-22992 When Trying To Select Lob Columns Over A Database Link
Doc ID: Note:119897.1
Type: BULLETIN
Last Revision Date: 24-JUL-2002
Status: PUBLISHED
PURPOSE
This document discusses whether or not a lob column can be selected over a
remote database link.
SCOPE & APPLICATION
This document is written for all audiences.
This information is based on the tests made in Oracle 8.1.5 and Oracle 8.1.6
and the available Oracle documentation on LOB (large Object) data and issues
logged with Development on the select of a LOB column over a remote database
link.
How to select a LOB column over a database link?
(A) You cannot actually select a lob column (i.e. CLOB column) from a table
using remote database link. This is not a supported feature.
For example,
You run the following command from the local instance to a remote database
instance called R816 over a dblink R816 created in the local instance for user
SCOTT. You have logged in as user Scott and the remote table CLOBT has 2
columns C1 and C2 as below:
$ sqlplus scott/tiger@r816utf8
SQL> create database link r816
connect to scott identified by tiger
using 'rtcsol1_r816.us.oracle.com';
SQL> desc clobt@r816
Name NUll? Type
C1 NOT NULL NUMBER
C2 CLOB
SQL> select c1, c2
from clobt@R816;
ORA-22992: cannot use LOB locators selected from remote tables
SQL> select c1, dbms_lob.getlength(c2)
from clobt@R816;
ORA-22992: cannot use LOB locators selected from remote tables
Error: ORA-22992
Text: cannot use LOB locators selected from remote tables
Cause: A remote LOB column cannot be referenced.
Action: Remove references to LOBs in remote tables.
(B) Also, these are the INVALID operations on a LOB column:
1. SELECT lobcol from table1@remote_site;
2. INSERT INTO lobtable select type1.lobattr from table1@remote_site;
3. SELECT dbms_lob.getlength(lobcol) from table1@remote_site;
In short, you cannot select a lob column using remote dblink. You have to use
DBMS_LOB package in a programming language like PL/SQL, JAVA to manipulate LOB
data.
RELATED DOCUMENTS
Oracle8i Application Developer's Guide - Large Objects (LOBs) Release 2 (8.1.6)
Chapter Managing LOBs: LOB Restrictions -
Poor CLOB performance over dblink
These statements take 4 seconds to complete:
drop table t_test purge;
create table t_test as
SELECT CONTENT_ID,SITEID
from sitecontent@remotedb;These statements don't complete after at least 10 minutes of waiting:
drop table t_test purge;
create table t_test as
SELECT CONTENT_ID,SITEID, BODY
from sitecontent@remotedb;The only difference is that the second SQL contains a reference to BODY, which is a CLOB column.
The SITECONTENT table consists of just 2815 records. The CONTENT_ID and SITEID columns are NUMBER. A max(length(body)) returns a result of 29,005. And a count where length(body)>15000 returns just 115. So we are not talking about huge amounts of data for the table, nor large amounts for very many rows. Certainly not enough, I would have thought, to explain a difference in completion times between about 4 seconds and apparently forever.
Is this a known issue with CLOBs over database links? (I have looked, but not found anything relevant). Is there anything I can do to remedy the situation (not asking for quick fixes, just any steps I can plod my way through!). When I look at the local database, it's just constantly waiting on SQL*Net message from dblink.
This is 11.2.0.1 on RHEL5.5 x86_64.
Thanks in advance.Well, I tried that:
Connected.
SQL> set autotrace traceonly explain statistics;
SQL> create table t_test as select ctext from clobtest@remotedb;
Table created.
SQL>No statistics were displayed, in other words. (Same result when selecting vtext, as it happens). I don't think autotrace works on DDL statements, does it? It's working fine for selects, though. So, ignoring the create table bit for now, here's the Vtext statistics:
SQL> select vtext from clobtest@remotedb;
2831 rows selected.
Execution Plan
Plan hash value: 1402521094
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |
| 0 | SELECT STATEMENT REMOTE| | 2994 | 5853K| 312 (1)| 00:00:04 | |
| 1 | TABLE ACCESS FULL | CLOBTEST | 2994 | 5853K| 312 (1)| 00:00:04 | RMDB |
Note
- fully remote statement
- dynamic sampling used for this statement (level=2)
Statistics
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
3629480 bytes sent via SQL*Net to client
2428 bytes received via SQL*Net from client
190 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2831 rows processedI can't produce the equivalent Ctext statistics, of course, since a select from a remote clob simply generates an ORA_22992.
I'm sort-of stumped at this point. -
Replicating clobs and blobs in a remote database across dblink
9iR2
When creating a materialized view in a warehouse pointing to a remote table in an OLTP environment, I got this error when trying to replicate a table with 3 clobs.
ORA-22992: cannot use LOB locators selected from remote tables
So, how does Oracle recommend replicating Blobs and Clobs in a remote database/warehouse? Evidently using materialized views doesnt work.MV replication is obsolete.
Move to 10gR2 and use Streams. -
Dear All,
I am trying to extract some CLOB data from other database using DB Link.
But I got an error stating that it cant be done using DB Links.
Is there any work around for this approach.
Much Appreciate your help on this.
Thanks,
Madhu K.No version number.
No DML.
No DDL.
No error message (just your interpretation of one).
No help is possible at this time. -
Problem by doing a query on MySQL using dblink
Good Morning,well,the DBLink works perfectly,but if the field in the MySQL DB is type TEXT(CLOB) throw the next error:
ORA-28500: la conexión de ORACLE a un sistema no Oracle ha devuelto este mensaje:
[Generic Connectivity Using ODBC]DRV_BlobRead: DB_ODBC_ENGINE (1489): ; [MySQL][ODBC 5.1 Driver][mysqld-5.1.30]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"CUSTOM_VALUES" WHERE "id"=16' at line 1 (SQL State: 37000; SQL Code: 1064)
ORA-02063: 2 lines precediendo a MYSQLDB
28500. 00000 - "connection from ORACLE to a non-Oracle system returned this message:"
*Cause: The cause is explained in the forwarded message.
*Action: See the non-Oracle system's documentation of the forwarded
message
Thank you
Edited by: 812419 on 18-ene-2011 0:41Hi,
You are hitting a known problem with the MySQL ODBC driver and 10g HSODBC which is discussed in this note on My Oracle Support -
Problems Selecting Mysql Blob Data Using Hsodbc - Error In Your SQL Syntax (Doc ID 739274.1)
There are 3 workrounds -
a) convert the affected column to a char or varchar column in MySQL.
b) use the Openlink ODBC driver. This is available from -
http://download.openlinksw.com/
c) create a view in MySQL which uses the 'CAST' function to convert the affected column to char. As an
example for a BLOB -
create view test_blob_v as select col1, cast(col2 as char) as col2 from test_blob ;
Then select from the view in Oracle -
select * from test_blob_v@mysql ;
========
If you are using 10g HSODBC you should migrate to 11g Database Gateway for ODBC (DG4ODBC) as 10g HSODBC is now desupported and DG4ODBC is the replacement product.
Regards,
Mike -
Generate Script from table with Clob and save other Database
Hi
How can I to read data from Clob column and insert into other table in other Database,
The fist Table is in Test Quality and second in Production
Are there way without to use Export/ Import ?
Can I to use Loader ?
Using 9i3360 wrote:
muttleychess wrote:
mschnatt wrote:
than you only can try the db-link
CREATE DATABASE LINK <dblink-name> CONNECT TO <user> IDENTIFIED BY <pwd> USING '<tnsnames-entry>';
and make table
create table ....
as select ....Thank , but too no work :-( :-(
SQL> select id,clob_data from myclob@teste;
select id,clob_data from myclob@teste
ERRO na linha 1:
ORA-22992: cannot use LOB locators selected from remote tables
Well you didn't do what the reply said to do
and make table
create table ....
as select ....Also in the manual, you could save yourself a lot of time if you would open it.
http://docs.oracle.com/cd/B14117_01/appdev.101/b10796/adlob_wo.htm#1006314
>
The following syntax is supported on remote LOB columns:
CREATE TABLE t AS SELECT * FROM table1@remote_site;
INSERT INTO t SELECT * FROM table1@remote_site;
UPDATE t SET lobcol = (SELECT lobcol FROM table1@remote_site);
INSERT INTO table1@remote_site select * from local_table;
UPDATE table1@remote_siteset lobcol = (SELECT lobcol FROM local_table);
DELETE FROM table1@remote_site <WHERE clause involving non_lob_columns>
This is the only supported syntax involving LOBs in remote tables. No other usage is supported.
>[h1]Thank you very much, very very good [h1] -
Copying table data accross a dblink using dbms_datapump
Hi Friends,
I need to copy a table data accross a dblink into another table of same structure.
There is a requirement to use 10g dbms_datapump package to copy the data.
The problem is that I can export into a dump file and then import it into the other database, But we do not need the dump file. We need directly exportimg and simultaneously importing into the table through dblink without generating the intermediate dump file.
If any one have a sample code or document link, Please do help.
cheersBut the application we have that uses the database cannot be changed to read from a CLOBWhy can't you change the application?
Well, anyway you should point out to your superiors that Oracle documented years ago to not use LONGS anymore...
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#sthref3806
It clearly states:
LONG Datatype
Note:
Do not create tables with LONG columns. Use LOB columns (CLOB, NCLOB) instead. LONG columns are supported only for backward compatibility.
Oracle also recommends that you convert existing LONG columns to LOB columns. LOB columns are subject to far fewer restrictions than LONG columns. Further, LOB functionality is enhanced in every release, whereas LONG functionality has been static for several releases.
How do I go from CLOB to LONG?I'm sorry, cannot help you on that one, I don't think you can do that at all (Oracle wants us to stop using LONGS, so, it's a one-way conversion...):
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1037232794454#15512131314505
So: NO built_in, you'll need to write a program if the clob is ALWAYS LESS THAN 32k in size, you can use plsql..but is that the case in your case? Only you know that.
I believe that question is still unanswered on this forum, but you might try searchin for answers on this forum, and
the 'Database-General' forum: General Database Discussions
Perhaps you can google a Q&D workaround...
( And consider convincing your collegues to just convert your LONGS to LOBS)
Edited by: hoek on Apr 8, 2009 5:43 PM -
DB Link between Oracle 10g and Oracle 9i for CLOB data type
How do I transport XMLType or CLOB from oracle 9i to Oracle 10G using DBLink?
Is any restrction to DBLink, while transfering CLOB with XML data from oracle 9i to Oracle 10G?
Please let me know how i resolve this issue.
Thanks in advance.
DKWell... it depends on what type of link you wish to create.
If you have same user with same password on both databases (9i and 10G), then you can create a public database link as
CREATE PUBLIC DATABASE LINK dblink USING 'dbalias';
Note: dbalias is the value from your TNSNAMES.ORA. The database from which you are creating the db link has to have the entry in TNS for other database.
Other method is to create a private db link
CREATE DATABASE LINK dblink CONNECT TO user IDENTIFIED by pwd using 'dbalias';
The number of open connections from a particular database is governed by init parameter DB_LINKS (this was in 8i.. not sure about higher versions)
HTH...
Message was edited by:
satishkandi -
Workaround for ORA-14551 WHILE CALLING FUNCTION IN SQL OVER DBLINK
Hi,
any idea how to workaround such issue in 9.2.0.8 (I know this is working with 11.2).
create table mylog(id number, data date , mess clob);
create or replace function myfunc(id in number, data in date ,mess in varchar2)
return number is
pragma autonomous_transaction;
retval number;
begin
insert into mylog values (id , data ,mess);
commit;
retval := id;
return retval;
end;
SQL> select schema.myfunc@dblink(2,sysdate,'bbbbbbb') from dual;
ERROR at line 1:
ORA-14551: cannot perform a DML operation inside a query
ORA-06512: at "SCHEMA.MYFUNC", line 6
ORA-06512: at line 1Regards
GregGDBMS_SQL is documented in what I think 9i calls "Supplied Oracle Packages and Types" manual.
The basic concept behind this is that it allows you to manually create a cursor and execute it (via an OCI like interface). For example, it can be used to issue remote DDLs via a database link as described in {message:id=10323373}.
DBMS_SQL provides flexibility and power that is beyond the standard cursor constructs in PL/SQL. The system package version even enables you to execute SQL and PL/SQL code as any other schema in the database.
You will have however to play around with DBMS_SQL (locally and remotely) to determine how to hide the fact that a local select (which Oracle assumes, correctly, does not change database state), actually changes the state of a remote database.
Personally I would not bother with such a hack. I would use the problem to enforce an upgrade to the latest Oracle version, or kick out the crappy app that needs to use a SQL select to make database changes. -
I have a 10.2.0.4 database that contains a PL/SQL procedure that copies data from a singe remote 10.2.0.4 database table. The procedure will return anywhere from 50,000 to 500,000 rows of data. In testing I have made this a pretty speedy process using BULK COLLECT and using FORALL to load them in 2000 row batches. It has now been requested that I include an additional column from my source table which happens to be a CLOB datatype. However, when I try to perform this with the extra column I get the standard "cannot select remote lob locators" or whatever. Does anyone know of a way to perform this using BULK COLLECT? I've seen countless examples of doing it using "INSERT INTO TABLEX SELECT COL1, COL2, COL3, etc FROM TABLE Y@DBLINK". I don't want to do it this way for performance reasons. Any suggestions would be greatly appreciated.
sjm133 wrote:
I've seen countless examples of doing it using "INSERT INTO TABLEX SELECT COL1, COL2, COL3, etc FROM TABLE Y@DBLINK". I don't want to do it this way for performance reasons.What performance reasons are those then?
Best thing to do would be to give it a go and see, and then if you find problems with it look for alternatives. Don't dismiss solutions without trying them. ;) -
SQL Server Long Text column to Oracle CLOB via DB Link
Does anyone know how to load a SQL Server Long Text column into an Oracle CLOB column using DB Link? When I try to Select from SQL Server table into Oracle table, I receive the error "ORA-00997: illegal use of LONG datatype".
Thanks,
SusanHi,
This is a known restriction involving long columns -
(1) LONG datatype not supported with use of DBLINK when insert or update involves a select statement
(2) LONG datatype cannot be used in a WHERE clause, in INSERT into ... SELECT ... FROM
constructs, and in snapshots.
The workround is to use a PL/SQL procedure or try the SQLPLUS COPY command.
If you have access to My Oracle Support then review these notes -
Cannot Move A Long From non Oracle database Ora-00997: Illegal Use Of Long Datatype (Doc ID 1246594.1)
How To Workaround Error: Ora-00997: Illegal Use Of Long Datatype (Doc ID 361716.1)
Regards,
Mike -
Error converting SQL Server text field to Oracle CLOB
I am trying to convert an SQL Server DB to Oracle DB using DB link. The issue I am facing is one of the SQL Server table contains text field and we are trying to convert the text field to CLOB.
The error I am getting is "SQL Error: ORA-00997: illegal use of LONG datatype"
The statement is something like this.
Insert into oracle_table
Select col_1,col_2,col_3,col_4,col_5 from sql_table@sqldblink;
Please help.Hi,
This is a known restriction involving long columns -
(1) LONG datatype not supported with use of DBLINK when insert or update involves a select statement
(2) LONG datatype cannot be used in a WHERE clause, in INSERT into ... SELECT ... FROM
constructs, and in snapshots.
The workround is to use a PL/SQL procedure or try the SQLPLUS COPY command.
If you have access to My Oracle Support then review these notes -
Cannot Move A Long From non Oracle database Ora-00997: Illegal Use Of Long Datatype (Doc ID 1246594.1)
How To Workaround Error: Ora-00997: Illegal Use Of Long Datatype (Doc ID 361716.1)
Regards,
Mike -
Trying to pass a CLOB from 8i to 9i
Hello all,
I am trying to select a CLOB data from oracle 8i and trying to insert it into a global temp table in Orace 9i. I am getting the following error...
DECLARE
l_clob CLOB;
BEGIN
-- select clob data into a local variable in oracle 8i
select SUCCESS_RESULTS
into l_clob
from xxcss_ssf_request_results
where request_id =11111 ;
-- select clob data into a local variable in oracle 9i
insert into xx@XXCSS_APPS_CTS.COM(a)VALUES(l_clob);
COMMIT;
END;
ORA-00942: table or view does not exist
ORA-02063: preceding line from XXCSS_APPS_CTS
ORA-06512: at line 12
Is there anyway I can achieve this functionality.
Thanks,
ArunHi,
Did you can, under sql*plus :
select * from xx@XXCSS_APPS_CTS.COM;Maybe the user which used for the dblink has not the grant as well.
Nicolas.
Maybe you are looking for
-
I bought songs on my laptop which synced to my iphone and iPad. But I can't find them on itunes library on my home computer. However, when I click download for the same song it says it has already been purchased. How do I find it on home computer?
-
Can you control the alpha of an input text box?
Using Action Script, I mean? If I put a ball on the stage and make it a movie, I can make it vanish by putting ball._alpha -= 100; If I put an input text field on the stage and reference it by name that doesn't work. If I turn the text field into a M
-
Okay so, I am very insecure about my first Apple product ever, iPhone 4S. It will have no pictures, videos or songs. I currently have 12.8 GB left. So, I just wanted to ask this, how many apps and games will it able to hold?
-
Editing HDV in Final Cut Pro 6...
Greetings fellow forum friends I work in a film company. We are currently on a preproductional stage, aiming for a feature lenght high def dv film. I am still quite new to the HD scene so I was wondering if anyone with experience could guide me throu
-
Hi, I have an AQ queue process which queues data into a queue. The records go into this queue via a trigger on a table. I have also written a procedure to dequeue the records in bulk using the dbms_aq.dequeue_array. My question is regarding the sched