加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

查看oracle的sql语句历史记录和锁表的情况

(2012-01-04 20:59:59)
标签:

杂谈

分类: database

查询sql的历史记录

select * from v$sqlarea t where t.PARSING_SCHEMA_NAME in ('用户名') order by t.LAST_ACTIVE_TIME desc
select * from v$sqlarea t order by t.LAST_ACTIVE_TIME desc

查看一段时间内的执行情况

select * from v$sqlarea t where ( to_char(t.LAST_ACTIVE_TIME,'yyyy-mm-dd hh24:mi:ss') > '2011-12-28 14:11:39' ) and (to_char(t.LAST_ACTIVE_TIME,'yyyy-mm-dd hh24:mi:ss') < '2011-12-28 14:11:43') order by t.LAST_ACTIVE_TIME desc

查询当前时间

select sysdate from dual

查询锁表的情况

select * from v$locked_object;
select b.owner,b.object_name,a.session_id,a.locked_mode   from v$locked_object a,dba_objects b   where b.object_id = a.object_id;
select b.username,b.sid,b.serial#,logon_time   from v$locked_object a,v$session b   where a.session_id = b.sid order by b.logon_time;

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有