Oracle Database Connection issue with SSH Tunnel - Logon denied - oracle

We are not able to connect to Oracle DB using SSH Tunnel(set up in putty) from our system command prompt. It is failing with below error:
C:\Users\yadavvin>tnsping APPSP
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 16-OCT-2019 11:54:54
Copyright (c) 1997, 2010, Oracle. All rights reserved.
sed parameter files:
C:\Oracle\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact **(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = appsp)))**
OK (130 msec)
C:\Users\yadavvin>
C:\Users\yadavvin>sqlplus arpadmin/password#appsp
SQL*Plus: Release 11.2.0.1.0 Production on Wed Oct 16 11:55:48 2019
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
**ORA-01017: invalid username/password; logon denied**
Enter user-name:
C:\Users\yadavvin>
However, the same credentials are working with the same SSH Tunnel when connected using SQL DEVELOPER.
Would appreciate any pointers towards resolution of this issue.
Oracle DB Version: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Oracle Client Version: Release 11.2.0.1.0 Production
Adding the full qualified Database string in SQLPLUS and checking the connection:
C:\Users\yadavvin>sqlplus arpadmin/Welc0me2abcr#127.0.0.1:1521/AVSAPPSP
SQL*Plus: Release 11.2.0.1.0 Production on Wed Oct 16 14:49:50 2019
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

Related

Oracle TNS alias connection works, ezconnect does not

Using sqlplus and a tns names alias, I can connect successfully:
sqlplus xxxxxx/yyyyyy#zzzzz
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Apr 17 15:48:14 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Last Successful login time: Sun Apr 17 2022 15:33:24 -04:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
I then took the tnsnames.ora entry:
tnsping zzzzz
TNS Ping Utility for 32-bit Windows: Version 19.0.0.0.0 - Production on 17-APR-2022 15:58:46
Copyright (c) 1997, 2019, Oracle. All rights reserved.
Used parameter files:
C:\app\client\product\19.0.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host.domain.tld)(PORT = 1515)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = service.domain.tld)))
OK (50 msec)
and tried to connect using ezconnect syntax:
sqlplus xxxxx/yyyyyy#host.domain.tld:1515/service.domain.tld
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Apr 17 16:01:13 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Which failed as you can see. I guess I'm missing something, but what?

how to login to oracle express as a new user

I'm getting started with Oracle Express. I used sqlplus to connect and create a new user then tried to use it with the password I gave it. Got a login error (tried 3 times with password I set). I'm surely missing something simple! What is my problem here?
>.\sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Fri Apr 15 14:50:40 2022
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL> alter session set container = xepdb1;
Session altered.
SQL> alter user foo identified by bar
2 ;
User altered.
SQL> connect foo
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied
Check contents of TNSNAMES.ORA. "My" XE database (the same version as yours) has alias pdb1:
PDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ods...r)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XEPDB1)
)
)
Then check SQLNET.ORA. "My" version looks like this (your should too, I'd say):
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Now, at operating system command prompt:
c:\temp>sqlplus scott/tiger#pdb1
SQL*Plus: Release 21.0.0.0.0 - Production on Fri Apr 15 21:04:58 2022
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Last Successful login time: Fri Apr 15 2022 21:02:33 +02:00
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL>
If foo is a local user, who exists only in container xepdb1, then the connect command should be connect foo#xepdb1. The connect command doesn't check to see where the user may exist (and indeed, different users by the same name may exist in different containers); you must include the container name in the command.
Perhaps you thought that, since you changed the container to xepdb1 (while connected as sysdba) already, the connect command would assume "within the same container". It does not.
Succeed with:
connect foo/bar#localhost:1521/xepdb1

How do I connect to sqlplus in bash script without editing the tnsnames.ora file?

I am trying to create a bash script to run an SQL query. The issue that I have is that the connection strings that I am using below is only giving me errors.
Example connection attempts with errors:
sqlplus -s username/password#hostname:Port:SID --> ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
sqlplus -s username/password#hostname:Port/SID ---> ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Example on my (local) XE database. Let's just check what TNSNAMES.ORA says (I obfuscated host name) so that you'd see what I used while connecting to the database. If you don't have TNSNAMES.ORA, then you'll have to find that info somehow (possibly by asking your DBA).
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = my_host)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
OK, let's try it now:
c:\Temp>sqlplus scott/tiger#my_host:1521/xe
SQL*Plus: Release 11.2.0.2.0 Production on Uto Svi 4 21:52:46 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Using localhost's IP address (as I said, XE runs on my laptop):
c:\Temp>sqlplus scott/tiger#127.0.0.1:1521/xe
SQL*Plus: Release 11.2.0.2.0 Production on Uto Svi 4 21:53:07 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Using localhost itself:
c:\Temp>sqlplus scott/tiger#localhost:1521/xe
SQL*Plus: Release 11.2.0.2.0 Production on Uto Svi 4 21:56:17 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

How to connect to Oracle using SQLPLUS | Oracle Instant Client | ORA-12545

Connecting successfully using SQL Developer but when i use sqlplus in Oracle Instant Client then i get following issues
Method 1:
[integrator#a-esb-app01 instantclient_19_8]$ ./sqlplus EGOINT#139.138.267.202:1521:EPROD
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 22 18:14:36 2020
Version 19.8.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Enter user-name: egoint
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Method 2:
[integrator#a-esb-app01 instantclient_19_8]$ ./sqlplus EGOINT#139.138.267.202:1521/EPROD
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 22 18:18:13 2020
Version 19.8.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
Not Sure which of above is correct method and what is issue with connection string or any changes required on server side?
Note: I am able to connect another Oracle Server successfully. So no issue with InstantClient
Fixed using following:
./sqlplus egoint/egoint#(description=(address=(protocol=tcp)(host=139.138.267.202)(port=1521))(connect_data=(sid=EPROD)))

TNS:Protocol Adapter Error

I am attempting to connect to an Oracle 11.2.0.2 64 bit database from a Win 7 and Win 8.1 machine with the Oracle 11.2.0.4 32 bit client. I can successfully ping the server and TNSPing the listener on both machines. But when I try to log into SQLPLus using system and my password I receive ORA-12560 TNS:Protocol Adapter Error. I can log into SQLPlus on the server. Any ideas? DB has been restarted as well as the listener. ORACLE_SID is set. I'm stuck...
If I'm following what you're seeing, it sounds like you just want to set the LOCAL enviroment variable on your Windows boxes to the TNS alias; then you don't have to supply that as you try to connect.
This is with the 12c instant client but the effect is the same with the 11g client. Specifying an alias as the connect strings works (the ORA-01017 is still coming from the DB):
c:\Program Files\instantclient_12_1>sqlplus -l x/y#abcd
SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 23 17:12:34 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Connecting without the alias gets your ORA-12560:
c:\Program Files\instantclient_12_1>sqlplus -l x/y
SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 23 17:11:58 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12560: TNS:protocol adapter error
But if I set LOCAL then I can connect as if I had specified the alias:
c:\Program Files\instantclient_12_1>set LOCAL=abcd
c:\Program Files\instantclient_12_1>sqlplus -l x/y
SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 23 17:14:23 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
You don't need to have ORACLE_SID set as that is only used for bequeath connections where the client and server are on the same box.

Resources