您的位置:首页 > 大数据 > 人工智能

52.View the Exhibits and examine lock waits. Users HR and SH complain that their transactions on one

2016-07-23 07:13 627 查看
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.

答案:A

解析:我们先模拟一下图中锁定的情况

--先解锁hr、sh、scott账号

SQL> alter user hr identified by hr account unlock;

User altered.            

SQL> alter user sh identified by sh account unlock;

User altered.

SQL> alter user scott identified by tiger account unlock;

User altered. 
--然后以sh中sales表为测试表,进行update

--赋予权限

SQL> grant update on sh.sales to scott;

Grant succeeded.

SQL> grant update on sh.sales to hr;

Grant succeeded.
--打开三个crt窗口,分别以scott、sh、hr登陆然后执行如下语句



打开em可以看到如下图,这个时候可以看到每个的会话id,并且可以看到scott中的阻塞会话数为2个,分别是hr和sh



然后通过如下语句可以查看到具体的信息
select * from DBA_LOCK where session_id in (56,52,65)

然后通过下面的语句查出来56对应的serial#进行kill

SQL> select sid,serial# from v$session  where sid=56;

       SID    SERIAL#

---------- ----------

        56        619

SQL> alter system kill session '56,619';

System altered.

这个时候sh就会解锁,但是sh也没有提交,所以sh还会继续锁hr,如下图



这里可以继续kill,因此选择D
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  1z0-052
相关文章推荐