简体   繁体   中英

SqlPlus on mac osx 10.6 doesn't work

When i try to run this

#sqlplus system@orcl

it gives me this error

SQL*Plus: Release 10.1.0.3.0 - Production on Tue Apr 20 02:24:41 2010

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

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

the oracle server is working , I can connect through SQLDeveloper

My .profile looks like this

export PATH=/opt/local/bin:/opt/local/sbin:$PATH    
# Setting PATH for Python 3.1
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.1/bin:${PATH}"
DYLD_LIBRARY_PATH=/Users/lesce/instantclient
export TNS_ADMIN=/Users/lesce/instantclient
export ORACLE_SID="orcl"
export DYLD_LIBRARY_PATH
export PATH=$PATH:/Users/lesce/instantclient

tnsnames.ora

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

listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

My SqlDeveloper configuration

username : sys
role : sysdba
connection type : basic
hostname : localhost
port : 1521
sid : orcl

Delete extraneous space in tnsnames.ora before ORCL (shown as underscores for clarity):

_____ORCL =

should be

ORCL =

SQLDeveloper does not use tnsnames.ora in "basic" mode, so it is not affected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM