oracle常用性能视图查询语句

--表空间使用率

SELECT a.tablespace_name "tablespace_name",
       round(total / (1024 * 1024 * 1024),4) "tablespace_space(G)",
       round((total - free) / (1024 * 1024 * 1024),4) "tablespace_used(G)",
       round(free / (1024 * 1024 * 1024),4) "tablespace_free(G)",
       round((total - free) / total, 4) * 100 "used%"
  FROM (SELECT tablespace_name, SUM(bytes) free
          FROM dba_free_space
         GROUP BY tablespace_name) a,
       (SELECT tablespace_name, SUM(bytes) total
          FROM dba_data_files
         GROUP BY tablespace_name) b
 WHERE a.tablespace_name = b.tablespace_name;

--锁表

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
and b.object_name='表名';

--删除调度作业

select job,what,failures,broken from user_jobsbegin
 dbms_job.remove(124);
  commit;
 end;

--收集统计信息

 select t1.window_name,t1.repeat_interval,t1.duration from dba_scheduler_windows t1,dba_scheduler_wingroup_members t2
  where t1.window_name=t2.window_name and t2.window_group_name in ('MAINTENANCE_WINDOW_GROUP','BSLN_MAINTAIN_STATS_SCHED');

--分区统计情况

select table_name,
       partition_name,
       last_analyzed,
       partition_position,      
       num_rows
  from user_tab_statistics t
 where table_name ='表名';


 

猜你喜欢

转载自blog.csdn.net/xianjuke008/article/details/85292765