프린트 하기 URL 복사

OS 환경 : Oracle Linux 8.7 (64bit)

 

DB 환경 : Oracle Database 19.27.0.0

 

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

sqlplus / as sysdba 접속시 발생하는 에러

1
2
3
4
5
6
7
8
9
10
11
12
$ sqlplus / as sysdba
 
SQL*Plus: Release 19.0.0.0.0 - Production on Sun May 17 13:35:09 2026
Version 19.27.0.0.0
 
Copyright (c) 19822024, Oracle.  All rights reserved.
 
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
 
 
Enter user-name: ^C

 

 

해결 방법 : ORACLE_SID 환경 변수 설정

현재 실행중인 오라클 smon 프로세스 확인

1
2
3
4
$ ps -ef | grep smon
oracle   2610578       1  0 May16 ?        00:00:01 ora_smon_ORA19DBFS
oracle   3203504 3202653  0 13:35 pts/0    00:00:00 grep --color=auto smon
root     3549577       1  0 May11 ?        00:37:02 /opt/oracle.ahf/shm/ahf-sysmon/bin/ahf-sysmon

ora_smon_ORA19DBFS으로 되어 있음

 

 

현재 ORACLE_SID 환경 설정 확인

1
2
$ env | grep ORACLE_SID
ORACLE_SID=

현재 ORACLE_SID가 공백으로 되어있음

 

 

ORACLE_SID를 ORA19DBFS로 설정 후 sqlplus 재접속

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ export ORACLE_SID=ORA19DBFS
$ sqlplus / as sysdba
 
SQL*Plus: Release 19.0.0.0.0 - Production on Sun May 17 13:36:24 2026
Version 19.27.0.0.0
 
Copyright (c) 19822024, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.27.0.0.0
 
SQL> select instance_name, version, status from v$instance;
 
INSTANCE_NAME    VERSION           STATUS
---------------- ----------------- ------------
ORA19DBFS        19.0.0.0.0        OPEN

정상적으로 접속됨

 

 

추후에도 정상적인 접속을 위해 .bash_profile에도 ORACLE_SID 설정 및 저장

1
2
3
$ cd /home/oracle
$ vi .bash_profile
export ORACLE_SID=ORA19DBFS

 

 

저장

1
$ . ./.bash_profile

 

 

재확인

1
2
$ env | grep ORACLE_SID
ORACLE_SID=ORA19DBFS

정상적으로 등록됨

 

 

원인 : OS 환경변수(ORACLE_SID)가 제대로 설정되어 있지 않아 발생한 문제

OS 환경변수(ORACLE_SID)가 제대로 설정되어 있지 않아 발생한 문제
ORACLE_SID를 설정하여 해결

 

 

참조 :