How to Solve ORA-12162: TNS:net service name is incorrectly specified

This morning I try to import an Oracle dump file, but I got this error message:

ORA-12162: TNS:net service name is incorrectly specified

Some people says that there’s something wrong with the tnsnames.ora file. But I’ve checked it, and the file looks fine.

After googling for a while, I found that this error message showed up because we haven’t set the ORACLE_SID or maybe have the value set improperly.

So, if my SID is dbnew, then I type this command on my Ubuntu:

export ORACLE_SID=dbnew

If you’re using Windows, type this:

set ORACLE_SID=dbnew

Don’t forget to change the dbnew to your own SID name.

Hope it helps. 🙂