Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load data to remote DB using sqlldr

Tags:

oracle

I wanted to load data to remote db using sqlldr.I did it using following command

>sqlldr GANUKA/GANUKA@jdbc:oracle:thin:@172.21.0.180:1521:orcl control=D:\Work\CLSTMAS.ctl 
log=D:\Work\CLSTMAS.log

But it gives the following error.

SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12154: TNS:could not resolve the connect identifier specified

Need a help

like image 300
nath Avatar asked Oct 09 '10 03:10

nath


People also ask

How do I connect to Sqlldr?

If your environment has a proper TNS setup, you have to change the command line to something like sqlldr GANUKA/[email protected] control=... If not, you can use an Easy Connect string: sqlldr GANUKA/GANUKA@//172.21. 0.180:1521/orcl control=...

What is Sqlldr command?

SQL*Loader uses the field specifications in the control file to interpret the format of the datafile, parse the input data, and populate the bind arrays that correspond to a SQL INSERT statement using that data. The Oracle database accepts the data and executes the INSERT statement to store the data in the database.

What is SQL * Loader?

SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle database. Its syntax is similar to that of the DB2 load utility, but comes with more options. SQL*Loader supports various load formats, selective loading, and multi-table loads.


2 Answers

You're mixing up two different worlds here. One is the OCI world where sqlldr lives. It expects Oracle instance names defined in TNSNAMES.ORA (or a similar service). The other world is the JDBC world that uses connection identifiers with words like "jdbc" or "thin".

So you have two options:

  • If your environment has a proper TNS setup, you have to change the command line to something like sqlldr GANUKA/[email protected] control=...

  • If not, you can use an Easy Connect string: sqlldr GANUKA/GANUKA@//172.21.0.180:1521/orcl control=...

like image 166
Codo Avatar answered Oct 23 '22 03:10

Codo


I ended up having to use a thin client connection string. I couldn't get @Codo 's solution to work.

sqlldr \'username/passwd@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost.com)(PORT=1111)))(CONNECT_DATA=(SID=MYSIDE)(SERVER=DEDICATED)))\' control=loader.ctl data=data.csv

like image 20
gaoagong Avatar answered Oct 23 '22 01:10

gaoagong