tnsping command not found
This type of error message tnsping command not found in Linux or tnsping is not recognized as an internal or external command in Windows indicates that the command you issued is missing in ordinary execution directories. As a result, the shell does not recognize it. Let's see some more details.
Phenomenon
For Linux
[oracle@test ~]$ tnsping compdb
-bash: tnsping: command not found
The shell returned tnsping command not found.
For Windows
C:\Users\ed>tnsping compdb
'tnsping' is not recognized as an internal or external command,
operable program or batch file.
Solutions
For Linux
tnsping command not found means that the shell cannot find tnsping command in $PATH, you should add the path $ORACLE_HOME/bin to it.
[oracle@primary01 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/19.0.0/db_1
[oracle@primary01 ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@primary01 ~]$ echo $PATH
/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.:/u01/app/oracle/product/19.0.0/db_1/bin
To check the exact location of tnsping command, we can do this:
[oracle@primary01 ~]$ which tnsping
/u01/app/oracle/product/19.0.0/db_1/bin/tnsping
For Windows
Actually, tnsping is not recognized as an internal or external command is a DOS shell error. DOS shell cannot recognize your command in any directories in %PATH% variable. That's because you have not append bin directory of Oracle Client to the environment variable %PATH%. You may check the variable like this:
C:\Users\ed>echo %PATH%
You have to append the bin location of Oracle Client to the environment variable %PATH% in Windows or $PATH in Linux.
I don’t know who needs to hear this but I couldn’t get it to work until I added dot exe. I needed to type tnsping.exe at the prompt– leaving off dot exe gave me the not recognized as an internal or external command message in Windows.
OK, it sounds weird. Thanks for sharing.