如何对比迁移前后的Oracle数据库性能
以下皆为测试库内容
环境描述 SID DBID OS 描述finally 4033498616 windows 7 x64 假设为迁移后的数据库
zhadanren 97461353 Solaris Sparc 6 x64 假设为迁移前的数据库
过程
详细过程如下
导出snapshot数据注意:
这里导出的snapshot最好包含业务最忙时的时间段,以便于更准确的衡量迁移前后的数据库性能。
相关sql:
create directory dpdir as '&dir_path' ; @?/rdbms/admin/awrextr.sql步骤:
1、创建directory SQL> create directory dpdir as '/u01/dpdir' ; Directory created. 2、执行相应的sql SQL> @?/rdbms/admin/awrextr.sql以下需要输入几个参数具体包括:
输入要导出snapshot的dbid,这里使用默认回车即可
Enter value for dbid:
snapshot的列表日期范围,默认只保留8天,可以全部列出,再具体找要导出的snapshot number。
Enter value for num_days:100
要导出的开始snapshot number
Enter value for begin_snap:271
要导出的截止snapshot number
Enter value for end_snap: 280
到导出文件的directory(其实awrextr.sql也是基于datapump的)
Enter value for directory_name: DPDIR
导出文件的名称
Enter value for file_name: zhadanren1026
然后就开始了导出过程。最后会在定义的directory下生成dump文件以及log日志。可以查看log日志,看是否正常导出。
Using the dump file prefix: zhadanren1026 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The AWR extract dump file will be located | in the following directory/file: | /u01/dpdir | zhadanren1026.dmp | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | *** AWR Extract Started ... | | This operation will take a few moments. The | progress of the AWR extract operation can be | monitored in the following directory/file: | /u01/dpdir | zhadanren1026.log | End of AWR Extract 导入snapshot数据相关SQL:
create directory dpdir as '&dir_path' ; @?/rdbms/admin/awrload.sql步骤:
1、创建directory(源库也是使用datapump的方式导入的) sys@FINALLY>create directory dpdir as 'd:appsdpdir' ; 目录已创建。 2、然后将导出的dump文件上传到迁移后的数据库服务器相应的新创建的directory下。 3、执行相应的sql sys@FINALLY>@?/rdbms/admin/awrload.sql以下需要输入几个参数具体包括:
输入 directory_name 的值: DPDIR
这里注意不要包含文件后缀名。
输入 file_name 的值: zhadanren1026
这是临时使用schema,导入过程完成以后会自动删除。
输入 schema_name 的值: AWR_STAGE
临时schema 的 默认表空间
输入 default_tablespace 的值: SYSAUX
临时schema的默认临时表空间
输入 temporary_tablespace 的值: TEMP
然后就开始了导入过程。最后会在定义的directory下生成导入log日志。可以查看log日志,看是否正常导入。
... Creating AWR_STAGE user | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Loading the AWR data from the following | directory/file: | d:appsdpdir | zhadanren1026.dmp | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | *** AWR Load Started ... | | This operation will take a few moments. The | progress of the AWR load operation can be | monitored in the following directory/file: | d:appsdpdir | zhadanren1026.log | ... Dropping AWR_STAGE user End of AWR Load 生成AWR Compare report经过上面的步骤,源库的snapshot信息已经导入到迁移后的数据库finally中了,下面我们可以使用AWR Compare report来衡量迁移前后的数据库性能。
相关sql:
查看snapshotSQL select t.dbid, t.snap_id, to_char(begin_interval_time, 'yyyymmddhh44miss') begin_time, to_char(end_interval_time, 'yyyymmddhh44miss') end_time from DBA_HIST_SNAPSHOT t order by 1, 4 desc; 生成报告SQL spool awr_compare_report.html set echo off; set veri off; set feedback off; set head off set verify off set lines 8000 select * from TABLE(DBMS_WORKLOAD_REPOSITORY.awr_diff_report_html(4033498616,1,315,316, 97461353,1,80,81)); spool off步骤
1、 先找到迁移前数据库snapshot业务忙的时段相应的 snapshot id。
比如我们选择2016.10.26 7点到8点这个时间段。那么相应的snap_id起始为279截止为280。
select t.dbid, t.snap_id, to_char(begin_interval_time, 'yyyymmddhh44miss') begin_time, to_char(end_interval_time, 'yyyymmddhh44miss') end_time from DBA_HIST_SNAPSHOT t where dbid=97461353 order by 1, 4 desc;
2、 找到迁移后数据库snapshot业务忙的时段相应的 snapshot id。
需要有对比性,所以一般选择相同时段来作为比较。不一定要同一日期,但是至少要选择有代表性的时间段。迁移后的数据库7点到8点时间段的snap_id 起始为412,截止为413。
select t.dbid, t.snap_id, to_char(begin_interval_time, 'yyyymmddhh44miss') begin_time, to_char(end_interval_time, 'yyyymmddhh44miss') end_time from DBA_HIST_SNAPSHOT t where dbid=4033498616 order by 1, 4 desc;
根据上面的信息我们就可以使用DBMS_WORKLOAD_REZ喎"http://www.it165.net/pro/pkqt/" target="_blank">QT1NJVE9SWS5hd3JfZGlmZl9yZXBvcnRfaHRtbMC0yfqzyWNvbXBhcmUgcmVwb3J0wcuhozwvcD4KPHByZSBjbGFzcz0="brush:java;"> spool awr_compare_report.html set echo off; set veri off; set feedback off; set head off set verify off set lines 8000 select * from TABLE(DBMS_WORKLOAD_REPOSITORY.awr_diff_report_html( 97461353,1,279,280, 4033498616,1,412,413)); spool off
示例内容如下:
物理配置对比

负载对比这个比较重穴ky"http://www.it165.net/qq/" target="_blank">qqjrNKyyse64sG/x6jSxsewuvPQ1MTctcTW2NKq1rix6qOotavKx9KqvffJ99Gh1PG6w8qxvOS146OssaPWpMqxvOS2zsTax6jSxsewuvPK/b7dv+Kz0NTYtcTStc7xwb/Su9bCo6k8L3A+CjxwPjxpbWcgYWx0PQ=="这里写图片描述" src="https://www.ym97.com/wenku/uploads/allimg/201226/1526253a8_0.jpg" title="" />
report里面内容很多,还包括了初始化参数的对比等,大家自行生成以后可以多看看。具体指标内容这里不再详述。
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/sql/oracle/9338.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
是因为scan的IP问题补占用
时间:2021-01-20
-
还你一个干净的model 2、功
时间:2021-01-20
-
既然 ROWNUM 列并不是真实存
时间:2021-01-20
-
Real Application Clusters
时间:2021-01-20
-
在tools-preferences-connection(
时间:2021-01-20
-
Windows Sever 2012下Oracle 12c安
时间:2021-01-10
-
Oracle安装监听器错误的解
时间:2021-01-07
-
oracle远程连接服务器数据
时间:2021-01-07
热门文章
-
Oracle存储过程编程详解
时间:2020-12-07
-
Azure Queue Storage 基本用法 Azure Storage 之
时间:2020-12-26
-
win10下oracle 11g安装图文教程
时间:2020-12-25
-
oracle 数据库学习 基本结构介绍
时间:2020-12-13
-
Azure File Storage 基本用法 Azure Storage 之 F
时间:2020-12-26
-
windows使用sqlpus连接oracle 数据库的教程图
时间:2020-12-25
-
Window下Oracle Database 11g 发行版2安装教程
时间:2020-12-29
-
Oracle解锁的方式介绍
时间:2020-12-14
-
Oracle 12c Study之Installer Oracle
时间:2021-01-06
-
linux下oracle设置开机自启动实现方法
时间:2020-12-13
