programing

TNSPING은 괜찮지만 sqlplus는 ORA-12154를 제공합니까?

mailnote 2023. 8. 9. 20:57
반응형

TNSPING은 괜찮지만 sqlplus는 ORA-12154를 제공합니까?

Windows 서버에서 Oracle 11을 실행하고 있으며 SQL Plus를 사용하려고 하는 동일한 서버에 로그온되어 있습니다.연결하려고 하면 TNSPING 및 기타 다양한 진단이 정상으로 보이는데도 ORA-12154가 표시됩니다.

누가 그 이유를 제안할 수 있습니까? 아래에 많은 세부사항이 있습니다.


이렇게 EZCONNECT를 사용하면 sqlplus를 사용할 수 있습니다..

sqlplus EST/EST@192.168.10.15/ORCL

하지만 이렇게 TNSNAMES를 사용하여 연결하려고 하면...

sqlplus EST/EST@ORCL

알겠어요...

ORA-12154: TNS:could not resolve the connect identifier specified

TNSPING 정상 작동

C:\Documents and Settings\user1>tnsping ORCL

TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 12-NOV-2013 12:41:14

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Used parameter files:
E:\app\Administrator\product\11.2.0\dbhome_2\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.15)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL))
)
OK (20 msec)

그리고 듣는 사람은 다음과 같이 보입니다.

C:\Documents and Settings\user1>lsnrctl services

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 14-NOV-2013 12:02:59

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0
         LOCAL SERVER
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:55 refused:0 state:ready
         LOCAL SERVER
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: MARIEL, pid: 2400>
         (ADDRESS=(PROTOCOL=tcp)(HOST=mariel)(PORT=1045))
The command completed successfully

그리고 이것은

C:\Documents and Settings\user1>lsnrctl status

LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 14-NOV-2013 12:29:21

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
Start Date                14-NOV-2013 11:41:10
Uptime                    0 days 0 hr. 48 min. 11 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   E:\app\Administrator\product\11.2.0\dbhome_2\network\admin\listener.ora
Listener Log File         e:\app\administrator\diag\tnslsnr\mariel\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.15)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

다음은 다양한 구성 파일입니다.

청자 오라

# listener.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_2\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_2)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:E:\app\Administrator\product\11.2.0\dbhome_2\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.15)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = E:\app\Administrator

tnsnames.ora

# tnsnames.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_2\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.15)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL)
    )
  )

sqlnet.ora

# sqlnet.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_2\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file wont exist and without the native 
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

tnsnames.ora 파일이 있는 디렉토리를 가리키는 환경 변수 TNS_ADMIN을 생성합니다.그런 다음 sqlplus로 연결해 보십시오.

이것이 효과가 있다면 Oracle 클라이언트 소프트웨어도 설치하고 sqlplus를 실행하면 클라이언트 홈에서 tnsnames.ora 파일을 찾습니다.

창에서 환경 변수 TNS_ADMIN을 추가하는 방법
제어판/시스템으로 이동합니다.
고급 시스템 설정 선택
고급 탭을 선택하면 환경 변수 단추가 맨 아래에 있습니다.
새 변수 TNS_ADMIN을 생성하고 .ora 파일이 저장되는 경로를 지정합니다(예: C:\app\oracle\product\11.2.0\client_1\network\admin).

암호에 앳 사인(@)이 있으면 SQLplus에서 이 오류를 표시합니다.Sqlplus는 사용자가 연결 문자열을 매개 변수로 입력하고 있다고 생각합니다.암호를 변경합니다(SQL Developer를 사용하여 암호를 변경할 수 있습니다).

도덕적: 오라클 암호에 앳 마크를 사용하지 마십시오.

tnslsnr가동 중이지만 데이터베이스가 중단되었습니다.

데이터베이스가 실행 중인지 확인

ps aux | fgrep pmon

이러한 프로세스가 없는 경우 수동으로 데이터베이스 시작

su - oracle
export ORACLE_SID=XE
sqlplus sys as sysdba

그런 다음 SQL 콘솔에서

startup

암호에 @와 같은 특수 문자가 없는지 확인합니다.제 경우에는 그렇습니다.

아래를 확인하십시오. 잘못된 암호가 표시되면 특수 문자가 원인입니다.

sqlplus anyword/anyword@yourServiceName

언급URL : https://stackoverflow.com/questions/19966848/tnsping-ok-but-sqlplus-gives-ora-12154

반응형