views:

177

answers:

1

I'm trying to load some data to an Oracle database using SQL Loader. Is it possible to invoke it with specifying the server to load the data into using a DSN instead of a TNS?

Right now my command line looks like this: sqlldr uesr/password@tns_id..., I'd like to replace tns_id with a DSN that points to tns_id. Can SQL Loader figure out the TNS from the DSN by itself?

A: 

A database can be identified (in Oracle terms) by a hostname, port (generally 1521) and service/sid.

SQL Loader won't be able to work with a DSN itself, but if you can use Windows scripting or similar to worm the host/port/service information out, you'll be most of the way there.


With a full client installed and a tnsnames.ora do a

tnsping dbname

You should get something like

Attempting to contact 
(DESCRIPTION = (ENABLE=BROKEN) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = servname)))
OK (30 msec)

You should then be able to do

sqlplus user/pass@hostname:1521/servname
Gary
how do I format it in the command line? I tried `sqlldr user/password@hostname` but that didn't work.
Zack
user/password@hostname:1521/service_name
Gary
I'm still getting `TNS:could not resolve the connect identifier specified`
Zack
`tnsping` worked and returned something similiar to what you wrote. I then tried to run `sqlplus` like you said but I got the same error. Not sure why you refered to `sqlplus` as I was originally trying to make `sqlldr` work, but it still didn't.
Zack
sqlplus is just a bit simpler (ie I didn't need any other command line parameters). The error generally indicates it can't find the host. Try PING hostname and see if that returns anything.
Gary
tnsping/ping works, sqlldr still doesn't.
Zack