--查询锁表计算机名称
select t.SID, t.SERIAL#, t.USERNAME, t.STATUS, t.MACHINE
from v$session t
where t.STATUS = 'ACTIVE'
and t.SID in
(select distinct b.session_id
from v$process p, v$session a, v$locked_object b, all_objects c
where p.addr = a.paddr
and a.process = b.process
and c.object_id = b.object_id
and c.object_name = 'DEAL_ORDER');
--查看被锁的表
select p.spid,
a.serial#,
c.object_name,
b.session_id,
b.oracle_username,
b.os_user_name
from v$process p, v$session a, v$locked_object b, all_objects c
where p.addr = a.paddr
and a.process = b.process
and c.object_id = b.object_id
--查看连接的进程
SELECT * FROM v$session;
SELECT sid, serial#, username, osuser,machine FROM v$session;
--杀掉进程
alter system kill session 'sid,serial#';
alter system kill session 8,1249;
--生成杀掉进程sql
SELECT 'alter system kill session '||''''||sid||','||serial#||''''||';' FROM v$session where username='DEVUSER';
--查看当前用户下表的占用空间
Select Segment_Name, Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
--查询所有对象占用空间
select owner, segment_name,sum(bytes/1024/1024) from dba_segments
group by owner,segment_name
--查询数据库中各对象占用空间大小
Select Segment_Name,b.object_type, Sum(bytes)/1024/1024 From User_Extents a,user_objects b
where a.segment_name=b.object_name Group By Segment_Name,b.object_type order by object_type, Segment_Name
--oracle中去除字段中的回车符
update ywj_yxglobj set table_name = replace(table_name,chr(10),'')
where table_name like 'ACCT_INFO%'