Test Workloads with Oracle Real Application Testing

Oracle Real Application Testing is an extremely cost-effective and easy-to-use proactive performance management solution that enables you to fully assess the outcome of a system change in test or production.

About Oracle Real Application Testing

You can use Oracle Real Application Testing to capture a workload on a production system and replay it on a test system with the exact timing, concurrency, and transaction characteristics of the original workload.

Oracle Real Application Testing provides an accurate method to test the impact of a variety of system changes and enables you to perform the following tasks:

  • You can test the effects of a system change on a workload without affecting the production system.

  • You can capture a workload on a production system and simulate the same workload on a test system.

You can use Oracle Database Replay to capture a workload from either an Autonomous Database instance or an on-premises database or any other cloud service database, and replay the workload on Autonomous Database. This enables you to compare how a workload runs on an Autonomous Database with another Autonomous Database, an on-premises database, or some other cloud service database.

Real Application Testing enables you to do any of the following Capture-Replay actions:

Capture-Replay Workloads between Autonomous Databases

You can Capture and Replay from an Autonomous Database instance into another Autonomous Database instance.

This enables you to compare workloads across different Autonomous Database instances. These Autonomous Database instances may vary at patch levels, database versions, or regions.

The Capture-Replay workflow between Autonomous Databases consists of the following steps (you either cancel or finish a workload capture, not both):

(Optional) Subscribe to Information Events to be Notified of Capture and Replay Details

Subscribe to com.oraclecloud.databaseservice.autonomous.database.information Information events to be notified at the start and completion of a capture and replay.

Note

This step is optional. You can also find status and historical information for a workload capture in the DBA_CAPTURE_REPLAY_STATUS and DBA_CAPTURE_REPLAY_HISTORY views.

See DBA_CAPTURE_REPLAY_STATUS View and DBA_CAPTURE_REPLAY_HISTORY View for more information.

Information events provide notifications about begin and end times of capture and replay and contain a PAR URL to access the capture and replay reports.

Autonomous Database Information events include the following:

  • WorkloadCaptureBegin: This event is triggered when a workload capture is initiated.
  • WorkloadCaptureEnd: This event is triggered when a workload capture completes successfully and generates a pre-authenticated (PAR) URL to download the capture file.
  • WorkloadReplayBegin: This event is triggered when a workload replay is initiated.
  • WorkloadReplayEnd: This event is triggered when a workload replay completes successfully and generates a pre-authenticated (PAR) URL to download the replay reports.

See Information Events on Autonomous Database for more information.

Capture a Workload on an Autonomous Database Instance

The first step in using Database Replay is to capture a production workload.

Note

You can capture a workload in an Autonomous Database instance and replay it in another Autonomous Database instance. You can replay the captured workload on a full clone or on a refreshable clone. The capture and replay targets must be in a consistent logical state. So, you must provision a refreshable clone or a full clone of the Autonomous Database instance on which you want to capture the workload.

See Cloning and Moving an Autonomous Database for more information.

When you begin workload capture on a production system, all requests from external clients directed to Oracle Database are tracked and stored in binary files called capture files.

A workload capture results in the creation of two subdirectories, cap and capfiles, which contain the capture files. The capture files provide all pertinent information about the client request, including transaction details, bind values, and SQL text. These capture files are platform independent and can be transported to another system.

Run DBMS_CLOUD_ADMIN.START_WORKLOAD_CAPTURE to initiate workload capture on an Autonomous Database instance.

See Cloning and Moving an Autonomous Database for more information.

To initiate a workload capture on your Autonomous Database instance you must be logged in as the ADMIN user or have the EXECUTE privilege on DBMS_CLOUD_ADMIN.

Example to initiate a workload capture:

BEGIN 
   DBMS_CLOUD_ADMIN.START_WORKLOAD_CAPTURE(
        capture_name => 'test',
        duration     => 60);
   END;
/

This starts the workload capture on your Autonomous Database instance.

The parameters are:

  • capture_name: is the name of the workload capture.

  • duration: is the duration (in minutes) for which you need to capture the workload. This parameter is optional.

See START_WORKLOAD_CAPTURE Procedure for more information.

Workload Capture Events

You can subscribe to the Information event com.oraclecloud.databaseservice.autonomous.database.information to be notified at the start of START_WORKLOAD_CAPTURE. See (Optional) Subscribe to Information Events to be Notified of Capture and Replay Details for more information.

Workload Capture and Replay Views

You can find information about workload capture and replay in the DBA_CAPTURE_REPLAY_STATUS and DBA_CAPTURE_REPLAY_HISTORY views. See DBA_CAPTURE_REPLAY_STATUS View and DBA_CAPTURE_REPLAY_HISTORY View for more information.

Cancel a Workload Capture on an Autonomous Database Instance

Run DBMS_CLOUD_ADMIN.CANCEL_WORKLOAD_CAPTURE to cancel the current workload capture on your Autonomous Database instance.

To cancel a workload capture, you must be logged in as the ADMIN user or have the EXECUTE privilege on DBMS_CLOUD_ADMIN.

Example:

BEGIN
    DBMS_CLOUD_ADMIN.CANCEL_WORKLOAD_CAPTURE;
END;
/

This cancels the current workload capture and performs a refresh on the refreshable clone.

You can query the DBA_CAPTURE_REPLAY_STATUS view to check the cancel workload status.

See DBA_CAPTURE_REPLAY_STATUS View for more information.

See CANCEL_WORKLOAD_CAPTURE Procedure for more information.

Finish a Workload Capture on Autonomous Database Instance

Run DBMS_CLOUD_ADMIN.FINISH_WORKLOAD_CAPTURE to complete a workload capture on your Autonomous Database instance.

Example to finish a workload capture on your Autonomous Database instance:

BEGIN
    DBMS_CLOUD_ADMIN.FINISH_WORKLOAD_CAPTURE;
END;
/

To run this procedure you must be logged in as the ADMIN user or have the EXECUTE privilege on DBMS_CLOUD_ADMIN. When you run this procedure a workload capture file is uploaded to Object Store as a zip file.

See FINISH_WORKLOAD_CAPTURE Procedure for more information.

Workload Capture Events

You can subscribe to the Information event com.oraclecloud.databaseservice.autonomous.database.information to be notified about a workload capture, that includes:

  • The completion of FINISH_WORKLOAD_CAPTURE.

  • The captureDownloadURL field that contains the PAR URL to access the capture and reports in Object Store. The capture and reports are valid for seven (7) days from the date when the PAR URL is generated.

See (Optional) Subscribe to Information Events to be Notified of Capture and Replay Details for more information.

Workload Capture and Replay Views

You can query the DBA_CAPTURE_REPLAY_STATUS view to check the status of a completed workload capture. See DBA_CAPTURE_REPLAY_STATUS View for more information.

You can find information about workload capture and replay in the DBA_CAPTURE_REPLAY_HISTORY view. See DBA_CAPTURE_REPLAY_HISTORY View for more information.

You can query the ID, NAME, START_TIME, and END_TIME columns of the DBA_WORKLOAD_CAPTURES view to retrieve the details of your workload capture. See DBA_WORKLOAD_CAPTURES for more information.

Prepare a Refreshable Clone for Workload Replay

Provides steps to prepare a refreshable clone for a workload replay.

Note

This step is not applicable when you are replaying a workload on a full clone.

You have two options to prepare a refreshable clone to replay a workload capture. You can run DBMS_CLOUD_ADMIN.PREPARE_REPLAY to automatically prepare a refreshable clone for a workload replay. This procedure refreshes the refreshable clone to the start time of the capture and disconnects the refreshable clone. You also have the option to manually prepare a refreshable clone to replay a workload capture.

Automatically Prepare a Refreshable Clone for Workload Replay

Example to automatically prepare a refreshable clone for a workload replay:

BEGIN
 DBMS_CLOUD_ADMIN.PREPARE_REPLAY (
    capture_name    'test'
END;
/

To run this procedure you must be logged in as the ADMIN user or have the EXECUTE privilege on DBMS_CLOUD_ADMIN.

DBMS_CLOUD_ADMIN.PREPARE_REPLAY does the following:

  • Refreshes the refreshable clone to the capture start timestamp.

  • Disconnects the refreshable clone.

Optionally, at this point before you replay a capture, you can make changes to the a refreshable clone. For example, changing parameter values and turning certain features on/off to see the impact on the replay.

Manually Prepare a Refreshable Clone for Workload Replay

These manual refreshable clone steps are not required when you automatically prepare a refreshable clone by running DBMS_CLOUD_ADMIN.PREPARE_REPLAY.

Perform the following steps to manually prepare for a workload replay:

  1. Find the capture start timestamp by querying the DBA_WORKLOAD_CAPTURES view. See DBA_WORKLOAD_CAPTURES for more information.

  2. Refresh the refreshable clone to the capture start timestamp. See Refresh a Refreshable Clone on Autonomous Database for more information.

  3. Manually disconnect the refreshable clone. See Disconnect a Refreshable Clone from the Source Database for more information.

  4. Optionally, before you replay a capture, you can make changes to the refreshable clone. For example, changing parameter values, turning certain features on/off to see the impact on the replay.

Replay a Workload on an Autonomous Database Instance

After you complete a workload capture you can replay it on a test system. Oracle replays the actions recorded during workload capture with the same timing, concurrency, and transaction dependencies of the production system.

Run the procedure DBMS_CLOUD_ADMIN.REPLAY_WORKLOAD to initiate workload replay on your database. You must be logged in as the ADMIN user or have the EXECUTE privilege on DBMS_CLOUD_ADMIN to run DBMS_CLOUD_ADMIN.REPLAY_WORKLOAD.

You can replay a captured workload on a refreshable clone or on a full clone of the Autonomous Database instance from which the workload was captured. The capture and replay targets must be in a consistent logical state.

Replay Workload On a Refreshable Clone

The follwowing example downloads the capture files from Object Storage, replays the captured workload, and uploads a replay report to Object Storage.

BEGIN 
  DBMS_CLOUD_ADMIN.REPLAY_WORKLOAD(
      capture_name => 'CAP_TEST1');
END;
/

The CAPTURE_NAME parameter specifies the name of the workload capture. This parameter is mandatory.

Replay Workload On a Full Clone

This following example downloads capture files from the Object Storage, replays the captured workload on the clone, and uploads a replay report to Object Storage.

BEGIN 
  DBMS_CLOUD_ADMIN.REPLAY_WORKLOAD(
       capture_name                => 'CAP_TEST1',        
       capture_source_tenancy_ocid => 'OCID1.TENANCY.REGION1..ID1',         
       capture_source_db_name      => 'ADWFINANCE');
END;
/
Note

If there are multiple captures with the same capture name, the REPLAY_WORKLOAD procedure uses the latest capture. Oracle recommends that you use a unique capture name for each capture to prevent confusion on which capture you are replaying.

The CAPTURE_NAME parameter specifies the name of the workload capture. This parameter is mandatory.

The CAPTURE_SOURCE_TENANCY_OCID parameter specifies the source tenancy OCID of the workload capture. This parameter is mandatory when running the workload capture in a full clone.

The CAPTURE_SOURCE_DB_NAME parameter specifies the source database name of the workload capture. This parameter is mandatory when running the workload capture in a full clone.

See REPLAY_WORKLOAD Procedure for more information.

Workload Replay Events

Subscribe to the Information event com.oraclecloud.databaseservice.autonomous.database.information to be notified about the following

  • The start and completion of a REPLAY_WORKLOAD.

  • The Object Store link to download replay reports. The event provides a PAR URL to access the reports in the replayDownloadURL field. The reports are valid for seven (7) days from the date when the PAR URL is generated.

See Information Events on Autonomous Database for more information.

Workload Capture and Replay Views

You can query the DBA_CAPTURE_REPLAY_STATUS view to check the workload replay status.

See DBA_CAPTURE_REPLAY_STATUS View for more information.

You can find information about workload capture and replay in the DBA_CAPTURE_REPLAY_HISTORY view. See DBA_CAPTURE_REPLAY_HISTORY View for more information.

Capture-Replay Workloads between non-Autonomous and Autonomous Databases

You can Capture and Replay from a non-Autonomous Database instance into an Autonomous Database.

This enables you to compare workloads between an on-prem database or other cloud service database and an Autonomous Database instance.

Topics

Capture a Workload

The first step in using Database Replay is to capture the production workload.

When you begin workload capture on the production system, all requests from external clients directed to Oracle Database are tracked and stored in binary files called capture files.

A workload capture results in the creation of two subdirectories, cap and capfiles, which contain the capture files.

The capture files provide all pertinent information about the client request, including transaction details, bind values, and SQL text.

These capture files are platform independent and can be transported to another system.

See Workload Capture to capture a workload on an on-premises database.

Replay a Workload on an Autonomous Database Instance

After you complete a workload capture, you can replay it on a test system. Oracle replays on the test system the actions recorded during workload capture, with the same timing , concurrency, and transaction dependencies of the production system.

Run DBMS_CLOUD_ADMIN.REPLAY_WORKLOAD to initiate workload replay on your database. You must be logged in as the ADMIN user or have the EXECUTE privilege on DBMS_CLOUD_ADMIN to run REPLAY_WORKLOAD.

Example to replay on an Autonomous Database instance a workload captured from an on-premises database:

BEGIN 
   DBMS_CLOUD_ADMIN.REPLAY_WORKLOAD(
      location_uri    => 'https://objectstorage.us-phoenix-1.oraclecloud.com/n/namespace-string/b/bucketname/o',
      credential_name => 'CRED_TEST',   
      synchronization => TRUE,
      process_capture => TRUE);    
END;
/

This downloads the capture files contained in the Object Storage location specified in the location_uri parameter, and replays the workload capture from the capture files. The replay generates and uploads the replay and Automatic Workload Repository reports to the Object Storage location specified in the location_uri parameter.

In this example, namespace-string is the Oracle Cloud Infrastructure object storage namespace and bucketname is the bucket name. See Understanding Object Storage Namespaces for more information.

See Upload Files to Your Oracle Cloud Infrastructure Object Store Bucket for more information on uploading files to Object Storage.

See Navigate to Oracle Cloud Infrastructure Object Storage and Create Bucket for more information on Object Storage.

The credential_name parameter specifies the credential to access the object storage bucket. The credential that you supply must have the write privileges to write into the Object Storage bucket. The write privileges are required to upload the replay report to the bucket.

If you do not specify a credential_name value, then DEFAULT_CREDENTIAL is used.

You don't need to create a credential to access Oracle Cloud Infrastructure Object Store if you enable resource principal credentials. See Use Resource Principal to Access Oracle Cloud Infrastructure Resources for more information.

The synchronization parameter specifies the synchronization method used during workload replay. A TRUE value indicates that the synchronization is SCN based.

The process_capture specifies whether you need to specify process_capture value or not. A TRUE value indicates that the replay includes process_capture.

Note

You must maintain the same logical state of the capture and replay databases at the start of the capture time.

See REPLAY_WORKLOAD Procedure for more information.

Workload Replay Events

You can subscribe to the Information event com.oraclecloud.databaseservice.autonomous.database.information to be notified about the WorkloadReplayBegin and WorkloadReplayEnd events. These events provide information about:

  • Start and completion of the REPLAY_WORKLOAD.

  • The replayDownloadURL field that contains the PAR URL to access the reports in Object Store. The PAR URL is valid for 7 days from the date of generation.

See Information Events on Autonomous Database for more information.

Workload Capture and Replay Views

You can query the DBA_CAPTURE_REPLAY_STATUS and DBA_CAPTURE_REPLAY_HISTORY views to check the workload replay status.

See DBA_CAPTURE_REPLAY_STATUS View and DBA_CAPTURE_REPLAY_HISTORY View for more information.

Test Workloads Against an Upcoming Patch

Using the workload auto replay feature you can automatically capture a workload from a production database that is on the regular patch level and replay the workload on a target refreshable clone that is on the early patch level.

This feature allows you to test an upcoming patch by running an existing workload that is in production against a patch, before the patch reaches production.

About Testing Workloads Against an Upcoming Patch

Using the workload auto replay feature you can automate the process of capture-replay to capture a workload that runs on a production database and automatically replay the workload on a target refreshable clone after an upcoming patch is applied on the target.

Autonomous Database provides the ability to provision an instance or create a refreshable clone with the Early patch level option. On instances running at the Early patch level, Autonomous Database applies upcoming maintenance patches a week before the patches are applied to production databases (databases that are provisioned at the Regular patch level). Using the WORKLOAD_AUTO_REPLAY feature you can assure that an upcoming patch is tested against your workload before the patch goes to production. This allows you to verify that the patch either fixes a known issue or does not introduce an issue that affects your workload.

To find information about captures and replays, subscribe to Information events. Information events provide notification for workload capture and reply events and include a PAR URL where you can download the capture file and replay report. See (Optional) Subscribe to Information Events to be Notified of Capture and Replay Details for more information.

When WORKLOAD_AUTO_REPLAY is enabled the source database captures a workload by running for a specified number of minutes. By default the workload capture starts when you enable WORKLOAD_AUTO_REPLAY (optionally you can use parameters to set the capture start day and time). Next, Autonomous Database checks the target database to verify the patching status. After the upcoming weekly patch is applied, Autonomous Database replays the workload on the target database. This capture-replay cycle continues automatically each week with Autonomous Database capturing the workload on the source database, waiting for the upcoming patch to be applied, and replaying the workload on the refreshable clone.

Note the following for enabling WORKLOAD_AUTO_REPLAY:

  • The source database must use the Regular patch level.

  • The target database must use the Early patch level.

  • The target database must be a refreshable clone of the source database, and must be created before you enable WORKLOAD_AUTO_REPLAY.

  • A source database can enable WORKLOAD_AUTO_REPLAY for no more than one refreshable clone (you can enable this feature for a maximum of one refreshable clone, even if you create multiple refreshable clones from the same source database).

  • After you enable WORKLOAD_AUTO_REPLAY, the capture-replay cycle continues every week. Autonomous Database runs a capture on the source database and then replays the workload on the target database, until you disable WORKLOAD_AUTO_REPLAY.

You can find information about workload captures and replays in the DBA_CAPTURE_REPLAY_HISTORY view. See DBA_CAPTURE_REPLAY_HISTORY View for more information.

Autonomous Database automatically applies patches on your database. Oracle provides a service level objective of zero regressions in your production database due to these patches. See Zero-Regression Service Level Objective for more information.

Enable Workload Auto Replay

The WORKLOAD_AUTO_REPLAY feature allows you run a workload from your production database and monitor for any divergence on an instance that is patched one week in advance. This feature allows you to test an upcoming patch by running an existing workload that is in production against a patch before the patch reaches production.

To enable WORKLOAD_AUTO_REPLAY:

  1. Create a refreshable clone of the production database.

    When you create the target refreshable clone, set the patch level to Early.

    See Set the Patch Level and Create a Refreshable Clone for an Autonomous Database Instance for more information.

  2. Run DBMS_CLOUD_ADMIN.ENABLE_FEATURE on the source database.

    For example:

    BEGIN 
       DBMS_CLOUD_ADMIN.ENABLE_FEATURE(
            feature_name => 'WORKLOAD_AUTO_REPLAY',
            params       => JSON_OBJECT(
                              'target_db_ocid' VALUE 'OCID1.autonomousdatabase.REGION..ID1',
                              'capture_duration' VALUE 120,
                              'capture_day' VALUE 'MONDAY',
                              'capture_time' VALUE '15:00'));
    END;
    /

    Where the parameters are:

    • feature_name: the value WORKLOAD_AUTO_REPLAY enables the workload auto replay feature.

    • params: is a JSON Object with the following value pairs:

      • target_db_ocid: accepts a string value. The value specifies the OCID of the target refreshable clone database on which the captured workload is replayed.

        This parameter is mandatory.

      • capture_duration: accepts a number value. The value specifies the duration in minutes for which the workload is captured on the production database. The value must be in the range between 1 and 720 minutes.

        This parameter is mandatory.

      • capture_day: accepts a string value. The value specifies the day of the week the workload capture on the production database should begin.

        This parameter is optional.

      • capture_time: accepts a value in the HH24:MM format. The value specifies the time of the day the workload capture on the production database should begin.

        This parameter is optional.

      By default the workload capture starts when you enable WORKLOAD_AUTO_REPLAY. When the optional capture_day and capture_time are specified, the automatic workload capture and replay happen at the specified timestamp.

      For example if capture_day is Monday and capture_time is 15:00, the first capture on the production database starts at 3PM on the next Monday. The same day of week and time are also used to schedule subsequent captures and replays.

    See ENABLE_FEATURE Procedure for more information.

    A an error value of ORA-20000: Invalid argument for target_db_ocid could indicate that the OCID you supplied is not a refreshable clone. In this case, you need to supply an OCID with a value for a refreshable clone.

  3. Query the DBA_CAPTURE_REPLAY_STATUS view to check the workload replay status.

This example enables WORKLOAD_AUTO_REPLAY on the source Autonomous Database and on the specified target refreshable clone database. With WORKLOAD_AUTO_REPLAY enabled, every week Autonomous Database runs a capture on the source database and replays the workload on the target database, until you disable WORKLOAD_AUTO_REPLAY.

To find information about captures and replays, subscribe to Information events. Information events provide notification for workload capture and reply events and include a PAR URL where you can download the capture file and replay report. See (Optional) Subscribe to Information Events to be Notified of Capture and Replay Details for more information.

You can find information about workload captures and replays in the DBA_CAPTURE_REPLAY_HISTORY view. See DBA_CAPTURE_REPLAY_HISTORY View for more information.

Disable Workload Auto Replay

Run DBMS_CLOUD_ADMIN.DISABLE_FEATURE to disable WORKLOAD_AUTO_REPLAY.

Run DBMS_CLOUD_ADMIN.DISABLE_FEATURE to disable workload auto replay. For example:

BEGIN 
DBMS_CLOUD_ADMIN.DISABLE_FEATURE(
    feature_name => 'WORKLOAD_AUTO_REPLAY');   
END;
/

You must be logged in as ADMIN or have DBMS_CLOUD_ADMIN privileges to run DBMS_CLOUD_ADMIN.DISABLE_FEATURE.

See DISABLE_FEATURE Procedure for more information.