首页 > 代码库 > 关于死锁的一些SQL

关于死锁的一些SQL

//查询表空间
select tablespace_name,file_id,file_name,round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name
//设置表空间大小
alter database datafile ‘D:\ORACLE\ORADATA\ORCL\USERS01.DBF‘ resize 200m
//设置表空间自增长
alter database datafile ‘D:\ORACLE\ORADATA\ORCL\USERS01.DBF‘ autoextend on next 100m
//查看表空间剩余多少
select sum(bytes)/(1024*1024) as free_space,tablespace_name from dba_free_space group by tablespace_name


--查看哪些对象锁死
select object_name,machine,s.OSUSER,s.sid,s.serial#
from v$locked_object l,dba_objects o,v$session s
where l.OBJECT_ID=o.OBJECT_ID and l.SESSION_ID=s.SID

--使用系统管理员删除死锁进程
alter system kill session ‘1052,26737‘

--查看指定的死锁信息
select spid,OSUSER,s.program from v$session s,v$process p
where s.paddr=p.ADDR and s.SID=1052

--查看哪些对象死锁
select object_name,machine,s.OSUSER,s.sid,s.SERIAL# from v$locked_object l, dba_objects o, v$session s where l.OBJECT_ID=o.OBJECT_ID and l.SESSION_ID=s.SID

--查看指定的死锁信息
select spid,s.OSUSER,s.PROGRAM from v$session s, v$process p where s.SADDR=p.ADDR and s.SID=125

--使用系统定理员删除死锁进程
alter system kill session ‘125,8575‘

关于死锁的一些SQL