ORA-12162 TNS:net service name is incorrectly specified
oracle
ORA-12162: TNS:net service name is incorrectly specified 발생
bash-4.2# sqlplus sys/oracle as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 4 03:37:39 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
ORACLE_SID 확인
bash-4.2# lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-JUN-2023 03:45:52
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 04-JUN-2023 03:12:02
Uptime 0 days 0 hr. 33 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/261d716abc02/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=261d716abc02)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "ORCLCDB" has 1 instance(s).
Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
bash-4.2# sqlplus sys/oracle@ORCLCDB as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 4 03:57:36 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select instance from v$thread;
INSTANCE
--------------------------------------------------------------------------------
ORCLCDB
ORACLE SID 환경변수 등록(export ORACLE_SID=YOUR_DB_SID)
bash-4.2# echo "export ORACLE_SID=ORCLCDB" >> ~/.bash_profile
bash-4.2# . ~/.bash_profile
bash-4.2# echo $ORACLE_SID
ORCLCDB
bash-4.2# sqlplus sys/oracle as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 4 04:13:34 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>