|
| 1 | +## Database Replay Scripts |
| 2 | + |
| 3 | +This folder provides SQL scripts for the usage of Database Replay (DB Replay). Please adapt and change the scripts to your conditions. |
| 4 | + |
| 5 | +## Scripts |
| 6 | + |
| 7 | +You can find an example workflow, the executed scripts, and a detailed description in the posting [Testing with Oracle Database Replay](https://blogs.oracle.com/coretec/post/testing-with-oracle-database-replay). |
| 8 | + |
| 9 | +Keep in mind that appropriate permissions are required to |
| 10 | +- Create directory objects |
| 11 | +- Use DBMS_WORKLOAD_CAPTURE and DBMS_WORKLOAD_REPLAY packages |
| 12 | +- Act as a replay client user (e.g. wrc someuser/YOUR_PASSWORD or wrc USER=someuser PASSWORD=YOUR_PASSWORD) //PLEASE CHANGE YOUR_PASSWORD TO A REAL PASSWORD! |
| 13 | + |
| 14 | +In the documentation [DBMS_WORKLOAD_CAPTURE Security Model]( https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/DBMS_WORKLOAD_CAPTURE.html#GUID-77C6507C-3DE6-4FB4-B180-530BEB840BE8) you will get the detailed information about it. |
| 15 | + |
| 16 | +Before starting a workload capture, you should have a strategy in place to restore the database on the test system. Before a workload can be replayed, the logical state of the application data on the replay system should be similar to that of the capture system when replay begins. |
| 17 | + |
| 18 | +In general, please follow the suggested script order. |
| 19 | + |
| 20 | +### 1) Capture the Database Workload in the production environment |
| 21 | + |
| 22 | +Before starting, check the [Workload Capture restrictions](https://docs.oracle.com/en/database/oracle/oracle-database/19/ratug/capturing-a-database-workload.html#GUID-4A1995F1-78F9-4080-8DFC-1E3EBCB3F4B8). |
| 23 | + |
| 24 | +- Provide an empty database directory |
| 25 | +- (optional) Use filters: capturefilter.sql |
| 26 | +- Start capture: capturestart.sql |
| 27 | +- (optional) Stop capture: capturestop.sql |
| 28 | +- Check capture results: capturemon.sql |
| 29 | +- Export AWR: exportawr.sql |
| 30 | +- Capture report: capturereport.sql |
| 31 | + |
| 32 | +(Note: it may be useful to generate an additional AWR spanning the capture period.) |
| 33 | + |
| 34 | +### 2) Preprocess the (captured) Database Workload on the test environment |
| 35 | + |
| 36 | +- Preprocess: processcapture.sql |
| 37 | +- (optional) Check duration: processmonitor.sql |
| 38 | + |
| 39 | +### 3) Replay the Database Workload on the test environment |
| 40 | + |
| 41 | +- (optional) Add filters: replayfilter.sql and replayfilterset.sql |
| 42 | +- Initialize the replay: replayinitialize.sql |
| 43 | +- (optional) Map connections: remapping.sql |
| 44 | +- (optional) Use filters: replayusefilterset.sql |
| 45 | +- Prepare the replay: replayprepare.sql |
| 46 | + |
| 47 | +- Workload Replay clients: Number estimation and start |
| 48 | + |
| 49 | +Estimate the number of Workload Replay Clients (WRCs) (e.g. $wrc mode=calibrate replaydir=../replay/..) |
| 50 | + |
| 51 | +Start WRCs in the background on the replay machine or a separate machine (e.g. $wrc username/password mode=replay replaydir=../replay/...) |
| 52 | + |
| 53 | +- Start the replay: replaystart.sql |
| 54 | +- Monitor the replay: replaymon.sql |
| 55 | + |
| 56 | +### 4) Generate Reports |
| 57 | + |
| 58 | +- (optional) Divergence reports: divergences.sql, divergence_detail.sql |
| 59 | +- Replay report: replayreport.sql |
| 60 | +- Import capture AWRs: importAWR.sql |
| 61 | +- ComparePeriod report: comparereplayreport.sql |
| 62 | + |
| 63 | +(Note: it may be useful to generate an additional AWR spanning the replay period.) |
| 64 | + |
| 65 | +# License |
| 66 | + |
| 67 | +Copyright (c) 2024 Oracle and/or its affiliates. |
| 68 | + |
| 69 | +Licensed under the Universal Permissive License (UPL), Version 1.0. |
| 70 | + |
| 71 | +See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details. |
0 commit comments