Home > Blockchain >  How kill running procedure in cx_oracle?
How kill running procedure in cx_oracle?

Time:11-01

I have very long time executable proc, and need close it. What is the best way to do this?? Using Oracle 19, cx_oracle 7.2.2. Connection started in SessionPool.

Found several ways, throw ^C forcibly and try

ALTER SYSTEM CANCEL SQL 'SID, SERIAL[, @INST_ID][, SQL_ID]';

CodePudding user response:

Depending on what you want to achieve, you have either the cancel sql statement you pointed to, or the alter system kill session method. The first one will just cancel the current sql (if you specify the sql_id), and then the session continues (depending on how you handle errors in your code). The second method will kill your session, and your program will need to recapture a connection from the pool and try again. Another comment, you better upgrade your cx_oracle to the newest oracledb provider. 7.2 is fairly old.

  • Related