'Oracle SQL Loader client unable to connect to server on LAN

I had a long running bash script/MySQL code to LOAD FILE into MySQL database. I needed to convert this to Windows environment and Oracle DB. Wrote a PowerShell program and one of the lines in code uses sql loader to load files into oracle DB. The DB is in another system in LAN and I am connecting from a windows server system where I have installed the oracle full client (not just instant client) package. Before using SQL Loader, I made sure that I am able to connect to DB from the system. The following SQL plus command works

Before using SQL Loader, I made sure that I am able to connect to DB from the system. The following SQL plus command works

 sqlplus abc/oracleabc@'"(description=(address=(host=192.168.22.44)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))"'

However I am not able to make SQL Loader work in PowerShell script.

I tried multiple command formats and connection strings

Try-1 :

   sqlldr.exe abc/oracleabc@'"(description=(address=(host=192.168.22.44)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))"' control=$ctl_file_name direct='true'

Result : LRM-00116: syntax error at 'address' following '('

Try-2:

   sqlldr.exe 'abc/oracleabc@(description=(address=(host=192.168.22.44)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))'  control=$ctl_file_name 

Result : LRM-00116: syntax error at 'address' following '('

Try-3

   sqlldr.exe abc/oracleabc@"(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=192.168.22.44)(Port\=1521)))(CONNECT_DATA\=(SERVICE_NAME\=orcl)))" control=$ctl_file_name 

Result:

SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Try-4

  sqlldr.exe userid=abc/oracleabc@ORCL control=$ctl_file_name 

Result:

SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Environmental variable ORACLE_HOME is defined in the system and points to client installation director D:\app\client\abc\product\19.0.0\client_1

tnanames.ora File :

  # tnsnames.ora Network Configuration File: 
  D:\app\client\abc\product\19.0.0\client_1\NETWORK\ADMIN\tnsnames.ora
  # Generated by Oracle configuration tools.

  ORCL =
  (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.22.44)(PORT = 1521))
     )
     (CONNECT_DATA =
     (SERVICE_NAME = orcl)
     )
   )

sqlnet.ora File

 # sqlnet.ora Network Configuration File: 
 D:\app\client\abc\product\19.0.0\client_1\NETWORK\ADMIN\sqlnet.ora
 # Generated by Oracle configuration tools.

 # This file is actually generated by netca. But if customers choose to 
 # install "Software Only", this file wont exist and without the native 
 # authentication, they will not be able to connect to the database on NT.

 SQLNET.AUTHENTICATION_SERVICES= (NTS)

 NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

TNS Ping:

 C:\Users\abc>tnsping orcL

 TNS Ping Utility for 64-bit Windows: Version 19.0.0.0.0 - Production on 04-MAY-2022 
 08:14:07

 Used parameter files:
 D:\app\client\abc\product\19.0.0\client_1\network\admin\sqlnet.ora

 Used TNSNAMES adapter to resolve the alias
 Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 
 192.168.22.44)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))
 OK (20 msec)

Need help in identifying the connection parameter/format issue related to SQL Loader.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source