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

Recently, when I was combing the environment, I found that the environment was not generally complex and the configuration was not generally messy. When I was just combing the environment, I found that a library could not be connected through conn/as SYSDBA. The specific process is as follows:

1.Error message

[oracle@ ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 24 09:48:26 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> conn /as sysdba;
ERROR:
ORA-12162: TNS:net service name is incorrectly specified


SQL> exit

2.Cause of error

Generally, this kind of error is caused by the configuration of environment variables, or the correct Oracle is not configured_ SID、ORACLE_ Home, or listen to configuration environment variables and. Bash_ Profile environment variable configuration is inconsistent

Here, it is found that the operating system environment variable is not configured with Oracle_ SID

[oracle@ ~]$ env |grep ORA
ORACLE_BASE=/data/oracle
ORACLE_HOME=/data/oracle/product/11.2.0/dbhome_1

3.Solutions

Add Oracle user to. Bash_ Add specific Oracle to profile_ Sid and application

[oracle@ ~]$ vi ~/.bash_profile 
ORACLE_BASE=/data/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
ORACLE_SID=orcl
export ORACLE_SID ORACLE_BASE ORACLE_HOME
[oracle@ ~]$ source ~/.bash_profile 

[oracle@ ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 24 10:00:40 2018

Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> conn /as sysdba;
Connected.
SQL>

Similar Posts: