开发者社区> jan1990> 正文

Oracle 数据库重放(Database Replay)---样例

简介: 1 生产环境 创建存放抓取文件的directory mkdir DBReplay sqlplus / as sysdba create directory cap10g as 'XXXXX/dbreplay'; 2 生产环境 开始抓取trace sqlplus / as sysdba<spool capture_trace.
+关注继续查看

1 生产环境 创建存放抓取文件的directory
mkdir DBReplay
sqlplus / as sysdba
create directory cap10g as 'XXXXX/dbreplay';
2 生产环境 开始抓取trace
sqlplus / as sysdba<spool capture_trace.log
alter system set PRE_11G_ENABLE_CAPTURE=true scope=memory;
EXEC DBMS_WORKLOAD_CAPTURE.START_CAPTURE(name =>'cap10g',dir =>'CAP10G',duration =>7200);
alter system set PRE_11G_ENABLE_CAPTURE=false scope=memory;
exit;
spool off
EOF
备注:DIR的值必须大写
--检查抓取进度
select * from dba_workload_captures;
3 生产环境 结束抓取trace
sqlplus / as sysdba
EXEC DBMS_WORKLOAD_CAPTURE.FINISH_CAPTURE();

1、如果生产已结束抓取,则不必执行。
2、如果生产在抓取过程中因为cpu飙升等原因需要立即结束,可以提前执行该步骤。
3、如果生产抓取结束后仍然在抓取,需要执行该步骤。
4    生产环境    生成抓取时间段生产环境的DB性能数据    
生成抓取时间段生产环境的DB性能数据

sqlplus / as sysdba
select id from dba_workload_captures;
select dbms_workload_capture.REPORT(3,'HTML') from dual;
需要在pl/SQL develop工具里执行
start_time:2018/9/6 14:18:55
end_time:2018/9/6 16:18:55
5 生产环境 生成抓取时间段生产环境的awr报告
sqlplus / as sysdba
select dbms_workload_repository.awr_report_html('2781309325',1,'111','113','')from dual;

第一个参数为dbid,第3个参数为begin_snapshot,第4个参数为end_snapshot

6 性能影响分析环境 创建存放抓取文件的directory
sqlplus / as sysdba
create directory rep as 'XXXXXXXXXXX/dbreplay';
7
10g生产库
性能影响分析环境
拷贝抓取文件到12c性能测试库重放目录下
8 性能影响分析环境 导入统计信息
9 性能影响分析环境 导入SPM
10 性能影响分析环境 打开闪回并记录当前SCN,作为以后闪回的SCN
1.数据库启动到mount状态,打开闪回
alter database flashback on; ----确认FRA空间足够
2.记录当前scn号:
select current_scn from v$database; -----当前值为16050982577944
3.安全起见,再创建一个闪回点:
create restore point point201811021423;
11 性能影响分析环境 重放前预处理 exec dbms_workload_replay.process_capture(capture_dir => 'REP');
12 性能影响分析环境 重放前检查客户端 wrc MODE=calibrate REPLAYDIR=XXXXXXX/dbreplay 这里提示开多少个客户端,等会第15步就起多少个
13 性能影响分析环境 重放前初始化 EXEC DBMS_WORKLOAD_REPLAY.initialize_replay(replay_name => 'UP_REP2', replay_dir => 'REP'); 这一步比较耗时
14 性能影响分析环境 设置重放参数 "EXEC DBMS_WORKLOAD_REPLAY.SET_REPLAY_TIMEOUT (FALSE);
EXEC DBMS_WORKLOAD_REPLAY.prepare_replay(synchronization => FALSE);----这个也比较耗时,并且还耗system表空间,记得提前扩容
15 性能影响分析环境 启动重放客户端
vi wrc.sh

wrc system/XXXXX replaydir=XXXXXXX/dbreplay

请后台执行,第12步提示要多少个客户端就后台开多少个,一定要后台跑
nohup sh wrc.sh > wrc_2.log 2>&1 &
nohup sh wrc.sh > wrc_3.log 2>&1 &
nohup sh wrc.sh > wrc_4.log 2>&1 &
nohup sh wrc.sh > wrc_5.log 2>&1 &
nohup sh wrc.sh > wrc_6.log 2>&1 &
nohup sh wrc.sh > wrc_7.log 2>&1 &
nohup sh wrc.sh > wrc_8.log 2>&1 &
nohup sh wrc.sh > wrc_9.log 2>&1 &
nohup sh wrc.sh > wrc_10.log 2>&1 &
nohup sh wrc.sh > wrc_11.log 2>&1 &
nohup sh wrc.sh > wrc_12.log 2>&1 &
nohup sh wrc.sh > wrc_13.log 2>&1 &
nohup sh wrc.sh > wrc_14.log 2>&1 &
nohup sh wrc.sh > wrc_15.log 2>&1 &
nohup sh wrc.sh > wrc_16.log 2>&1 &
nohup sh wrc.sh > wrc_17.log 2>&1 &
nohup sh wrc.sh > wrc_18.log 2>&1 &
nohup sh wrc.sh > wrc_19.log 2>&1 &
nohup sh wrc.sh > wrc_20.log 2>&1 &
nohup sh wrc.sh > wrc_21.log 2>&1 &
nohup sh wrc.sh > wrc_22.log 2>&1 &
nohup sh wrc.sh > wrc_23.log 2>&1 &
nohup sh wrc.sh > wrc_24.log 2>&1 &
nohup sh wrc.sh > wrc_25.log 2>&1 &
nohup sh wrc.sh > wrc_26.log 2>&1 &
nohup sh wrc.sh > wrc_27.log 2>&1 &
nohup sh wrc.sh > wrc_28.log 2>&1 &
nohup sh wrc.sh > wrc_29.log 2>&1 &
nohup sh wrc.sh > wrc_30.log 2>&1 &
nohup sh wrc.sh > wrc_31.log 2>&1 &
nohup sh wrc.sh > wrc_32.log 2>&1 &
nohup sh wrc.sh > wrc_33.log 2>&1 &
nohup sh wrc.sh > wrc_34.log 2>&1 &
nohup sh wrc.sh > wrc_35.log 2>&1 &
nohup sh wrc.sh > wrc_36.log 2>&1 &
nohup sh wrc.sh > wrc_37.log 2>&1 &
nohup sh wrc.sh > wrc_38.log 2>&1 &
nohup sh wrc.sh > wrc_39.log 2>&1 &
nohup sh wrc.sh > wrc_40.log 2>&1 &
nohup sh wrc.sh > wrc_41.log 2>&1 &
nohup sh wrc.sh > wrc_42.log 2>&1 &
nohup sh wrc.sh > wrc_43.log 2>&1 &
nohup sh wrc.sh > wrc_44.log 2>&1 &
nohup sh wrc.sh > wrc_45.log 2>&1 &
nohup sh wrc.sh > wrc_46.log 2>&1 &
nohup sh wrc.sh > wrc_47.log 2>&1 &
nohup sh wrc.sh > wrc_48.log 2>&1 &
nohup sh wrc.sh > wrc_59.log 2>&1 &
nohup sh wrc.sh > wrc_50.log 2>&1 &
nohup sh wrc.sh > wrc_51.log 2>&1 &
nohup sh wrc.sh > wrc_52.log 2>&1 &
nohup sh wrc.sh > wrc_53.log 2>&1 &
nohup sh wrc.sh > wrc_54.log 2>&1 &
nohup sh wrc.sh > wrc_55.log 2>&1 &
nohup sh wrc.sh > wrc_56.log 2>&1 &
nohup sh wrc.sh > wrc_57.log 2>&1 &
nohup sh wrc.sh > wrc_58.log 2>&1 &
nohup sh wrc.sh > wrc_59.log 2>&1 &
nohup sh wrc.sh > wrc_60.log 2>&1 &
nohup sh wrc.sh > wrc_61.log 2>&1 &

16 性能影响分析环境 启动重放(在另一个终端执行)
启动重放
EXEC DBMS_WORKLOAD_REPLAY.START_REPLAY();
检查回放进度
select * from dba_workload_replays

17 性能影响分析环境 生成重放结果文件
生成重放结果文件
select id from dba_workload_replays; 输出结果为3
select dbms_workload_replay.REPORT(3,'HTML') FROM DUAL;

18 性能影响分析环境 查询awr需要的snap id
查询awr需要的snap id
select dr.awr_dbid,dr.awr_begin_snap,dr.awr_end_snap,dr.awr_exported from dba_workload_replays dr;

19 性能影响分析环境 取awr报告 select dbms_workload_repository.awr_report_html('61647356',1,'170','172','')from dual;
20 性能影响分析环境 以exp方式备份性能数据

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
Oracle Database Predefined Roles
Table 4-3 Oracle Database Predefined Roles
111 0
Oracle Database 19c 中的自动索引 (DBMS_AUTO_INDEX)
Oracle 数据库 19c 引入了自动索引功能,它可以让您将一些有关索引管理的决策交给数据库。
81 0
Oracle 企业管理器DataBase Control使用说明
本文目录 1. 简介 2. 企业管理器登录方式 3. 企业管理器常用功能 3.1 查看数据库基本信息 3.2 查看用户和角色 3.3 查看数据库对象 4. 想法
413 0
oracle database 补丁下载方法
oracl database 补丁查询和下载.
747 0
oracle 升级12c参数样例
alter system set audit_trail=DB scope=spfile; alter system set shared_pool_size=2000M scope=spfile;alter system set shared_pool_reserved_size=160M sc...
891 0
Oracle 数据库重放(Database Replay)功能演示
https://www.cnblogs.com/jyzhao/p/5072800.html 我们可以捕获生产环境的工作量,在测试环境上重放,从而在不影响生产环境的前提下做一些改动测试。捕获:需要Oracle版本为10.2.0.4或更高.重放:需要Oracle版本为11g Release 1或更新. 本文环境:RHEL6.4 + Oracle 11.2.0.4下面介绍一下执行Database Replay的Workflow。
997 0
oracle database 18c rpm 安装
oracle rpm 安装,oracle rpm install.
2247 0
+关注
jan1990
文章
问答
视频
文章排行榜
最热
最新
相关电子书
更多
迁移 ORACLE 最佳实践
立即下载
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
相关镜像