Is it possible to use a fully qualified TNS entry using sqlldr bundled with Oracle 10/11?
For example, in SQLPlus:
sqlplus user/password@(description
The only thing that worked for me was using two kinds of quotes:
sqlldr user/password@'"(description=(address=(host=localhost)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))"' bad='bad_file.txt' control='control.ctl' data='data.txt' log='log.txt' direct='true'
Kelvin is 100 % Correct. It worked for me
You can execute sql loader with below command without making a tns entry
sqlldr userid/password@//host:port/SERVICE_NAME bad='/PATH/FILENAME.bad' control='/PATH/FILENAME.ctl' data='/PATH/FILENAME.csv' log='/PATH/FILENAME.log' direct='true'
Have you tried the ezconnect format to connect to a remote db using sqlldr ?
e.g:
sqlldr user/password@//localhost:1521/orcl bad='bad_file.txt' control='control.ctl' data='data.txt' log='log.txt' direct='true'
see: http://www.orafaq.com/wiki/EZCONNECT
Looks like you need to escape characters like '(', ')' and '=' with the escape character '\' (i.e. backslash) as explained in here.
You can also try:
sqlldr user/password@TNS:(description=(address=(host=localhost)(protocol=tcp)(port=1521))(connect_data=(sid=orcl))) bad='bad_file.txt' control='control.ctl' data='data.txt' log='log.txt' direct='true'
Single quoting the whole not-so-ezconnect worked for me in a DOS batch script and on the command line:
sqlldr 'user/password@(description=(address=(host=localhost)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))' control='control.ctl' data='data.txt'