码迷,mamicode.com
首页 > 数据库 > 详细

sqlplus登录用户hang住

时间:2020-07-26 23:22:22      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:产生   sleep   技术   密码   com   cache   环境   where   create   

环境oracle 11.2.0.4, linux redhat 6.9  RAC2个实例

1.问题现象

sqlplus登录用户hang住

oracle@wocdb6 ~]$ sqlplus wa/Sx

SQL*Plus: Release 11.2.0.4.0 Production on Thu Jul 23 09:47:40 2020

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

ERROR:
ORA-01017: invalid username/password; logon denied

2.排查异常情况

PROGRAM         USERNAME   OSUSER    SQL_ID      MACHINE   STATUS S_TIME    EVENT
------------------------- ----- ------- -------------- -------- -------------- ---------
JDBC Thin Client           admin           osx-scp001xx ACTIVE        library cache lock
JDBC Thin Client           admin           osx-scp001xx ACTIVE        library cache lock
JDBC Thin Client           admin           osx-scp001xx ACTIVE        library cache lock
gate_svr@localhost (TNS V  root               localhost    ACTIVE        library cache lock
gate_svr@localhost (TNS V  root               localhost    ACTIVE        library cache lock
gate_svr@localhost (TNS V  root               localhost    ACTIVE        library cache lock
gate_svr@localhost (TNS V  root               localhost    ACTIVE        library cache lock
gate_svr@localhost (TNS V  root               localhost    ACTIVE        library cache lock
gate_svr@localhost (TNS V  root               localhost    ACTIVE        library cache lock
gate_svr@localhost (TNS V  root               localhost    ACTIVE        library cache lock

检查RAC 2个节点,ACTIVE的Session都是啥event,可以发现是library cache lock
1. 会话等待事件是library cache lock
2. ???USERNAME 都是null?
3. 为啥没有library cache pin ? or 其它的等待事件!!!

3.观察AWR报告

SQL> begin
  2   dbms_workload_repository.create_snapshot();
  3   end;
  4  /
PL/SQL procedure successfully completed.
技术图片
观察 connect xxx   99%!!!

--关闭错误输入密码时的密码延迟验证特性,避免用户持续输入错误密码时产生大量的library cache lock等待,严重时使数据库完全不能登录

alter system set event=‘28401 trace name context forever,level 1‘,‘10949 trace name context forever,level 1‘ scope=spfile;

 

In 11g there is an intentional delay between allowing failed logon
attempts to retry. For some specific application types this can cause
a problem as the row cache entry is locked for the duration of the
delay . This can lead to excessive row cache lock waits for DC_USERS
for specific users / schemas .
 
This "fix" allows the logon delay to be disabled in 11.2.0.1 onwards
by setting event 28401 in the init.ora.
eg:
    event="28401 trace name context forever, level 1" # disable logon delay.
This "event" will disable the logon sleep delay system-wide, 
ie. it will affect all user accounts, system-wide, and so should be used
    with extreme caution.

观察上述信息,可以了解到问题的原因,需要确认!
1.关闭监听,组织新的会话连接;
$ srvctl stop listener
2.杀掉已连接的会话

select ‘alter system kill session ‘‘‘||sid||‘,‘||serial#||‘‘‘ immediate;‘ as "sql_text" from v$session where event=‘library cache lock‘;

3.测试确认是密码错误【已掌握密码】
会话均不存在后,测试登录是等待一段时间可以出现报错信息,而非Hang住

ERROR:
ORA-01017: invalid username/password; logon denied

  4.修改密码即可!

SQL> alter user wxx identified by "Sxx1";

  5.启动监听

$ srvctl start listener

!如果想后续再次出现同样的问题,可以设置上述Event,本次由于是稳定的生产环境,极少出现,因此并未设置event.

sqlplus登录用户hang住

标签:产生   sleep   技术   密码   com   cache   环境   where   create   

原文地址:https://www.cnblogs.com/lvcha001/p/13381682.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!