oracle quickly and thoroughly to kill the session

Today, the development of feedback that the implementation of a program update when hang lived, looked at what is a small table, just over 3000 lines of data. The first reaction is a lock, to all the session kill of this example, performed live update or hang separately select quickly performed under conditions where the latter. So I think it should be there on the 2-node lock, then execute the query:

select * from gv$lock where id1=383105;

SQL> select * from gv$lock where id1=383105;

INST_ID ADDR KADDR SID TYPE ID1 ID2 LMODE REQUEST CTIME BLOCK


2 0000000110AF61B0 0000000110AF6210 1333 TM 383105 0 3 0 6819 2

Sure enough, there is a session on node 2 holds lock.

2 is connected to the node, execute the query:

SQL> select sid,serial#,osuser from v$session where sid=1333;

SID SERIAL# OSUSER


 1333          22559 6005821                       

alter system kill session '1333,22559';

After killing the session, then check and found that there are 1333 session:

SQL> select sid,serial#,osuser from v$session where sid=1333;

SID SERIAL# OSUSER


 1333          22559 6005821 

So I think from the system level kill, but not the query spid 1333 through the following sql

select p.pid,p.spid,s.sid,s.serial# from v$process p,v$session s where s.paddr=p.addr and s.sid=1333;

After the inquiry found that when Oracle after the kill session, Oracle simply related to the session paddr point to the same virtual address. In this case v $ process and v $ session losing relevance, the process to a halt. Then you wait for Oracle PMON to clear the Session. It is usually a wait is marked Killed exit of Session takes a long time. If this time is Kill the process, re-attempting the task, then immediately receive the process interrupted tips , process exit, then Oracle PMON will start immediately to clear the session. this is a time exception interrupt handler.

Before paddr find the following sql:

select p.addr from v$process p where pid <> 1
minus
select s.paddr from v$session s;

07000107C8C050F8
07000107DCC19D88

Find spid v $ process according to the addr:

select * from v$process where addr in ('07000107C8C050F8','07000107DCC19D88');

Then find the system process ID, kill enough. As part of the process is not under execution results reservations, only to record the sql.

oracle@cq2:] ps -ef|grep 8847870
oracle 8847870 1 3 Aug 06 - 734:23 ora_pz99_CQRPT2
oracle 10420652 13107576 0 11:11:01 pts/1 0:00 grep 8847870
[oracle@cq2:] ps -ef|grep 14221746
oracle 12583324 13107576 0 11:11:22 pts/1 0:00 grep 14221746
oracle 14221746 1 0 08:16:07 - 0:04 oracleCQRPT2 (LOCAL=NO)
[oracle@cq2:] kill -9 14221746
[oracle@cq2:] ps -ef|grep 14221746
oracle 12583046 13107576 0 11:12:11 pts/1 0:00 grep 14221746

The testing process can also view another article: https://www.cnblogs.com/kerrycode/p/4034231.html

Guess you like

Origin blog.51cto.com/214320/2437350