温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ORA-12516故障的解决方法

发布时间:2021-11-12 15:35:12 来源:亿速云 阅读:527 作者:柒染 栏目:关系型数据库

本篇文章给大家分享的是有关ORA-12516故障的解决方法,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

      早上刚上班,同事告诉我数据库连不上了,提示“ORA-12516”错误,我尝试通过PL/SQL Developer远程连接数据库,果然,报错了“ORA-12516: TNS: 监听程序无法找到匹配协议栈的可用句柄”;接着我通过远程桌面登录服务器,尝试用sys用户登录数据库,报了同样的错误。奇怪,昨天下班时还好好的。
     我上网查了一下,这个报错一般是由于数据库的当前会话数不足造成的,相关的参数有两个:processes和sessions。我想查一下数据库这两个参数,但是sys用户无法登陆,真是着急。后来在朋友的建议下,采取以下步骤,顺利解决了这个问题。

a.关闭listener,禁止新的连接;
b.杀掉local=no的部分或者全部进程(根据业务的重要性),杀掉几个,保证sys用户能登陆;
c.登进去看看哪个业务出问题了,杀掉出问题的用户进程;
d.检查数据库;
e.启动listener;


介绍一下我的操作环境:
操作系统:Windows Server 2008 R2
数据库:Oracle 10g
      
     首先,通过lsnrctl stop关闭监听器,禁止新的连接,以确保第二步能够执行成功;
     第二,关闭了两个连接数据库的应用程序,然后尝试用sys用户登录数据库,登录成功;
     第三,查看了processes和sessions两个初始化参数值,分别为150、170,均为默认值;

点击(此处)折叠或打开

  1. SQL>

  2. SQL> show parameter processes


  3. NAME TYPE VALUE

  4. ------------------------------------ ----------- ------------------------------

  5. aq_tm_processes integer 0

  6. db_writer_processes integer 3

  7. gcs_server_processes integer 0

  8. job_queue_processes integer 10

  9. log_archive_max_processes integer 2

  10. processes integer 150

  11. SQL> show parameter sessions


  12. NAME TYPE VALUE

  13. ------------------------------------ ----------- ------------------------------

  14. java_max_sessionspace_size integer 0

  15. java_soft_sessionspace_limit integer 0

  16. license_max_sessions integer 0

  17. license_sessions_warning integer 0

  18. logmnr_max_persistent_sessions integer 1

  19. sessions integer 170

  20. shared_server_sessions integer

  21. SQL>

      第四,通过select sid,serial#,program,terminal from v$session;查看当前所有会话信息,从当时的结果可以看到,有一百多条记录,已经超过了数据库的session上限;而且,除了Oracle自身的十几个会话外,其余一百多个会话都是同一个terminal。由此,找出了故障点所在(这台设备是昨晚刚刚安装的一台终端)。
     第五,关闭故障设备上的应用程序,再次通过select sid,serial#,program,terminal from v$session;查看当前所有会话信息,查询结果显示只剩下二十多条会话信息,考虑到Oracle自身的十几个会话外和同时启动的几个应用程序,应该是正常的;
     第六,启动listener,尝试通过其他客户端连接数据库,一切正常,到此故障解决;
     接下来,我想看一下究竟是什么原因导致了这次故障,继续;
     第七,查看报警日志,在日志中看到了大量的Process m000 died报警;

点击(此处)折叠或打开

  1. Wed Apr 29 21:27:31 2015

  2. ksvcreate: Process(m000) creation failed

  3. Wed Apr 29 21:28:32 2015

  4. Process m000 died, see its trace file

  5. Wed Apr 29 21:28:32 2015

  6. ksvcreate: Process(m000) creation failed

  7. Wed Apr 29 21:29:33 2015

  8. Process m000 died, see its trace file

    第八,找到对应时间的trace文件,看到了“ORA-00020: maximum number of processes 150 exceeded Died during process startup with error 20 (seq=5413)”语句,原来是连接数超过了阀值,数据库无法再建立新的连接,所以报错。

点击(此处)折叠或打开

  1. Dump file c:\\oracle\\product\\10.2.0\\admin\\hoegh\\bdump\\hoegh_ora_8032.trc

  2. Wed Apr 29 21:28:31 2015

  3. ORACLE V10.2.0.4.0 - 64bit Production vsnsta=0

  4. vsnsql=14 vsnxtr=3

  5. Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  7. Windows NT Version V6.1 Service Pack 1

  8. CPU : 24 - type 8664, 12 Physical Cores

  9. Process Affinity : 0x0000000000000000

  10. Memory (Avail/Total): Ph:3339M/8181M, Ph+PgF:10815M/16361M

  11. Instance name: hoegh


  12. Redo thread mounted by this instance: 1


  13. Oracle process number: 0


  14. Windows thread id: 8032, image: ORACLE.EXE



  15. ORA-00020: maximum number of processes 150 exceeded

  16. Died during process startup with error 20 (seq=5413)

  17. OPIRIP: Uncaught error 20. Error stack:

  18. ORA-00020: maximum number of processes (150) exceeded

  19. Dump file c:\\oracle\\product\\10.2.0\\admin\\hoegh\\bdump\\hoegh_ora_8032.trc

  20. Thu Apr 30 00:19:05 2015

  21. ORACLE V10.2.0.4.0 - 64bit Production vsnsta=0

  22. vsnsql=14 vsnxtr=3

  23. Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

  24. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  25. Windows NT Version V6.1 Service Pack 1

  26. CPU : 24 - type 8664, 12 Physical Cores

  27. Process Affinity : 0x0000000000000000

  28. Memory (Avail/Total): Ph:3347M/8181M, Ph+PgF:10813M/16361M

  29. Instance name: hoegh


  30. Redo thread mounted by this instance: 1


  31. Oracle process number: 0


  32. Windows thread id: 8032, image: ORACLE.EXE



  33. ORA-00020: maximum number of processes 150 exceeded

  34. Died during process startup with error 20 (seq=5582)

  35. OPIRIP: Uncaught error 20. Error stack:

  36. ORA-00020: maximum number of processes (150) exceeded

  37. Dump file c:\\oracle\\product\\10.2.0\\admin\\hoegh\\bdump\\hoegh_ora_8032.trc

  38. Thu Apr 30 01:27:31 2015

  39. ORACLE V10.2.0.4.0 - 64bit Production vsnsta=0

  40. vsnsql=14 vsnxtr=3

  41. Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

  42. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  43. Windows NT Version V6.1 Service Pack 1

  44. CPU : 24 - type 8664, 12 Physical Cores

  45. Process Affinity : 0x0000000000000000

  46. Memory (Avail/Total): Ph:3350M/8181M, Ph+PgF:10812M/16361M

  47. Instance name: hoegh


  48. Redo thread mounted by this instance: 1


  49. Oracle process number: 0


  50. Windows thread id: 8032, image: ORACLE.EXE



  51. ORA-00020: maximum number of processes 150 exceeded

  52. Died during process startup with error 20 (seq=5650)

  53. OPIRIP: Uncaught error 20. Error stack:

  54. ORA-00020: maximum number of processes (150) exceeded

  55. Dump file c:\\oracle\\product\\10.2.0\\admin\\hoegh\\bdump\\hoegh_ora_8032.trc

  56. Thu Apr 30 09:54:12 2015

  57. ORACLE V10.2.0.4.0 - 64bit Production vsnsta=0

  58. vsnsql=14 vsnxtr=3

  59. Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

  60. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  61. Windows NT Version V6.1 Service Pack 1

  62. CPU : 24 - type 8664, 12 Physical Cores

  63. Process Affinity : 0x0000000000000000

  64. Memory (Avail/Total): Ph:3857M/8181M, Ph+PgF:11421M/16361M

  65. Instance name: hoegh


  66. Redo thread mounted by this instance: 1


  67. Oracle process number: 0


  68. Windows thread id: 8032, image: ORACLE.EXE

        至于为什么新增设备会产生大量连接,到现在还没有搞清楚,怀疑和操作系统有关,这台设备安装的操作系统是windows xp embeded裁剪版系统,据说在安装系统时不太顺利;在故障设备上启动应用程序,通过select sid,serial#,program,terminal from v$session;监控实时会话信息,会话数不断增多,直到触碰阀值,数据库报错,问题成功复现;
       我们又找来另外一台相同配置、相同操作系统的设备进行测试,没有出现这个问题。最后,只能把这台设备重装系统。

       下面总结一下ORA-12516错误的解决办法:
一、一般是由于数据库的当前会话数不满足造成的,可以视业务需要增加processes和sessions参数的大小,这二者的关系是:sessions=(1.1*processes+5);
二、如果存在类似上述案例的恶意连接,可以按照上述步骤找到问题session,直接kill相关进程。

以上就是ORA-12516故障的解决方法,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI