Oracle SQL statement and deadlock query is executing and processing queries

Recent data import large quantities of looking at projects in operation, but when it comes to large data table is also associated with other more, insert lead to an Oracle table is locked, the text lookup table records state tables are locked and being executed SQL.
1. The following SQL is used to view the current logged-in user database and executing SQL

     SELECT b.sid oracleID,  
           b.username 登录Oracle用户名,  
           b.serial#,  
           spid 操作系统ID,  
           paddr,  
           sql_text 正在执行的SQL,  
           b.machine 计算机名  
    FROM v$process a, v$session b, v$sqlarea c  
    WHERE a.addr = b.paddr  
       AND b.sql_hash_value = c.hash_value;

2. see which tables are locked

select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;

3. Check which table session due to be locked

select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time; 

4. clearly session lock table

--alter system kill SESSION '405,47249';

Wherein step 405 is isolated sid 3, 47249 is isolated in step a serial # 3

Published 46 original articles · won praise 13 · views 60000 +

Guess you like

Origin blog.csdn.net/luliuliu1234/article/details/83280701