查看数据库是否有死锁信息并处理(MSSQL/ORACLE)

SQL SERVER


select    
    request_session_id spid,   
    OBJECT_NAME(resource_associated_entity_id) tableName    
from    
    sys.dm_tran_locks   
where     
    resource_type='OBJECT' 
 KILL 82 --干掉进程

ORACLE


select sess.sid, 
sess.serial#, 
lo.oracle_username, 
lo.os_user_name, 
ao.object_name, 
lo.locked_mode, 
SESS.machine 
from v$locked_object lo, 
dba_objects ao, 
v$session sess 
where ao.object_id = lo.object_id and lo.session_id = sess.sid; 

alter system kill session '855,6061';  --干掉进程

你可能感兴趣的:(查看数据库是否有死锁信息并处理(MSSQL/ORACLE))