场景3 Data Management
场景3 Data Management
数据管理
性能优化
OLTP OLAP
物化视图 :表的快照
传输表空间 :异构平台的数据迁移
星型转换 :事实表
OLTP : 在线事务处理
1. transaction —> DML
2. 数据量小
3. 处理时间短 —> SQL 共享,绑定变量
4. 并发量大
OLAP,DSS
1. 以查询为主(海量)—> 数据汇总 —> 结果放到表(物化视图)里
2. 处理时间长
3. 几乎无并发
4. 做并行处理
SGA + PGA
memory_target : 自动按需分配SGA和PGA
eg :
set autotrace on
set linesize 120
set time on
set timing on
set pagesize 20
set sqlprompt
db link :连接前置数据库和后台数据库
前置database(查询)
后台database(统计)
物化视图 —> 读写分离
eg :
grant create materialized view to scott
set auto trace off
create materialized view emp_mv1 as select sum(sal) sum_al, avg(sal) avg_sal, min(sal) min_al, dept no from emp group by deptno;
desc user_segments
col segment_name for a20
select segment_name, segment_type, tablespace_name, extents, bytes/1024 from user_segments where segment_name=‘EMP_MV1’;
eg :
set autotrace on
select …; (查看资源消耗)执行计划 execution plan
将复杂的查询结果存储到物化视图里
PCTFREE : 一般表预留10%的空间来做update等DML操作
eg:show parameter rewrite
drop materialized view emp_mv1
create materialized view emp_mv1 enable query rewrite as select sum(sal) sum_al, avg(sal) avg_sal, min(sal) min_al, dept no from emp group by deptno;
李全新 邮箱 :quanxin.li@enmotech.com
手工建库脚本从官方文档拷贝修改
eg : desc dbms_mview
set autotrace off;
select * from emp;
update emp set deptno=40 where empno = …;
commit;
select * from emp;
select * from emp_mv1;
exec dbms_mview.refresh(‘emp_mv1’);
select * from emp_mv1;
物化视图日志记录基表数据的变化以便进行快速刷新
eg :
select * from tab;
create index emp_mv1_ind on emp_mv1(deptno) tablespace indx;
analyze index emp_mv1_ind compute …;
PCT Refresh
表空间移动
数据迁移 :
1. expdp, impdp(exp, imp)(异构平台)
2. tablespace transport(异构平台)expdp metadata, copu datafile
3. dg (Data Guard) :容灾 数据克隆 (同构平台)
4. ogg (Oracle Golden Gate) : 收费软件
5. 存储镜像
表空间自包含的检测 :
execute dbms_tts.transport_set_check(‘users’);
eg :
create table emp1 as select * from emp;
create index emp1_empno on emp1(empno) tablespace indx;
alter table emp1 add constraint pk_emp1 primary key(empno);
alter table emp1 move tablespace indx;
execute dbms_tts.transport_set_check(‘users’);
会用expdp
外部表 external table
重建 OEM :
emca -config dbcontrol db -repos -recreate
解锁sh用户
事实表
维度表
select constraint_name, table_name from user_constraints;
desc user_indexes
select index_name, table_name from user_indexes;
星型查询 : 在事实表和维度表之间进行连接查询
bitmap index
show parameter star
set star_tranformation_enabled to true
eg :
emctl status dbconsole
emctl start dbconsole
merge join cartesian
对表 t2 做分析 :
analyze table t2 compute statistatics;
星型转换
并行查询
设置并行度(DOP degree of parallelism)
eg :
alter session force parallel query;
alter session set parallel_degree_policy=limited;(设置所有SQL执行并行)
eg :
show parameter parallel
parallel_min_servers : 指定最少启用几个并行进程
set autotrace on
r
eg :
alter session enable parallel dml;
set autotrace on
insert /*+ parallel(4) */ into emp1 select /*+ parallel(4) */ from emp;
eg :alter table sh.sales parallel 8; (设置表sales的并行度为8)
parallel_min_time_threshold : 指定执行时间,超过则自动开启并行查询,DOP
场景3 Data Management的更多相关文章
- 场景4 Data Warehouse Management 数据仓库
场景4 Data Warehouse Management 数据仓库 parallel 4 100% —> 必须获得指定的4个并行度,如果获得的进程个数小于设置的并行度个数,则操作失败 para ...
- 场景7 Data Guard
场景7 Data Guard 官方文档 :Oracle Data Guard Concepts and Administration 用于数据容灾,通过主备库同步(主库将redo日志传送到备库,一个 ...
- 场景5 Performance Management
场景5 Performance Management 性能调优(不能重启数据库) 索引 资源管理器 性能优化 统计分析 SQL性能分析 SPM (SQL执行计划管理) 堆表 :数据存储无序 位图索引 ...
- MySQL vs. MongoDB: Choosing a Data Management Solution
原文地址:http://www.javacodegeeks.com/2015/07/mysql-vs-mongodb.html 1. Introduction It would be fair to ...
- [Windows Azure] Data Management and Business Analytics
http://www.windowsazure.com/en-us/develop/net/fundamentals/cloud-storage/ Managing and analyzing dat ...
- Data Management Technology(1) -- Introduction
1.Database concepts (1)Data & Information Information Is any kind of event that affects the stat ...
- Data Management and Data Management Tools
Data Management ObjectivesBy the end o this module, you should understand the fundamentals of data m ...
- Building Applications with Force.com and VisualForce(Dev401)(十七):Data Management: Data management Tools
ev401-018:Data Management: Data management ToolsModule Objectives1.List objects exposed in the impor ...
- Building Applications with Force.com and VisualForce(Dev401)(十六):Data Management: Introduction to Upsert
Dev401-017:Data Management: Introduction to Upsert Module Objectives1.Define upsert.2.Define externa ...
随机推荐
- RecyclerView 制作瀑布流图片
这是瀑布流的效果图 RecyclerView(ListView的升级版) 加载图片用的是第三方图片加载框架 ------------------------------------- 在Xml中 &l ...
- ximalaya
- python连接mysql的驱动
对于py2.7的朋友,直接可以用MySQLdb去连接,但是MySQLdb不支持python3.x.这是需要注意的~ 那应该用什么python连接mysql的驱动呢,在stackoverflow上有人解 ...
- Spring MVC简介
Spring MVC简介 Spring MVC框架是有一个MVC框架,通过实现Model-View-Controller模式来很好地将数据.业务与展现进行分离.从这样一个角度来说,Spring MVC ...
- winform 记住密码功能
//登录 private void btn_Login_Click(object sender, EventArgs e) { //记住密码 ...
- RansomNote
Given an arbitrary ransom note string and another string containing letters from all th ...
- instanceof, isinstance,isAssignableFrom的区别
instanceof运算符 只被用于对象引用变量,检查左边的被测试对象 是不是 右边类或接口的 实例化.如果被测对象是null值,则测试结果总是false. 形象地:自身实例或子类实例 instanc ...
- sqlservr (708) 打开日志文件 C:\Windows\system32\LogFiles\Sum\Api.log 时出现错误 -1032 (0xfffffbf8)
在windows server 2012 standard上新安装好的SQL Server 2014,查看错误日志,发现此报错 sqlservr (708) 打开日志文件 C:\Windows\sys ...
- navigation controller
一.程序框架 1.程序结构
- centos 忘记密码
装了个 centos 6.8 安装的时候 要输入 新用户和密码 用 新的用户密码 进去后 各种没权限 重新修改 root 密码 一切OK 步骤 1.重新启动Centos,在启动过程中,长按“ ...