SYSDBA用户执行以下语句创建存储过程
CREATE
OR
REPLACE
PROCEDURE
SP_K
AS
BEGIN
FOR
user_list
IN
(
select
sess_id
from
v$sessions
where
trx_id
in
(
select
wait_for_id
from
v$trxwait
)
)
LOOP
execute
immediate
‘SP_CLOSE_SESSION (‘
||user_list
.
sess_id||
‘);’
;
END
LOOP
;
COMMIT
;
END
;
创建一个普通用户
CREATE
USER
“SSS”
IDENTIFIED
BY
“123456789”
;
SYSDBA用户执行以下SQL语句
grant
EXECUTE
on
“SYSDBA”
.
“SP_K”
to
“SSS”
;
这时候登录普通用户SSS调用存储过程执行
call
SYSDBA.SP_K
();