ORA-12162 TNS:net service name is incorrectly specified

Hi,

Sometimes You can get ” ORA-12162 TNS:net service name is incorrectly specified ” error.

 

ORA-12162 TNS:net service name is incorrectly specified

Details of error are as follows.

ORA-12162 TNS:net service name is incorrectly specified

Cause: The connect descriptor corresponding to the net service name in TNSNAMES.ORA or
in the directory server (Oracle Internet Directory) is incorrectly specified.

Action: If using local naming make sure there are no syntax errors in the
corresponding connect descriptor in the TNSNAMES.ORA file. If using directory naming
check the information provided through the administration used for directory naming.

ORA-12162

If you get this error, Check your $ORACLE_HOME and $ORACLE_SID, if they are correct or not.
$ echo $ORACLE_HOME
$ echo $ORACLE_SID

If they are not set, then set them as follows.

export ORACLE_HOME=/u01/app/product/12.2.0/dbhome_1

export ORACLE_SID=MSDB

 

 

TNS:net service name is incorrectly specified

Or you can add the following Oracle environments to the Bash Profile file.

Bash Profile file name may be .bash_profile, .profile or .bashrc files according to OS.

 

export ORACLE_HOME=/u01/app/product/12.2.0/dbhome_1
export ORACLE_BASE=/u01/app
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export ORACLE_SID=MSDB

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
Or
1. Make sure to add the $ORACLE_SID environment variable to the .profile for the Oracle user.
This will give the BEQUEATH adapter a route to connect to the Database.2. Make sure on REMOTE connections to always include a connection string.
When making a connection from on the same server but not in the same ORACLE_HOME, it is required that a connection string containing an ADDRESS and a SERVICE value is included.
This can take the form of a local tnsnames.ora file, an EZCONNECT string, or a centralized LDAP Server.

If using local naming make sure there are no syntax errors in the corresponding connect descriptor in the TNSNAMES.ORA file. If using directory naming check the information provided through the administration used for directory naming.

 

 

Do you want to learn more details about RMAN, then read the following articles.

RMAN Tutorial | Backup, Restore and Recovery Tutorials For Beginner Oracle DBA

 

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Leave a Reply

Your email address will not be published. Required fields are marked *