52. View the Exhibits and examine lock waits.
Users HR and SH complain that their transactions on one of the application tables, EMP, are waiting for
response.
Which action would you take to release the lock and enable users HR and SH to continue with their
transactions?
A.Kill the session of the user SCOTT with session ID118.
B.Issue manual checkpoint using the ALTER SYSTEM command.
C.Modify the profile used by user SCOTT to reduce the CONNECT_TIME limit.
D.Flush the Shared Pool to remove the SQL statement causing "wait" in memory.
Answer: A
答案解析:
参考:http://blog.csdn.net/rlhua/article/details/12652569
有冲突的锁定请求以分层布局的形式显示,其中持有锁的会话位于顶部,下面是排队请求锁的所有会话。由图上可知,SCOTT是持有锁的会话。HR和SH是排队请求锁的会话。
对于冲突中涉及的每个会话,会显示用户名、会话ID 和会话已等待的秒数。选择会话 ID 可查看会话当前正在执行或请求的实际SQL 语句。
自动数据库诊断监视器(ADDM) 还会自动检测锁冲突,并且会就低效的锁定趋势提出建议。
为了解决锁冲突,应该:
• 提交或回退持有锁的会话
• 终止持有锁的会话(在紧急情况下)
要解决锁冲突,持有锁的会话必须释放锁。让会话释放锁的最好方式是与用户联系,要求用户完成事务处理。
紧急情况下,管理员可以通过单击“Kill Session (终止会话)”按钮来终止持有锁的会话。
ALTER SYSTEM KILL SESSION '118,2597' IMMEDIATE
终止会话后,当前事务处理中的所有工作都会丢失(回退)。会话被终止的用户必须再次登录,然后重做被终止的会话自上次提交以来所做的所有工作。