【问题标题】:ORA-12518, TNS:listener could not hand off client connection oracle 11gORA-12518, TNS:listener 无法切换客户端连接 oracle 11g
【发布时间】:2019-12-16 13:56:28
【问题描述】:

我在 Eclipse 中有一个 JAVA 应用程序,它尝试连接到 Oracle 11G 数据库,但出现以下错误:

Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12518, TNS:listener could not hand off client connection
The Connection descriptor used by the client was:
127.0.0.1:1521/XE

虽然 listener.ora 和 tnsnames.ora 的主机名为“LP-5CD9296CDZ”,但 lsnrctl 状态显示主机为 LP-5CD9296CDZ.XXX.CORP.XXX.IN

C:\WINDOWS\system32>lsnrctl status

LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 14-DEC-2019 18:20:51

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Production
Start Date                14-DEC-2019 17:52:45
Uptime                    0 days 0 hr. 28 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\listener.ora
Listener Log File         C:\oraclexe\app\oracle\diag\tnslsnr\LP-5CD9296CDZ\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=LP-5CD9296CDZ.XXX.CORP.XXX.IN)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=LP-5CD9296CDZ.XXX.CORP.XXX.IN)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
  Instance "xe", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
  Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully

我的JDBC连接网址如下: jdbc:oracle:thin:@LP-5CD9296CDZ:1521/XE 在 SQL Plus 上,我可以使用 conn 系统连接到数据库,但不能通过通过 JBOSS7.1 服务器部署的应用程序连接到数据库。

Listener.ora如下:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)

tnsnames.ora is as follows:
XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

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

结果:

   SQL>select * from v$resource_limit;

    RESOURCE_NAME CURRENT_UTIL MAX_UTIL  INITIAL_ALLOCAT  LIMIT_VALUE
    -----------------------------------------------------------------
    processes         32        100         100                100

    sessions          33        101         176                176

    enqueue_locks     16        90          2180              2180

    enqueue_resources 15        15           992              UNLIMITED

    ges_procs         0         0            0                 0

    ges_ress          0         0            0                 UNLIMITED

    ges_locks         0         0            0                 UNLIMITED

    ges_cache_ress    0         0            0                 UNLIMITED

    ges_reg_msgs      0         0            0                 UNLIMITED

    ges_big_msgs      0         0            0                 UNLIMITED

    ges_rsv_msgs      0         0            0                 0

    gcs_resources     0         0            0                 0

    gcs_shadows       0         0            0                 0

    dml_locks         0         0           772                UNLIMITED

temporary_table_locks 0         0       UNLIMITED              UNLIMITED

    transactions      0         0           193                UNLIMITED

    branches          0         0           193                UNLIMITED

    cmtcallbk         0         1           193                UNLIMITED

max_rollback_segments 11        11          193                65535

    sort_segment_locks 0        4        UNLIMITED             UNLIMITED

    k2q_locks          0        0           352                UNLIMITED

    max_shared_servers 4        4        UNLIMITED             UNLIMITED

    parallel_max_serve 0        0             0                3600


    23 rows selected.

【问题讨论】:

  • 主要原因是Listener运行的服务器资源不足。该错误通常发生在服务器负载高或会话数量多的情况下。运行select * from v$resource_limit;
  • 尝试了帖子中提到的所有解决方案。仍然无法正常工作。
  • 我做了以下操作:alter system set processes = 500 scope = spfile;更改系统设置会话 = 1000 范围 = spfile;更改系统设置事务 = 1100 范围 = spfile;然后立即关机;但在关机时它会给出错误,因为 ora 01031 权限不足。我以 SYSTEM 身份连接。
  • 问题已解决:将系统/密码连接为 sysdba,然后关闭并重新启动。感谢 DMITRY。

标签: java oracle jboss


【解决方案1】:

您的系统负载很重,已达到数据库进程 (limit 100 , max_utilisation 100) 和数据库中的会话 (limit 176, max_utilisation 101) 的最大值。您需要增加数据库进程和会话的最大数量。

>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 16 08:48:42 2019

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


Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production

SQL> show parameter processes

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     1
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     1000
log_archive_max_processes            integer     4
processes                            integer     150
SQL> alter system set processes = 500 scope = spfile;

System altered.

重启数据库。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-30
    • 2020-06-05
    • 2021-03-02
    • 1970-01-01
    • 2012-10-11
    • 1970-01-01
    • 2015-02-15
    • 1970-01-01
    相关资源
    最近更新 更多