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.
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