博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle 数据库重放(Database Replay)---样例
阅读量:7086 次
发布时间:2019-06-28

本文共 4700 字,大约阅读时间需要 15 分钟。

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方式备份性能数据

转载地址:http://efwql.baihongyu.com/

你可能感兴趣的文章
Retrofit进行post提交json数据
查看>>
<base>标签
查看>>
.NET C#读取Excel内容
查看>>
团队-象棋游戏-模块测试过程
查看>>
android之WakeLock机制浅析
查看>>
Springboot连接MySQL8.0出现的问题
查看>>
(转) weblogic 域,管理服务器,受管服务器,集群和机器的基本知识
查看>>
Python之面向对象特性
查看>>
iphone-common-codes-ccteam源代码 CCUIScreen.h
查看>>
CSS 文本和表格中文字溢出显示省略号
查看>>
欧几里得游戏(博弈论启蒙)
查看>>
String 字符串相等比较
查看>>
jsp中九大内置对象
查看>>
Java 文件复制
查看>>
C# winform在关闭窗体的时候及时释放内存问题
查看>>
hdu Rescue
查看>>
【原创】驱动卸载之ControlService函数
查看>>
关于java建立的的包import的问题
查看>>
WPF 平移ListBox翻页
查看>>
spoj 839-Optimal Marks
查看>>