create or replace procedure solve_lock_061203(v_msg out varchar2)
asv_sql varchar2(3000); --定義 v_sql 接受抓取鎖的sql語句
kill_sid number;
kill_serial number;
cur_lock sys_refcursor; --定義游標變數,迴圈執行抓取鎖的sql語句
cur_lock02 sys_refcursor;
type tp_lock is record( --定義 record型別的 變數
v_sid number,
v_type varchar2(10),
v_id1 number,
v_id2 number,
v_lmode varchar2(200),
v_request varchar2(200),
v_lock_time number,
v_block number);
records_lock tp_lock;
type tp_lock02 is record(
waiting_sid number,
waiting_sql varchar2(1000),
blocker_event varchar2(1000),
blocking_sid number,
blocking_sql varchar2(1000));
records_lock02 tp_lock02;
v_blocking_sid number;
v_waiting_sid number;
begin
v_msg := '';
v_sql := '';
v_msg := v_msg ||
'------------------查詢資料庫中是否有鎖阻塞、鎖等待的情況------------------' ||
chr(10);
-- dbms_output.put_line('------------------查詢資料庫中是否有鎖阻塞、鎖等待的情況------------------');
v_sql := 'select sid,type,id1,id2,
decode(lmode,0, ''none'',1,''null'', 2, ''row share'' ,3, ''row exclusive'' ,4, ''share'' ,5, ''share row exclusive'' ,6 ,''exclusive'' ,''null'') lock_type,
decode(request,0, ''none'',1,''null'', 2, ''row share'' ,3, ''row exclusive'' ,4, ''share'' ,5, ''share row exclusive'' ,6 ,''exclusive'' ,''hull'') lock_request,
ctime,block from v$lock where type in (''tm'',''tx'')';
open cur_lock for v_sql;
loop
fetch cur_lock
into records_lock;
exit when cur_lock%notfound;
if records_lock.v_request <> 'none' then
--抓取發出請求鎖的會話
v_msg := v_msg || 'waiting sid: ' || records_lock.v_sid ||
' is request a lock ,lock_mode is ' ||
records_lock.v_request || ' and being locked ' ||
records_lock.v_lock_time || 's' || chr(10);
--dbms_output.put_line('waiting sid: '||records_lock.v_sid||' is request a lock ,lock_mode is '||records_lock.v_request||' and being locked '|| records_lock.v_lock_time||'s');
v_waiting_sid := records_lock.v_sid;
end if;
if records_lock.v_block <> 0 then
--抓取發生鎖阻塞的會話
v_msg := v_msg || 'blocking sid: ' || records_lock.v_sid ||
' is make a lock , lock_mode is ' || records_lock.v_lmode ||
chr(10);
/* dbms_output.put_line('blocking sid: ' || records_lock.v_sid ||
' is make a lock , lock_mode is ' ||
records_lock.v_lmode);*/
v_blocking_sid := records_lock.v_sid;
end if;
end loop;
close cur_lock;
v_sql := '';
v_msg := v_msg ||
'------------------查詢產生鎖的會話、鎖等待的會話------------------------' ||
chr(10);
-- dbms_output.put_line('------------------查詢產生鎖的會話、鎖等待的會話------------------------');
v_sql := 'select distinct waiter.sid "waiting_sid",w_sql.sql_text "sql from waiting session",blocker.event "blocker event",blocker.sid "blocking sid",
b_sql.sql_text "sql from blocking session" from v$session waiter, v$session blocker,v$sql w_sql,v$sql b_sql
where waiter.event=''enq: tx - row lock contention'' and waiter.blocking_session=blocker.sid
and w_sql.sql_id=waiter.sql_id
and b_sql.sql_id =nvl(blocker.sql_id,blocker.prev_sql_id)';
open cur_lock02 for v_sql;
loop
fetch cur_lock02
into records_lock02;
exit when cur_lock02%notfound;
if records_lock02.waiting_sid is not null then
v_msg := v_msg || 'waiting sid: ' || records_lock02.waiting_sid ||
' wait_sql is : ' || records_lock02.waiting_sql || chr(10);
/* dbms_output.put_line('waiting sid: ' || records_lock02.waiting_sid ||
' wait_sql is : ' || records_lock02.waiting_sql);*/
end if;
if records_lock02.blocking_sid is not null then
v_msg := v_msg || 'blocking sid: ' || records_lock02.blocking_sid ||
' block_sql is : ' || records_lock02.blocking_sql || chr(10);
/* dbms_output.put_line('blocking sid: ' || records_lock02.blocking_sid ||
' block_sql is : ' ||
records_lock02.blocking_sql);*/
end if;
end loop;
close cur_lock02;
v_msg := v_msg || '------------------解決 鎖阻塞、鎖等待------------------' ||
chr(10);
-- dbms_output.put_line('------------------解決 鎖阻塞、鎖等待------------------');
select sid, serial#
into kill_sid, kill_serial
from v$session
where sid = v_blocking_sid;
v_msg := v_msg || 'action: alter system kill session ( ' || kill_sid || ',' ||
kill_serial || ')' || chr(10);
/* dbms_output.put_line('action: alter system kill session ( ' || kill_sid || ',' ||
kill_serial || ')');*/
exception
when no_data_found then
v_msg := v_msg || sqlerrm;
/* dbms_output.put_line(sqlcode || sqlerrm);*/
end solve_lock_061203;
模擬102 題解
顯然是單調棧處理。然而優弧 劣弧兩種情況,加上高度存在相同,就比較難處理。然而環是可以平移的,所以乙個好的方法是將其中的最大值移到乙個端點,於是跨環端點的情況只出現在 右半部分形成乙個單調不降的序列。順便去重就可以了。打表發現 dp i 2 dp dp 2 dp n 為最終的答案。將式子拆一下,似乎...
IP102,IP102 K V3 0 輸入節點機
針對於教學錄播 會議錄播的前端裝置解決方案。系統功能全面,結構靈活,主要功能特點如下 1 支援對dvi高標清訊號的採集輸出。2 支援對vga高標清訊號的採集輸出。3 支援1路串列埠輸出,用於雲台控制。5 支援udp輸出 支援rtmp輸出 支援rtsp輸出。6 支援對udp流的輸出方式和鏈路頻寬適配情...
實驗報告 10 2
2012 04 21 13 35 111人閱讀 3 收藏舉報 作 者 完成日期 2012 年 04 月 21 日 版 本 號 v1.0 對任務及求解方法的描述部分 輸入描述 問題描述 程式輸出 程式頭部的注釋結束 include include include setw 設定輸出資料的寬度,使用時應...