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

目录
相关文章
|
2月前
|
Oracle 关系型数据库 Linux
【赵渝强老师】Oracle数据库配置助手:DBCA
Oracle数据库配置助手(DBCA)是用于创建和配置Oracle数据库的工具,支持图形界面和静默执行模式。本文介绍了使用DBCA在Linux环境下创建数据库的完整步骤,包括选择数据库操作类型、配置存储与网络选项、设置管理密码等,并提供了界面截图与视频讲解,帮助用户快速掌握数据库创建流程。
293 93
|
24天前
|
Oracle 关系型数据库 Linux
【赵渝强老师】使用NetManager创建Oracle数据库的监听器
Oracle NetManager是数据库网络配置工具,用于创建监听器、配置服务命名与网络连接,支持多数据库共享监听,确保客户端与服务器通信顺畅。
124 0
|
4月前
|
存储 Oracle 关系型数据库
服务器数据恢复—光纤存储上oracle数据库数据恢复案例
一台光纤服务器存储上有16块FC硬盘,上层部署了Oracle数据库。服务器存储前面板2个硬盘指示灯显示异常,存储映射到linux操作系统上的卷挂载不上,业务中断。 通过storage manager查看存储状态,发现逻辑卷状态失败。再查看物理磁盘状态,发现其中一块盘报告“警告”,硬盘指示灯显示异常的2块盘报告“失败”。 将当前存储的完整日志状态备份下来,解析备份出来的存储日志并获得了关于逻辑卷结构的部分信息。
|
2月前
|
SQL Oracle 关系型数据库
Oracle数据库创建表空间和索引的SQL语法示例
以上SQL语法提供了一种标准方式去组织Oracle数据库内部结构,并且通过合理使用可以显著改善查询速度及整体性能。需要注意,在实际应用过程当中应该根据具体业务需求、系统资源状况以及预期目标去合理规划并调整参数设置以达到最佳效果。
230 8
|
4月前
|
SQL Oracle 关系型数据库
比较MySQL和Oracle数据库系统,特别是在进行分页查询的方法上的不同
两者的性能差异将取决于数据量大小、索引优化、查询设计以及具体版本的数据库服务器。考虑硬件资源、数据库设计和具体需求对于实现优化的分页查询至关重要。开发者和数据库管理员需要根据自身使用的具体数据库系统版本和环境,选择最合适的分页机制,并进行必要的性能调优来满足应用需求。
200 11
|
4月前
|
Oracle 关系型数据库 数据库
数据库数据恢复—服务器异常断电导致Oracle数据库报错的数据恢复案例
Oracle数据库故障: 某公司一台服务器上部署Oracle数据库。服务器意外断电导致数据库报错,报错内容为“system01.dbf需要更多的恢复来保持一致性”。该Oracle数据库没有备份,仅有一些断断续续的归档日志。 Oracle数据库恢复流程: 1、检测数据库故障情况; 2、尝试挂起并修复数据库; 3、解析数据库文件; 4、导出并验证恢复的数据库文件。
|
4月前
|
存储 Oracle 关系型数据库
【赵渝强老师】Oracle RMAN的目录数据库
Oracle RMAN默认将备份元信息存储在控制文件中,但控制文件损坏或丢失会导致恢复失败,且备份增多会使控制文件无限增长。为解决这些问题,Oracle引入了RMAN目录数据库(Catalog Database),专门用于存储RMAN备份的元信息。使用目录数据库可提升备份管理效率,支持多数据库共享、长期备份历史记录存储,并可保存RMAN脚本。本文详细介绍了如何创建目录数据库、注册目标数据库及其操作步骤。
108 0
|
7月前
|
Oracle 安全 关系型数据库
【Oracle】使用Navicat Premium连接Oracle数据库两种方法
以上就是两种使用Navicat Premium连接Oracle数据库的方法介绍,希望对你有所帮助!
1454 28
|
5月前
|
存储 Oracle 关系型数据库
oracle数据恢复—oracle数据库执行错误truncate命令的数据恢复案例
oracle数据库误执行truncate命令导致数据丢失是一种常见情况。通常情况下,oracle数据库误操作删除数据只需要通过备份恢复数据即可。也会碰到一些特殊情况,例如数据库备份无法使用或者还原报错等。下面和大家分享一例oracle数据库误执行truncate命令导致数据丢失的数据库数据恢复过程。

热门文章

最新文章

推荐镜像

更多