ORA-12543: TNS:destination host unreachable but telnet and tnsping works - oracle

Last days i stay face to face with a strange oracle problem.
I have defined database in tnsnames.ora. Oracle client is installed , client and client/bin have been added to PATH.
Ping works, tnsping works, I can connect to host by database port with telnet.
When I try to run application that tries to connect to db I got
ORA-12543: TNS:destination host unreachable
It is the same situation when I try to connect by sqlplus
sqlplus username/password#TNSNAME
Situation occurred only on one workstation, it's mean in common it should works.
WS is windows 7 64 bit.
Database :
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

I was having the same problem, I resolved it by changing my password and removing "#" character. It worked for me.
# is to tell SQL plus which connection identifier (service name/sid) we want to connect. In short, avoid using this character in password.

I also faced the same issue ORA-12543: TNS:destination host unreachable
i resolved it in this way
open sqlplus
connect
enter user-name :system
enter password : HHHHH#2014
then the following error raised
the problem is my password contains # symbol
resolved it by putting my password in "HHHHHH#2014"

I too got ORA-12543 :TNS :destination host unreachable.
But for me the problem was in the password.
Resolution : Need to remove "#" from the existing password as
# defines connection identifier being used to connect in sqlPlus.
To update the password , follow below steps :
Logon to window cmd then type "sqlplus /nolog"
then "connect / as sysdba" .
Once you are connected, change the SYS password to something without #:
"ALTER USER sys IDENTIFIED BY new_password;"

(log in as sys dba)
sql>conn / as sysdba
(then alter the user)
sql>alter user username identified by newuserName
sql>commit
(now again try to login with new user with the same password it will work)
click on 1 to see the screenshot -- ][1]

Recently, I installed Oracle 11g for testing purpose and after completion of installation Database 11g Express Edition started on the browser with the system and Pravin#01 password it is connected successfully. After I tried using SQL Developer tool it was also working fine but while I tried to connect using SQL PLUS command line tool it suddenly gave me an error as,
ORA-12543: TNS:destination host unreachable
Then after research for an hour, I got a solution that Oracle treats # character in the password as a `
service name or sid
so the solution for this problem is to remove # character from the password using
ALTER USER system IDENTIFIED BY ' here is your new password which should contain character
and digits only try to eliminate special characters';
I think this post may be helpful for you.

I have tested this in Windows 2016 environment with Oracle 18c 64-bit
Use this following escape character sequence when attempting to logon with an "#" in the password.
user: scott
password: scott#test
sqlplus scott/\”scott#test\”#TEST_DB
In order avoid this annoyance, change password without an # character using the following command once you have logged in to sqlplus.
alter user scott identified by "newpassword"

Use URL Encoding for special characters in your password instead of raw special characters while connecting through terminal.
Example :-
if your connection string is :- sqlplus system/Password#12345#oracle as sysdba;
Then
Acceptable connection url will be :- sqlplus system/Password%4012345#oracle as sysdba;. Here %40 is the URL Encoding for #, so replace all special characters with their respective URL Encoding and execute the connection command in terminal.

Related

How to get username/password/hostname/port/SID to establish connection in SQL developer

I installed Oracle database 21c and sqldeveloper. During the installation of oracle database 21c I inputted my password upon the prompt. I tried to key in the password and the given username SYS to create connection in sqldeveloper but I got the error
Status : Failure -Test failed: IO Error: The Network Adapter could not
establish the connection (CONNECTION_ID=9mv7VkLpQniPUhJwegf7OQ==)
I'm trying to create a local database to practice SQL and I'm not looking to connect to an external database. What should I do in order to achieve my goal?
Ok, just do this instructions to connect to the database via sql developer:
1- Startup database (if you do not starttup database yet);
2- In OS prompt execute:
lsnrctl start
The command start your listener up.
3- In OS prompt execute (If you are using linux OS):
echo $ORACLE_SID
ifconfig
The first shows your database sid and the second shows your OS IP. The port is usually 1521.
4- In sql developer inter connection name for example Oracle_conn, username and password and set role for the user.
Then you should enter Ip,Port and Sid you obtained in step 4.
5- Press Test or Connect and Enjoy!

Default username and password for SQL*Plus in Ubuntu 14.04?

I followed the instructions mentioned to install SQL*Plus from Oracle Instant Client and How to Install SQLPlus.
SQL*Plus is successfully installed on my system but I cannot login and use it. There is a similar question here and here, but it is does not solve my problem.
On googling, most sources said that we enter a password upon installation, but I was neither prompted nor displayed any password. (I can attach terminal screen shots if it is required)
Is there any way I can login and start using SQL*Plus? Is there any default username or password?
I am stuck here: sqlplus username/password#//dbhost:1521/SID
I need a valid username and password. scott/tiger was of no help.
sqlplus / as sysdba gives this -> ERROR: ORA-12162: TNS:net service name is incorrectly specified and prompts me to enter username and password which I don't have.
I originally asked this question on AskUbuntu feeling its more appropriate there. If this question does not belong here, please comment and I will remove it.
EDIT:
I executed these statements after reading from here:
ORACLE_HOME=/u01/oracle; export ORACLE_HOME
ORACLE_SID=asdb; export ORACLE_SID
Now, On executing sqlplus / as sysdba I get the error message
ERROR: ORA-12545: Connect failed because target host or object does not exist
On executing sqlplus64 scott/tiger#//dbhost:1521/SID I get the error message
ERROR: ORA-12154: TNS:could not resolve the connect identifier specified
It does not have anything to do with Ubuntu. When you enter sqlplus / as sysdba sqlplus tries to connect to the local database, which sid and oracle home should be specified by the environment variables ORACLE_SID and ORACLE_HOME. You, obviously, have not defined these variables.
All you need is to get the username, password, host name, where your database is located, port for the listener (the default port is 1521) and the Oracle SID. Then connect with sqlplus username/password#//dbhost:1521/SID. If you know the password for SYS user and have orapwSID file in the $ORACLE_HOME/dbs directory on the server side, you can connect with sys with the following command: sqlplus sys/password#//dbhost:1521/SID as sysdba.
moving everything into instant_client_11_* directory worked for me.

Why can I log in with SQL Developer but not with SQL*Plus?

I'm trying to connect to from SQL*Plus and get error ORA-12154, but I can connect from SQL Developer without any error. I can tnsping and also lsnrctl is okay and the listener is up and running.
I can connect as sys like sqlplus sys as sysdba which works fine; but with another user I do sqlplus username and when I type the password it gives me:
ORA-12154: TNS:could not resolve the connect identifier specified
SQL*Plus interprets an # symbol as the start of a TNS alias. If your password has that in it then it will be interpreted that way even if you are not trying to connect over SQL*Net, but with a local connection. So if you do:
sqlplus user/p#ssword
... then it will take just the p as the password, and the #ssword as the alias, so it will try to find a TNS alias of ssword in your tnsnames.ora file. Since that doesn't exist, you'll get the "ORA-12154: TNS:could not resolve the connect identifier specified" error.
That applies when you put your password in at the prompt too, so if you do:
sqlplus user
Enter password: p#ssword
you'll get the same thing. You can connect by enclosing the password in double-quotes:
sqlplus user
Enter password: "p#ssword"
but you can't do that with the unprompted version.
You're probably better off changing your password to something without that particular character if you want to be able to connect from SQL*Plus as well as from other clients that don't interpret TNS in the same way.
SQL Developer, for example, accepts the password and connection settings as separate fields; it isn't trying to parse the string you entered to identify its components, so it doesn't get confused. Even if you tell SQL Developer to connect using a TNS alias, it will use the tnsnames.ora value you select from its drop-down list, it won't try to take it from the user or password fields.
This one worked for me ( and was easier to implement from my behalf )
From : TNSPING OK but sqlplus gives ORA-12154?
Create an environment variable TNS_ADMIN that points to the directory where your tnsnames.ora file resides. Then try to connect with sqlplus.
TNS_ADMIN = D:\oracle\12.1.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
If that works, then my guess is you maybe installed the Oracle client software too, and when you run sqlplus, it looks for the tnsnames.ora file in your client home.
-- Instructions for Adding the Environment variable TNS_ADMIN in windows
Go to control panel / system
select Advanced system settings
Select "Advanced" tab, and the environment variable button is at the bottom.
create new variable TNS_ADMIN and give the path where the .ora files are stored. e.g. C:\app\oracle\product\11.2.0\client_1\network\admin

How to find Oracle database connection details

I am new to Oracle DB and have created a new Oracle 12c database. I am creating a new connection through SQLDeveloper and where can I get the connection details? HostName? Port? SID?
I tried connecting using default details given in documentation but got the below error
Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor>
You really need to give more info if you need help :)
What Server are you using? Linux? Windows?
Post your oratab file (/etc/oratab)
Post your TNS file ($ORACLE_HOME/network/admin/tnsnames.ora)
Post your Listener file ($ORACLE_HOME/network/admin/listener.ora)
Assuming you're using Linux :D
You need to look at the file "/etc/oratab" if you're on Linux.
This will contain your SID.
Your TNS (located in $ORACLE_HOME/network/admin/) should contain the TNS Entry with SID as per your oratab file.
This is an example entry you will find in the oratab file:
orcl:/opt/oracle/product/10.2.0/db_1:Y
The let hand side "orcl" is your SID, and you will use this for your SID in the Oracle TNS.
If you find that your TNS is configured correctly, then the error message you provided may also indicate that your Database was not registered to the Listener.
You may connect to the sql database as follows:
Set your Oracle Environment
$ . oraenv
Prompts for SID: Enter the value "orcl" (if this is your SID?)
now login:
$ sqlplus / as sysdba
This will log you into oracle as a sysdba.
Execute the follwing:
SQL> Alter System Register;
You should notice a confirmation message that the system is altered.
now exit SQLplus, and try again
SQL> exit
On Windows ISTR, to get the SID, look at the running processes and you should see something called "oracleXXX.exe" or similar. The XXX will be your SID.
You should also see a "TNS" or "Listener" process, probably with the same "XXX".
To get the port number, (usually 1521-1526), find the folder where Oracle was installed to "the "Oracle Home") and in there go to the "network\admin" folder. You should see a "listener.ora" file in there, and if you view this is notepad you should be able to figure out what the port is set to.
This file should also tell you what host/network address the listener is attaching to - you use this IP as the "Hostname" in you connection. Sometimes (again I'm a bit cloudy with Oracle on Windows) the listener.ora might be named listnereXXX.ora, with XXX matching the value you will have seen in SID the checks above.
Obviously if you are new to Oracle, do not amend these files.
If you have netstat/wireshark or similar you can see what the port is attached to the TNS/Listener process.
If you have installed it on same machine on which you are running sql-developer then
host: 127.0.0.1
port: 1521
username and password same as you put while installing oracle datatabse.
keep sid blank

How to connect to newly installed Oracle XE instance?

I have installed Oracle XE on Win7 x64 machine. Installation completed successfully without problem, or perhaps installer didn't tell about them. But after installation I can't connect to database; its web interface is not working. I have looked through list of open ports, and there is no 8080 port as was noted during installation. Also I can't connect via SQLPlus.
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-12638: Credential retrieval failed
Somewhere in the web it was told to edit sqlnet.ora file, I have changed it in the following way:
# SQLNET.AUTHENTICATION_SERVICES = (NTS)
SQLNET.AUTHENTICATION_SERVICES = (NONE)
and now I get next error
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
What do I need to change so that I can connect to it?
I figured out the issue.
I was using domain login to install Oracle XE. If you are using domain login to install Oracle XE then the database creation will fail (though you may not get any error messages on that regard).
Solution:
Install Oracle using a local admin user.
Change SQLNET.AUTHENTICATION_SERVICES to (NONE) in sqlnet.ora.
Now login with your domain user to use oracle XE.
Check the Oracle services are started
Did you set your ORACLE_SID environment variable to the name of the instance you're connecting to?
Make sure oracle service is started.
did to ran netca after installation? - if not you can ran it from cmd
You can't connect using system if the instacne is down only as sysdba (user sys)
Make sure your ORACLE_HOME,ORACLE_SID,PATH environment variables are ok
If everything was ok then you can try to start/connect to the instance manually
Sample:
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>sqlplus "sys as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 11 16:21:42
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter password:
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 360710608 bytes
Database Buffers 167772160 bytes
Redo Buffers 5804032 bytes
Database mounted.
Database opened.
SQL>
SQL>
SQL>select status from v$instance;
As Rejeev Divakaran said, installing oracle XE with local windows user, and switching back to domain user account, started db, able to connect.
Config
Office Laptop
Windows 7 64 Bit
Oracle 11g XE
Can you connect this way from the command line:
sqlplus / as sysdba
if so at the SQL prompt enter
SQL>startup
If the command returns ok then try to connect with a username and password.
This error message usually occurs when the database could not be started. The windows service may be running, but still Oracle might not be able to spawn server threads and hand out client connections.
Have a Look into app\oracle\admin\xe\bdump\alert_xe.log for any error messages during the last start of the Oracle service.
Just in case someone is as "lucky" as me: I recently couldn't install Oracle with a local user (as suggested here before) because the target machine (Win2k8 x64) was also the Domain Controller of that network.
All users were in domain - no local users available :(
Here are the steps I performed:
Installed Oracle XE in my local machine (that works fine). Made a backup (using the built-in backup.bat);
Transferred the fast_recovery_area folder to my target machine;
Installed the Oracle XE in the target machine normally;
Edited the %ORA_HOME%\network\admin\sqlnet.ora file and performed this well-known edit:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
Edited the %ORA_HOME%\bin\restore.bat file:
Replaced every entry rman target / (...) by rman target sys/MySysDbaPass (...)
Replaced every entry (...) connect / as sysdba^; by (...) connect sys/MySysDbaPass as sysdba^;
Runned restore.bat - when prompted, pointed to the fast_recovery_area I've transferred before.
Done! (pheew!)
Sorry for answering this YEARS old question, but I managed to make it work...
Make sqlnet.ora change.
Run StopDB.bat
Run MakeDB.bat
This will create a demo database, reset the password to 'oracle', and will also allow you to connect without error.

Resources