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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值