Oracle cannot get sqlldr to reach listener, get ORA-12514 error - oracle

Every time I try to run the following sqlldr command on a terminal only oracle 19c system:
sqlldr username/password#$HOSTNAME/$ORACLE_SID control=rules.ctl log=backup_error_logs.txt data=output.csv errors=1000000
I get the following error message:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Things I have tried:
Verified that the listener is operable and listener.ora file is properly formatted with lsnrctl.
Verified the connection and oracle environment variables are working as the following sqlplus command runs without problem:
sqlplus username/password#$HOSTNAME/$ORACLE_SID
Verified the tnsname.ora is running properly configured with the following tnsping command:
tnsping $ORACLE_SID
Cannot think of anything else to try or to check. Does anyone have any advice without resorting to the GUI tools?

Could be a problem of quotes in the variables, the behavior of both tools is different regarding quotes.

Related

SQL loader shows error ORA-12546 TNS:permission denied when I try to run it against a remote database

I'm trying to run sql loader with the following syntax on a remote bbdd:
sqlldr user/password#host.sid control=loader_control_file.ctl
(where host.sid is the remote bbdd tnsnames entry) and it gives the following error
SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12546: TNS:permission denied
I have the connection configured in my local tnsnames.ora, tnsping resolves the sid and sqlplus connects (and works) correctly so apparently tnsnames setup is good.
I've also tried EZconnect syntax
sqlldr user/password#//host:1521/sid control=loader_control_file.ctl
buts gives the same error
I have no idea of what is wrong here. Any help?

Running SQL file in command line using sqlplus result with an error

Using ORACLE 12.0c and SQL Developer.
I try to run a SQL file (myfile.sql) in command line using sqlplus:
sqlplus username/password#schema #myfile.sql resulted with an error.
I run only sqlplus with connection parameters sqlplus username/password#schema and still receive an error (see screenshot).
Typing the username and password didn't help as well.
Only running sqlplus and supply the database domain, port and database name I managed to connect and run the file.
The database is defined in SQL Developer, but I don't see it in TNSNames.ora.
What am I missing?
I give credit to #thatjeffsmith and the answer is... see screenshot:

Can connect to database with sqlplus directly, but not when setting ORACLE_SID

I am trying to connect to a database in a shell script. I can connect fine if I use this:
sqlplus user/pass#db_service_name
However, when I try something like this, it is not working:
ORACLE_SID=db_sid
export ORACLE_SID
sqlplus /nolog
connect user/pass
I get an error:
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Obviously I am missing something, but this is an area I am not fully familiar with, so I am not sure where I am going wrong. My assumption was that if I set the ORACLE_SID, that I would not need to identify my db when connecting in sqlplus. Is my assumption incorrect? Or am I missing some required step or configuration?
Using sqlplus user/pass#db_sid refers to a TNS alias in $ORACLE_HOME/network/admin/tnsnames.ora. If the instance is running on the same host as your sqlplus command, then you need to look at the text of the TNS alias in tnsnames.ora and set ORACLE_SID to the SID referenced in the file and then execute . oraenv. If the instance is not running on the same host as your sqlplus command, then your latter attempt will never work.
If you want more secure connections, you might consider using a wallet.

trying to connect to remote oracle server via cygwin

When I use the command:
sqlplus username#ip_address:1521
I get the error:
ORA-12154: TNS:could not resolve the connect identifier specified
When I set ORACLE_HOME to /cygdrive/c/oracle/product/10.2.0/client_1, I get a different error:
Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
I can telnet to the server's port 1521.
I also tried the Windows path for ORACLE_HOME but it gives me the same error, also in Cygwin when I change the $PATH = $ORACLE_HOME/bin no command is recognized.
I am able to connect to this database via a excel macro but not using cmd.exe or Cygwin .
If you don't want to use TNSNAMES.ORA to specify the connection parameters you need to provide them on the command line. This works with the widest variety of SQLPlus versions.
sqlplus OraUser/OraPassword#'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=remoteServer)(PORT=1521)))(CONNECT_DATA=(SID=OraSid)))'
Note ' is for Unix and needs to be changed to " for Windows.

ORA 12505 error for SQL Developer

I have recently ran into a problem when trying to connect to my Database. The error is stating that it cant find the listener.
Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
I read to post whats in the listener.ora and tnsnames.ora but when I try to open these files via windows explorer it tells me to choose a program to open it with, and then it doesnt open.
Can someone help me with this problem so I can get back to practicing coding please?
The command to view listener information in Windows is lsnrctl.
Open a DOS command prompt on the server, not client.
lsnrctl status
View the other commands by
lsnrctl help
Also, the tnsnames.ora and listener.ora files are text files. You can open those in notepad. The default location for the tnsnames.ora file on the client is:
C:\oracle\product\11.2.0\client_1\Network\Admin
The default location for the listener.ora file on the server is:
ORACLE_HOME\network\admin

Resources