0. Query the stored procedure being executed:
select *
from v$db_object_cache
where locks > 0 and pins > 0 and type='PROCEDURE';
1. Find the SID of the process to be stopped in the V$ACCESS view:
example: stored procedure name : CRH_ENTRY
SELECT t.* FROM V$ACCESS t WHERE t.object='CRH_ENTRY';
PS: The query time is proportional to the number of objects.
2. Find the detected SID and SERIAL# in the V$SESSION view.
SELECT SID, SERIAL# FROM V$SESSION WHERE SID='1314';
3. Kill the found process
alter system kill session 'SID, SERIAL#'
alter system kill session '1314,63759';
Both methods can be used in sqlplus:
exec pro_name(parameter 1..); call pro_name(parameter 1..);
Differences:
1. But exec is a sqlplus command, which can only be used in sqlplus; call is an SQL command with no restrictions.
2. When the stored procedure has no parameters, exec can be directly followed by the procedure name (() can be omitted), but call must be accompanied by ().
Sql code
SQL> -- create procedure insert data
SQL> create or replace procedure pro1 is
2 begin -- execute part
3 insert into mytest values('Zhang San', 'mm');
4 end;
5 /
Procedure created
SQL> exec pro1;
PL/SQL procedure successfully completed
SQL> call pro1;
call pro1
ORA-06576: not a valid function or procedure name
SQL>call pro1();
Method called
Summary: When calling a process, you should develop the habit of using call and () with it.