SQL> create or replace procedure kill_session is
2 v_sid number;
3 v_serial number;
4 killer varchar2(1000);
5 CURSOR cursor_session_info
6 is
7 select sid,serial#
8 from v$session
9 where type!='BACKGROUND'
10 and status='INACTIVE'
11 and last_call_et>43200;
15 begin
16 open cursor_session_info;
17 loop
18 fetch cursor_session_info into v_sid,v_serial;
19 exit when cursor_session_info%notfound;
20 killer:='alter system disconnect session '''||v_sid||','||v_serial||''' post_transaction immediate';
21 execute immediate killer;
22 end loop;
23 dbms_output.PUT_LINE(cursor_session_info%rowcount||' users with idle_time>2700s have been killed!');
24 close cursor_session_info;
25 end kill_session;
26 /
警告: 创建的过程带有编译错误。
SQL> show error
PROCEDURE KILL_SESSION 出现错误:
LINE/COL ERROR
-------- -----------------------------------------------------------------
7/6 PL/SQL: SQL Statement ignored
8/13 PL/SQL: ORA-00942: table or view does not exist
SQL> spool off
在PL/SQL develope中也是报这个错,而且光标定位在“from v$session”这一行,怎么回事,请高手赐教!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/310745/viewspace-6318/
,如需转载,请注明出处,否则将追究法律责任。