Invoking SQL Loader with a DSN
I'm trying to load some data to an Oracle database using SQL Loader. Is it possible to 开发者_StackOverflow社区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 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
精彩评论