1. 程式人生 > >052-188(新增70題2018)

052-188(新增70題2018)

program lan unlock mman gpo actions 其中 查詢 mon

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

052-188(新增70題2018)