您的位置:首页 > 其它

10GR2迁移升级到11GR2压力性能测试一

2013-10-24 10:32 239 查看
10GR2迁移升级到11GR2压力性能测试一
(database replay)
最近对一个10GR2的环境进行了迁移升级至ORACLE 11GR2,在业务真正进行切换之前,对升级的环境进行了
大量的性能分析和压力测试工作,ORACLE 11G中提供的real application testing确实很方便实用。
暂且将部分测试步骤记录在此,后续整理成一个完整的文档
生产环境 10GR2 2 node RAC升级环境 11GR2 单实例生产环境与升级环境之间的数据已经通过goldengate 同步一. capture生产环境workloadConnected to Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 Connected as modba 1.建立filterSQL> SET TIME ON12:18:39 SQL> SET TIMING ON12:18:43 SQL> EXEC DBMS_WORKLOAD_CAPTURE.ADD_FILTER(fname => 'USER_PAYVIEW',                                                    fattribute => 'USER',                                                    fvalue => 'PAYVIEW'); PL/SQL procedure successfully completedExecuted in 0.015 seconds   确认filter已经建立SELECT * FROM DBA_WORKLOAD_FILTERSTYPE    ID    STATUS    NAME            ATTRIBUTE    VALUECAPTURE    6    IN USE    USER_PAYVIEW    USER       PAYVIEW  删除fileter方法--EXEC DBMS_WORKLOAD_CAPTURE.DELETE_FILTER(fname => 'USER_PAYVIEW');  2.建立存放capture生成文件的directorycreate directory replay_dir as '/orafra/replay_dir';3.开始捕获
本测试是要捕获payview用户产生的workload
12:18:48 SQL> EXEC DBMS_WORKLOAD_CAPTURE.START_CAPTURE(name => 'capture_38',
                                                       dir => 'REPLAY_DIR',
                                                       duration => NULL,
                                                       default_action => 'EXCLUDE');
                                                       
一定要注意default_action的设置,结合FILTER 灵活抓取符合条件的workload
 
          当default_action => 'EXCLUDE' 时候,是capture filter 的workload.
          当default_action => 'INCLUDE' 时候,是除capture filter 内容以外的workload.                                                       
 
begin DBMS_WORKLOAD_CAPTURE.START_CAPTURE(name => 'capture_38',
                                          dir => 'REPLAY_DIR',
                                          duration => NULL,
                                          default_action => 'EXCLUDE'); end;
 
ORA-15591: cannot start capture because parameter "PRE_11G_ENABLE_CAPTURE" is not enabled
ORA-06512: at "SYS.DBMS_WORKLOAD_CAPTURE", line 799
ORA-06512: at line 2

在ORACLE 10G 版本运行capture 时需要设置PRE_11G_ENABLE_CAPTURE=true,ORACLE提供了脚本置于
ORACLE_HOME/rdbms/admin下
wrrenbl.sql 开启
wrrdsbl.sql 关闭
运行完记得设置回false,不然会导致数据重启时候失败。

cd $ORACLE_HOME/rdbms/admin
SQL> @wrrenbl.sql
SQL> SET FEEDBACK 1
SQL> SET NUMWIDTH 10
SQL> SET LINESIZE 80
SQL> SET TRIMSPOOL ON
SQL> SET TAB OFF
SQL> SET PAGESIZE 100
SQL> alter system set PRE_11G_ENABLE_CAPTURE=true sid='*';

System altered.

详细请参考:How to Use Database Replay Feature to Help With The Upgrade From 10.2.0.4 to 11g [ID 748895.1]

当start capture时,如果指定的directory已经有之前产生的文件,会报如下错误,确认之前的capture 产生的wcr 文件
无用后,可以按照直接rm 后再运行新的capture
12:19:40 SQL> EXEC DBMS_WORKLOAD_CAPTURE.START_CAPTURE(name => 'capture_38',
                                                       dir => 'REPLAY_DIR',
                                                       duration => 600,
                                                       default_action => 'EXCLUDE');
 
begin DBMS_WORKLOAD_CAPTURE.START_CAPTURE(name => 'capture_38',dir => 'REPLAY_DIR',duration => 600,default_action => 'EXCLUDE'); end;
 
ORA-15505: cannot start workload capture because instance 1 encountered errors while accessing directory "/orafra/replay_dir"
ORA-06512: at "SYS.DBMS_WORKLOAD_CAPTURE", line 799
ORA-06512: at line 2

select id,name,dbid,parallel,status,start_time,end_time from dba_workload_captures;

EXEC DBMS_WORKLOAD_CAPTURE.DELETE_CAPTURE_INFO(capture_id => 3);

change to os directory "/orafra/replay_dir"
rm wcr*

12:21:56 SQL> EXEC DBMS_WORKLOAD_CAPTURE.START_CAPTURE(name => 'capture_38',
                                                       dir => 'REPLAY_DIR',
                                                       duration => 600,  --10分钟
                                                       default_action => 'EXCLUDE');
 
PL/SQL procedure successfully completed
 
Executed in 4.047 seconds

4.查看捕获进程状态

select id,name,dbid,parallel,status,start_time,end_time from dba_workload_captures

ID    NAME         DBID        PARALLEL    STATUS    START_TIME            END_TIME
6    capture_38    2303324627    YES    IN PROGRESS    2013-10-7 12:23:09    2013-10-7 12:33:09

select id,name,dbid,parallel,status,start_time,end_time from dba_workload_captures

ID    NAME    DBID    PARALLEL    STATUS    START_TIME    END_TIME
6    capture_38    2303324627    YES    COMPLETED    2013-10-7 12:23:09    2013-10-7 12:33:09

 查看产生的文件,在捕获完成后,会产生大量wrc开头的文件在指定的directory下面,同时也会将期间的awr报告导出,
以便在负载重放后,将其导入测试环境与只进行对比。
cd /orafra/replay_dir
ls wrc*

5.确认捕获的负载符合期望

本测试是只要捕获用户 payview 产生的负载
oracle@mqrac1[/orafra/replay_dir]|tail wcr_cr.text
          -------------------------------------------------------------       

Workload Filters                            DB/Inst: MQUE/  Snaps: 18059-18060

  # Filter Name              Type    Attribute    Value                     
--- ------------------------ ------- ------------ --------------------------
  1 USER_PAYVIEW             INCLUDE USER         PAYVIEW                   
          -------------------------------------------------------------       

End of Report

二. replay workload

1.在11G机器创建directory
  SQL> create directory replay_dir as '/expdmp/replay_dir';
Directory created
Executed in 0.015 seconds

2.将capture产生的文件传输到测试 11G环境机器

将capture 在目录/orafra/replay_dir产生所有的内容传输到11G 机器/expdmp/replay_dir
ftp sftp scp 都可以

3.准备重放,预处理

  SQL> exec dbms_workload_replay.PROCESS_CAPTURE(capture_dir => 'REPLAY_DIR');
PL/SQL procedure successfully completed

4.初始化

  SQL> begin
           2  dbms_workload_replay.INITIALIZE_REPLAY(
           3  replay_name => 'replay_38',
           4  replay_dir => 'REPLAY_DIR');
           5  end;
           6  /

PL/SQL procedure successfully completed

5.重新映射连接
因本测试不在同一台机器,需重新映射连接到测试环境

  SQL> EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION( 1, '(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.55.5)(PORT = 1521) ) )
(CONNECT_DATA = (SERVICE_NAME = mque1)(SERVER = DEDICATED)) )  ');

PL/SQL procedure successfully completed

Executed in 0 seconds

6.设置播放模式
  SQL> exec dbms_workload_replay.PREPARE_REPLAY(synchronization => TRUE);

PL/SQL procedure successfully completed

Executed in 0.922 seconds

synchronization=>指定了commit order是否要求与capture workload中一致

think_time_scale=> 指2个SQL CALL之间间隔的时间比例

SCALE_UP_MULTIPLIER=> 可以调节压力倍数 1:1\1:2...来进行压力测试

7.准备客户端

localhost/expdmp/replay_dir>wrc replaydir=/expdmp/replay_dir mode=calibrate

Workload
bb8e
Replay Client: Release 11.2.0.3.0 - Production on Tue Oct 8 12:37:00 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Report for Workload in: /expdmp/replay_dir
-----------------------

Recommendation:
Consider using at least 105 clients divided among 27 CPU(s)
You will need at least 187 MB of memory per client process.
If your machine(s) cannot match that number, consider using more clients.

Workload Characteristics:
- max concurrency: 5230 sessions
- total number of sessions: 5241

Assumptions:
- 1 client process per 50 concurrent sessions
- 4 client process per CPU
- 256 KB of memory cache per concurrent session
- think time scale = 100
- connect time scale = 100
- synchronization = TRUE

localhost/expdmp/replay_dir>wrc replaydir=/expdmp/replay_dir               

Workload Replay Client: Release 11.2.0.3.0 - Production on Tue Oct 8 12:37:12 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username:system
Password:
Wait for the replay to start (12:37:16)

8.开始播放
  SQL>  exec dbms_workload_replay.start_replay;       
 
PL/SQL procedure successfully completed
 
Executed in 3.797 seconds

Replay started (12:37:44)

Replay finished (12:59:52)

查看进程状态
select * from dba_workload_replays r

9.查看报告
SELECT DBMS_WORKLOAD_replay.REPORT(4,'TEXT') FROM DUAL

类似如下:
DB Replay Report for replay_38
---------------------------------------------------------------------------------------------------

----------------------------------------------------------------------
| DB Name | DB Id   | Release    | RAC | Replay Name | Replay Status |
----------------------------------------------------------------------
| MQUE1   | 8816670 | 11.2.0.3.0 | NO  | replay_38   | COMPLETED     |
----------------------------------------------------------------------

Replay Information
-----------------------------------------------------------------
|   Information    | Replay              | Capture              |
-----------------------------------------------------------------
| Name             | replay_38           | capture_38           |
-----------------------------------------------------------------
| Status           | COMPLETED           | COMPLETED            |
-----------------------------------------------------------------
| Database Name    | MQUE1               | MQUE                 |
-----------------------------------------------------------------
| Database Version | 11.2.0.3.0          | 10.2.0.5.0           |
-----------------------------------------------------------------
| Start Time       | 07-10-13 23:37:44   | 07-10-13 12:23:09    |
-----------------------------------------------------------------
| End Time         | 07-10-13 23:58:45   | 07-10-13 12:33:09    |
-----------------------------------------------------------------
| Duration         | 21 minutes 1 second | 10 minutes 0 seconds |
-----------------------------------------------------------------
| Directory Object | REPLAY_DIR          | REPLAY_DIR           |
-----------------------------------------------------------------
| Directory Path   | /expdmp/replay_dir  | /expdmp/replay_dir   |
-----------------------------------------------------------------

Replay Options
---------------------------------------------------------
|       Option Name       | Value                       |
---------------------------------------------------------
| Synchronization         | SCN                         |
---------------------------------------------------------
| Connect Time            | 100%                        |
---------------------------------------------------------
| Think Time              | 100%                        |
---------------------------------------------------------
| Think Time Auto Correct | TRUE                        |
---------------------------------------------------------
| Number of WRC Clients   | 1 (1 Completed, 0 Running ) |
---------------------------------------------------------

Replay Statistics
--------------------------------------------------------------------
|        Statistic        | Replay              | Capture          |
--------------------------------------------------------------------
| DB Time                 |    2703.347 seconds | 3015.222 seconds |
--------------------------------------------------------------------
| Average Active Sessions |                2.14 |             5.03 |
--------------------------------------------------------------------
| User calls              |              134639 |           134639 |
--------------------------------------------------------------------
| Network Time            |    6654.301 seconds |              N/A |
--------------------------------------------------------------------
| Think Time              | 1566435.085 seconds |              N/A |
--------------------------------------------------------------------
                 

 

                                                                                                                                               
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息