ORACLE常用查询

表被锁
+++++++++++++++++++++++++++++++++++++++++++++++++++
--锁表查询
SELECT object_name, machine, s.sid, s.serial#
  FROM gv$locked_object l, dba_objects o, gv$session s
 WHERE l.object_id  = o.object_id
   AND l.session_id = s.sid;


--过程被锁
select va.sid,va.OBJECT from v$access va where object like 'PKG_MONTHLY_INVOICE%'    


   
--杀进程
ALTER system kill session '463, 27072'; 


+++++++++++++++++++++++++++++++++++++++++++++++++++




查询JOB运行与否
+++++++++++++++++++++++++++++++++++++++++++++++++++
--查询正在运行的JOB
SELECT d.WHAT, t.* FROM DBA_JOBS_RUNNING t, dba_jobs d where t.JOB = d.JOb;
   
--杀进程
ALTER system kill session '463, 27072'; 
 
+++++++++++++++++++++++++++++++++++++++++++++++++++ 




查询执行计划
+++++++++++++++++++++++++++++++++++++++++++++++++++


通过
--查SQL的历史快照
select t.*
  from dba_hist_snapshot t, dba_hist_sqlstat b
 where t.snap_id = b.snap_id
   and t.dbid = b.dbid
   and b.sql_id = 'b6b450bubr8t3'






--查历史
select * from table(dbms_xplan.display_awr('sql_id'));
 
--查当前
select * from table(dbms_xplan.display_cursor('sql_id'));
+++++++++++++++++++++++++++++++++++++++++++++++++++ 




--临时表空间大小
select tablespace_name, sum(bytes) / 1024 / 1024 mb
  from dba_temp_files
 group by tablespace_name;
-- 高水位
select tablespace_name, sum(bytes_cached)/1024/1024 mb
from v$temp_extent_pool
group by tablespace_name;




-- 当前使用表空间
select ss.tablespace_name,
       sum((ss.used_blocks * ts.blocksize)) / 1024 / 1024 mb
  from gv$sort_segment ss, sys.ts$ ts
 where ss.tablespace_name = ts.name
 group by ss.tablespace_name;






====================================


--查询字段里面是否有中文


select *
  from TT_EBIL_CONFIRM_FEE_FOR_BRIM T
 where asciistr(T.BG_CODE) like '%\%'
   and instr(T.BG_CODE, '\') <= 0;




========================================
--查询SQL绑定变量的值


select instance_number,  sql_id,name, datatype_string, last_captured,value_string from 
dba_hist_sqlbind where sql_id='fahv8x6ngrb50'order by LAST_CAPTURED,POSITION;






select sql_id,name, datatype_string, last_captured,value_string from 
v$sql_bind_capture where sql_id='dxfcacn4t4ppw' order by LAST_CAPTURED,POSITION;





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值