zoukankan      html  css  js  c++  java
  • 052-188(新增70题2018)

    One of the users in the PROD database, Adams, complains that his update on the table, TRANS, is taking an unusually long time to complete. You find that the table gets locked by another database user before Adams starts his transactions, and you are unable to contact the user holding the table lock. As Adams is updating some crucial rows in the table, he should get the highest priority.

    Which method would you use to overcome this problem?

    A. execute the command, ALTER SESSION KILL ... to kill the blocking session
    B. execute the DBMS_SESSION.KILL_SESSION procedure to kill the blocking session
    C. execute the command, ALTER SYSTEM KILL SESSION ... to kill the blocking session
    D. execute the command, ALTER SESSION UNLOCK ... to release the lock for the blocking session
    E. execute the command, ALTER SYSTEM UNLOCK SESSION ... to release the lock for the blocking session

    Answer: C

    alter system kill session 如何实现立即结束一个会话
    oracle官方DOC中提到alter system kill session +sid先将会话标记为中断,待PMON进程回收资源才会释放锁
    c选项加IMMEDIATE符合题意
    https://zhidao.baidu.com/question/551264324.html

    一些ORACLE中的进程被杀掉后,状态被置为"killed",但是锁定的资源很长时间不释放,有时实在没办法,只好重启数据库。现在提供一种方法解决这种问题,那就是在ORACLE中杀不掉的,在OS一级再杀。
    1.下面的语句用来查询哪些对象被锁:
    select object_name,machine,s.sid,s.serial#
    from v$locked_object l,dba_objects o ,v$session s
    where l.object_id = o.object_id and l.session_id=s.sid;
    2.下面的语句用来杀死一个进程:
    alter system kill session '24,111'; (其中24,111分别是上面查询出的sid,serial#)
    【注】以上两步,可以通过Oracle的管理控制台来执行。
    3.如果利用上面的命令杀死一个进程后,进程状态被置为"killed",但是锁定的资源很长时间没有被释放,那么可以在os一级再杀死相应的进程(线程),首先执行下面的语句获得进程(线程)号:
    select spid, osuser, s.program
    from v$session s,v$process p
    where s.paddr=p.addr and s.sid=24 (24是上面的sid)
    4.在OS上杀死这个进程(线程):
    1)在unix上,用root身份执行命令:
    #kill -9 12345(即第3步查询出的spid)
    2)在windows(unix也适用)用orakill杀死线程,orakill是oracle提供的一个可执行命令,语法为:
    orakill sid thread
    其中:
    sid:表示要杀死的进程属于的实例名
    thread:是要杀掉的线程号,即第3步查询出的spid。
    例:c:>orakill orcl 12345
  • 相关阅读:
    微信聊天框测试思路
    巧用&&和|| 让逻辑代码更简洁,逼格看起来更高一点(玩笑脸)
    获取URL中的参数
    解决移动端点击闪烁问题
    npm安装依赖包 --save-dev 和 --save; package.json的devDependencies和dependencies 的区别!
    vue-cli 3配置接口代理
    js小方法积累,将一个数组按照n个一份,分成若干数组
    web前端识别文字转语音
    html 锚点
    ES6 必须要用的数组Filter() 方法,不要再自己循环遍历了!!!
  • 原文地址:https://www.cnblogs.com/Babylon/p/8575176.html
Copyright © 2011-2022 走看看