Chinaunix首页 | 论坛 | 博客
  • 博客访问: 212323
  • 博文数量: 49
  • 博客积分: 1785
  • 博客等级: 上尉
  • 技术积分: 565
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-01 10:30
文章分类

全部博文(49)

文章存档

2013年(2)

2012年(7)

2011年(11)

2010年(6)

2009年(23)

我的朋友

分类: Oracle

2012-03-27 21:35:42

Record in here for avoid being forget
1. V$SQL_MONITOR
To find information about currently long-running queries

set lines 200 pages 200
  1. col sql_text for a50
  2. col username for a12
  3. col sid for 9999
  4. col key for 99999999999999

  5. select key, sid, username, sql_id, sql_plan_hash_value plan_hash, elapsed_time, cpu_time, buffer_gets, disk_reads, substr(sql_text,1,50) sql_text
  6. from v$sql_monitor
  7. where status = 'EXECUTING';

2.V$SQL_PLAN_MONITOR
To find the execution plan for a key value

  1. set lines 200 pages 200
  2. col operation for a32
  3. col plan_options for a20
  4. col plan_object_name for a24
  5. col id for 999

  6. select plan_line_id id, lpad (' ', plan_depth) || plan_operation operation , plan_options , plan_object_name , plan_cardinality card, plan_cost
  7. from v$sql_monitor q, v$sql_plan_monitor p
  8. where q.key = p.key
  9. and q.key = < key value >
  10. order by id;
To find the execution plans of currently long-running queries

  1. set lines 200 pages 200
  2. col operation for a32
  3. col plan_options for a20
  4. col plan_object_name for a24
  5. col id for 999
  6. break on sql_id on plan_hash

  7. select sql_id, sql_plan_hash_value plan_hash, plan_line_id id, lpad (' ', plan_depth) || plan_operation operation , plan_options , plan_object_name , plan_cardinality card, plan_cost
  8. from v$sql_plan_monitor
  9. where status = 'EXECUTING'
  10. order by key, id;

3.DBA_TABLESPACE_USAGE_METRICS
Display tablespace use percent

  1. SQL> SELECT * FROM DBA_TABLESPACE_USAGE_METRICS;

  2. TABLESPACE_NAME USED_SPACE TABLESPACE_SIZE USED_PERCENT
  3. ------------------------------ ---------- --------------- ------------
  4. SYSAUX 10360 252891 4.09662661
  5. SYSTEM 59064 265691 22.2303352
  6. TEMP 0 178746 0
  7. TEST 128 1280 10
  8. UNDOTBS1 432 201786 .214088192
  9. USERS 168 176731 .095059724


阅读(554) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~