Question

I am getting an error SQL*Loader-606, which means:

The synonym specified in the INTO TABLE clause in the SQL*Loader control file specifies a remote object via a database link. Only a synonym for an existing local table can be specified in the INTO TABLE clause.

Is there any way we can insert into remote table using SQL*Loader?

Was it helpful?

Solution

Because you are on 10g you can use External Tables instead of SQL Loader.

Setting up an External Table is easy. Find out more.

To get the External Table to pick up a new file (which you may need to do because you have a repeating process), do this:

alter table your_ext_table_name location ('<newfile.name>')
/

Then you can do this:

insert into whatever_table@remote_db
    select * from your_ext_table_name 
/

This avoids two lots of DML. External tables are not as fast as a well-tuned SQL*Loader process, but that will be trivial compared to the network traffic tax (which is unavoidable in your scenario).

OTHER TIPS

create table temp_table as select * from remote_table@remote_db where 1 = 2;

load using sql*loader into temp_table;

insert into remote_table@remote_db select * from temp_table;

Run SQL Loader on the server that has the table?

Must be a reason why not, but this seems the simplest to me.

If you couldn't use external tables (eg because the data file is on a client machine rather than on the database server), you can insert into a view on the remote object.

For example

create database link schema1 connect to schema1 identified by schema1 using 'XE';
create view schema1_test_vw as select * from test@schema1;

load data
 infile *
 append
 into table schema1_test_vw
 ( id POSITION(1:4) INTEGER)
begindata
1001
1002
1003

succeeded on my XE test. For a view all the column sizes,datatypes etc are fixed on the local schema so sqlldr doesn't have a problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top