Oracle 11g New Feature Database Replay
“Simulating production load is not possible” , you might have heard these word.
In one project, where last 2 year management want to migrate from UNIX system to Linux system ( RAC ) , but they still testing because they are not sure where this Linux Boxes where bale to handle load or not. They have put lot of efforts and time in load testing and functional testing etc, but still not le gain confidence.
After using these feature of 11g , they will gain confidence and will able to migrate to Linux with full confidence and will know how there system will behave after migration/upgrade.
Database Replay workload capture of external clients is performed at the database server level. Therefore, Database Replay can be used to assess the impact of any system changes below the database tier level such as below:
- Database upgrades, patches, parameter, schema changes, etc.
- Configuration changes such as conversion from a single instance to RAC etc.
- Storage, network, interconnect changes
- Operating system, hardware migrations, patches, upgrades, parameter changes
DB replay does this by capturing a workload on the production system with negligible performance overhead( My observation is 2-5% more CPU usage ) and replaying it on a test system with the exact timing, concurrency, and transaction characteristics of the original workload. This makes possible complete assessment of the impact of the change including undesired results; new contentions points or performance regressions. Extensive analysis and reporting ( AWR , ADDM report and DB replay report) is provided to help identify any potential problems, such as new errors encountered and performance divergences. The ability to accurately capture the production workload results in significant cost and timesaving since it completely eliminates the need to develop simulation workloads or scripts. As a result, realistic testing of even complex applications using load simulation tools/scripts that previously took several months now can be accomplished at most in a few days with Database Replay and with minimal effort. Thus using Database Replay, businesses can incur much lower costs and yet have a high degree of confidence in the overall success of the system change and significantly reduce production deployment
Steps for Database Replay
Workload Capture
Database are tracked and stored in binary files, called capture files, on the file system. These files contain all relevant information about the call needed for replay such as SQL text, bind values, wall clock time, SCN, etc.
1) Backup production Database #
2) Add/remove filter ( if any you want )
By default, all user sessions are recorded during workload capture. You can use workload filters to specify which user sessions to include in or exclude from the workload. Inclusion filters enable you to specify user sessions that will be captured in the workload. This is useful if you want to capture only a subset of the database workload.
For example , we don't want to capture load for SCOTT user
BEGIN |
Here filter name is "user_scott" ( user define name)
3) Create directory make sure enough space is there
CREATE OR REPLACE DIRECTORY db_replay_dir |
Remember in case on Oracle RAC directory must be on shared disk otherwise , you will get following error
SQL> l SQL> / |
4) Capture workload
BEGIN |
Duration => NULL mean , it will capture load till we stop with below mentioned manual SQL command. Duration is optional input to specify the duration (in seconds) , default is NULL
5) Finish capture
BEGIN |
# Take backup of production before Load capture, so we can restore database on test environment and will run replay on same SCN level of database to minimize data divergence
Note as per Oracle datasheet
The workload that has been captured on Oracle Database release 10.2.0.4 and higher can also be replayed on Oracle Database 11g release.So , I think , It simply mean NEW patch set 10.2.0.4 will support capture processes. Is it mean Current patch set (10.2.0.3) not support load capture ??????
2. Workload Processing
Once the workload has been captured, the information in the capture files has to be processed preferably on the test system because it is very resource intensive job. This processing transforms the captured data and creates all necessary metadata needed for replaying the workload.
exec DBMS_WORKLOAD_REPLAY.process_capture('DB_REPLAY_DIR'); |
Workload Replay
1) Restore database backup taken step one to test system and start Database
2) Initialize
BEGIN |
3) Prepare
exec DBMS_WORKLOAD_REPLAY.prepare_replay(synchronization => TRUE) |
4) Start clients
$ wrc mode=calibrate replaydir=/u03/oradata/test/db-replay-capture |
Workload Replay Client: Release 11.1.0.6.0 - Production on Wed Dec 26 00:31:52 2007 |
5) Start Replay
BEGIN |
Workload Replay Client: Release 11.1.0.6.0 - Production on Wed Dec 26 00:31:52 2007 |
Analysis and Reporting
Generate AWR , ADDM and DB reply report and compare with data gathered on production for same timeperiod when load was captured on Production database. For Database Replay Report run following command
SQL> COLUMN name FORMAT A20 DECLARE |