场景5 Performance Management

性能调优(不能重启数据库)

索引

资源管理器

性能优化

统计分析

SQL性能分析

SPM (SQL执行计划管理)

堆表 :数据存储无序

位图索引 :适合字段重复值高的,数据仓库环境下(适合OLAP/DSS环境),存储占用空间少, DML成本高, WHERE中与或操作效率高

eg :

select count(*) from customers where m_status = married and region in (‘central’, ‘west’);

eg :

su -oracle

sqlplus / as sysdba

set linesize 120

set pagesize 20

line on

timing on

sqlprompt ‘[email protected]_connect_identifier’

start up

alter user scott identified by tiger unlock;

conn scott/tiger

create table t1 (id number, color varchar2, pty number);

begin for i in 1..50000 loop insert into t1 values(1, blue’, 1000); end loop; commt; end; /

select count(*) from t1;

update t1 set color=‘red’ where id < 20001;

update t1 set color=‘green’ where id > 40000;

commit;

select distinct color from t1;

!clear

create tablespace indx datafile ‘/u01/app/oracle/prod/indx01.dbf’ size 100m;

create indext1_color_ind on t1(color) tablespace indx;

analyze table t1 compute statistics; (表分析)

analyze index t1_color_ind compute statistics;

select a.table_name, a.index_name, a.index_type, a.leef_blocks, b.height from user_indexes a.index_stats b where a.index_mane=b.index_name and a.index_name=’T1_COLOR_IND’;

col table_name for a10

col index_name for a10

@?sqlplus/

conn scott/tiger

set autrace trace

select count(*) from t1 where color=‘blue’;

set auto trace off

select * from t1 where id<10;

drop index t1_color_indx;

create bitmap index t1_color_indx on t1(color) tablespace indx;

analyze index t1_color_indx compute statistics;

analyze index t1_color_indx valudate structure;

select a.table_name, a.index_name, a.index_type, a.leef_blocks, b.height from user_indexes a.index_stats b where a.index_mane=b.index_name and a.index_name=’T1_COLOR_IND’;

set autostrade trace

select count(*) from t1 where color=‘red’;

set auto trace off

select * from  t1 where id < 10;

update t1 set color = ‘blue’ where id = 1;

update t1 set color = ‘green’ where id = 2;(打开另一个会话)

rollback;

rollback;

set autotrace trace

select count(*) from t1 where color=‘red’ or color = ‘blue’;

su - oracle

|sql

e.g. : select rowid, ename, sal from emp;

rowid : 6 :object_id, 3 :file#, 6 :block, 3 : row#

复合压缩索引 :

全局hash索引 :

反向索引 :解决热块问题,不适合范围查询

平衡树索引(普通索引):适合字段基数大,重复值少,DML代价比较低,适合OLTP环境

经常用于select语句中,where语句中,排序的字段适合建立索引

表级共享锁 share lock

行级排他锁 exclusive lock

段级位图锁

eg :

show parameter cpu

show parameter resoure

eg 资源管理器的创建 :

官方文档 :administrator

SQL 语句执行的三个过程 :

parse解析 : 建立执行计划

execute执行 :

fetch取值从buffer cache里获取数据 :

硬解析 :三步

软解析 :

1. 在lib cache读取执行计划

2. execute plan

3. 从buffer cache读取数据块

LRU : 最近最少使用

eg :

alter system set result_cache_max_size=0;

show parameter result

alter system set result_cache_max_size=1536;(从0改为非0后,必须重启才能生效)

eg :

conn scott/tiger

select /*+ result_cache */ count(*) from emp;

set autotrace trace

r

r

1

show parameter result

alter system set result_cache_mode = force;

select /*+ result_cache */ count(*) from emp;

r

exec dbms_result_cache.flush;

r

r

select dbms_result_cache.status from dual;

shutdown immediate;

startup

select dbms_result_cache.status from dual;

show parameter result

alter system set result_cache_mode=manual;

conn scott/tiger

set autotrace trace

select count(*) from emp where empno=20;

select /*+ result_cache */ count(*) from emp where deptno=20;

exec dbms_result_cache.memory_report;

set serverout on

exec dbms_result_cache.memory_report;

eg :

select * from emp where deptno=:n;

结果缓存(官方文档 Performance Tuning Guide 7.6 Managing the server and client query cache)

统计分析 (官方文档 PL/SQL Package and Type Reference 或

SPA (SQL Performance Analyzer)

SQL性能优化分析

SPM(SQL Plan Management)

SQL执行计划管理

store outline 存储纲要

sql profile

hints 提示

稳定执行计划,根据访问对象的变化,实时调整新的计划

spm : sql执行计划管理

sql plan baseline : 执行计划基线(执行计划的集合)

eg :

show parameter optimizer

eg :

select * from tab;

create table emp1 select * from emp;

select * from emp1;

set autotrace on

select * from emp1 where empno=7788;

r

select sql_text, sql_id from v$sql where sql_text like ‘select * from emp%’; (查询sql id)

set serveroutput on

declare

`1_plans_loaded pls_integer;

begin

1_p;ans_loaded := DBMS_SPM.load_plans_from_cursor_cache(sql_id =>…);

DBMS_OUTPUT.put_line(‘Plans Loaded : || 1_plan_loaded);

end;

/

select sql_handle, plan_name, enabled, accepted from dba_sql_plan_baselines where sql_text like ‘%emp1%’ and sql_id not like ‘%dba%’ ;

create index

set autotrace on

select * from emp1 where empno = 7788;

时间: 2024-11-10 01:20:06

场景5 Performance Management的相关文章

Application Performance Management

Network Performence Management: Application Performence Management: APM Workflow: Monitoring and Alerting Broad visibility Dashboards and dynamic thresholds End-user experience reporting All users, all transactions Triage Localize problem to users/tr

puma vs passenger vs rainbows! vs unicorn vs thin 适用场景 及 performance

ruby的几个web server,按照开发活跃度.并发方案及要点.适用场景等分析puma vs passenger vs rainbows! vs unicorn vs thin. 1. thin: 长久未更新, 2. unicorn: 未测试. 3. opensource passenger or enterprise passenger:  open source版只支持多进程*1线程,enterprise版收费,但支持多进程*多线程.性能不如其宣传的好,甚至比unicorn 和 puma

独立安装Oracle Hyperion Enterprise Performance Management 验证过程

在安装EPM的过程中,都是安装既定的操作手册进行,只是一个过程的重复,对自己安装不会留下深刻的印象.根据自己学习体会,制定安装步骤,去验证自己学习过程中的体会,加深学习印象,解决安装中遇到的问题,模仿-学习-验证-学习-总结的知行合一. 一.只安装以下组件 安装 Foundation Services Java Web 应用程序时,会安装 Shared Services 和 EPM Workspace Java Web 应用程序. --来源"帮助(H)" workspace界面 web

应用性能管理(APM, Application Performance Management)

当下成熟的互联网公司都建立有从基础设施到应用程序的全方位监控系统,力求及时发现故障进行处理并为优化程序提供性能数据支持,降低整体运维成本.国内外商业的APM有Compuware.iMaster.博睿Bonree.听云.New Relic.云智慧.OneAPM.AppDyn.Amics等. 本文主要针对Java技术体系介绍APM的关键实现技术以及业界主流APM工具的功能特点. 一.APM核心功能 APM被形象的称为应用程序的私人医生,越来越收到青睐,比起通过日志方式记录关键数据显然要更加实用,AP

场景3 Data Management

数据管理 性能优化 OLTP OLAP 物化视图 :表的快照 传输表空间 :异构平台的数据迁移 星型转换 :事实表 OLTP : 在线事务处理 1. transaction —> DML 2. 数据量小 3. 处理时间短 —> SQL 共享,绑定变量 4. 并发量大 OLAP,DSS 1. 以查询为主(海量)—> 数据汇总 —> 结果放到表(物化视图)里 2. 处理时间长 3. 几乎无并发 4. 做并行处理 SGA + PGA memory_target : 自动按需分配SGA和P

Java Performance Optimization Tools and Techniques for Turbocharged Apps--reference

Java Performance Optimization by: Pierre-Hugues Charbonneau reference:http://refcardz.dzone.com/refcardz/java-performance-optimization Java is among the most widely used programming languages in the software development world today. Java applications

System and method for dynamically adjusting to CPU performance changes

FIELD OF THE INVENTION The present invention is related to computing systems, and more particularly to a system and method for adjusting to changes in processor performance. BACKGROUND INFORMATION Designers of mobile computing platforms are faced wit

Application Architecture Determines Application Performance

? Application Architecture Determines Application Performance Randy Stafford AppliCATion ARCHiTECTuRE dETERMinES application performance. That might seem rather obvious, but real-world experience shows that it's not. For example, software architects

Does Little&#39;law really applicable to apply performance model now?

上次提到Little定律, 我也解释过它跟另外一个公式有一些内在的关系,但是其实我自己对LL在当前复杂架构系统中到底是怎么应用的也没有完整的想法,于是我在Linkedin上把这个问题抛了出来,没有想到的是得到了很多大师级前辈回复,有些甚至非常详细: 我的问题: Does Little'law really applicable to apply performance model now? Yong Fu I'm confusing that the meaning of parameters