TNS监听器当前不知道连接描述符中给出的SID

时间:2018-06-03 05:24:47

标签: oracle oracle11g database-connection

您好, 我在笔记本电脑上安装了Oracle 11g来练习Oracle。 我已连接到人力资源帐户。它已连接3天,但在我尝试通过SQL Developer连接后,我收到此错误:

TNS-12505: TNS:listener does not currently know of SID given in connect descriptor 

1 个答案:

答案 0 :(得分:3)

确保

  • 您的数据库 已启动 ;

    $ sqlplus / as sysdba
    SQL> startup
    
  • ORACLE_SID 参数设置为路径值;

    Windows 上,按以下方式查找:

    C:\Users\pc> echo %ORACLE_SID%
    mydb
    

    Unix 上,查找:

    $ echo $ORACLE_SID
    mydb
    
  • 监听器 正在运行:

    $ lsnrctl status
    LSNRCTL for Linux : Version 12.1.0.2.0 - Production on 03-JUN-2018 09:31:07
    
    Copyright (c) 1991, 2014, Oracle.  All rights reserved.
    
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
    Start Date                30-MAR-2018 22:29:45
    Uptime                    53 days 11 hr. 1 min. 10 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/app/12.1.0.2/grid/network/admin/listener.ora
    Listener Log File         /u01/app/grid/diag/tnslsnr/mydb/listener/alert/log.xml
    Listening Endpoints Summary...
     (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
     (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.15.81)(PORT=1521)))
     (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mycompany.com)(PORT=5505))(Presentation=HTTP)(Session=RAW))
     (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=mycompany.com)(PORT=5506)) 
     (Security=(my_wallet_directory=/u01/app/oracle/product/12.1.0.2/dbhome_1/admin/mydb/xdb_wallet))(Presentation=HTTP)(Session=RAW))
      Services Summary...
     Instance "mydb", status READY, has 1 handler(s) for this service...
     The command completed successfully