Oracle查询可以有多种方法,下面为您介绍的是如何Oracle查询被锁的表及Oracle查询连接的进程的方法,希望对您能够有所帮助。
一、查看被锁的表
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 sid, serial#, username, osuser FROM v$session;
三、杀掉进程
alter system kill session ‘sid,serial#’;
四、查看当前用户下表的占用空间
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%’