Use Database Actions to Capture and Replay Workloads

You can test a workload in Database Actions by capturing it on production system and replaying it on test system with the exact timing, concurrency, and transaction characteristics of the original workload.

You can use Workload Capture/Replay to capture a workload from an Autonomous Database instance and replay the workload on an Autonomous Database or on the capture files stored in object storage.

This enables you to compare workloads between a cloud service database and an Autonomous Database instance.

The Workload Capture/Replay feature consists of the following steps:

(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

Describes the steps to capture a workload on your Autonomous Database instance.

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. Capturing a workload involves recording all requests made by external clients to Oracle Database.

Note:

Background activities and database scheduler jobs are not captured.
  1. From the Administration tab of the Launchpad, select Workload Capture/Replay.

    The Workload Capture/Replay page appears with a list of Jobs.

  2. Click + Capture workload.



  3. Specify the following field values on the Capture a workload dialog:
    • Name: Enter the name of the capture. For example, demo_capture.
    • Click Set duration to optionally enter the duration of the capture.
    • Capture duration in minutes: Specify this field only when you select the Set duration button, else you can skip this field.
  4. Click Capture to start the workload capture. Click Cancel to cancel the ongoing process of capture.

    You view a confirmation message and the replay card under Jobs section of the Workload Capture/Replay page.

    When the capture job starts the START_CAPTURE job is updated to In Progress. This means that the Workload/Capture tool has initiated the capture job.

  5. You can now perform any action such as creating a user for the Workload Capture/Replay tool to capture.
  6. After successfully creating a workload, navigate to the Workload Capture/Replay page.
  7. Click the Actions icon on the newly created workload capture and select Finish capture to finish capturing the creating a new user workload. Click OK to complete the process of the capture. (This step is optional if you set a capture duration)

    Note:

    Only one capture or replay can be done at a time.
  8. You view a CAPTURE job listed under the Jobs section with the same name as the Capture. After the workload capture job is run, the workload capture cart displays a green check mark that indicates that the workload capture is complete.

    Note:

    Use the PAR URL displayed in the report field in the workload capture cart to view the capture and replay report. The capture and replay reports are stored in the object store and remain accessible for seven days from the date the PAR URL is generated.

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.

Configure Auto Capture/Replay

Using the Configure Auto Capture/Replay feature you can automatically capture a workload from a production database and replay the workload on a target refreshable clone.

This feature automates the process of Workload 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. This enables you to test that the patch either fixes a known issue or does not introduce an issue that affects your workload.

Run these steps to configure auto capture/replay feature in the production instance:

Prerequisite

To perform an auto capture/replay, you must have a clone instance. You also must configure auto capture or replay in the production instance.

  1. From the Administration tab of the Launchpad, select Workload Capture/Replay.

    The Workload Capture/Replay page appears with a list of existing jobs.

  2. On Workload Capture/Replay page, click the Auto capture/replay menu.
  3. Click Configure auto capture/replay to configure the field values.

    Specify the following fields on the Configure auto capture/replay dialog:

    • Refreshable clone: Select the refreshable clone name from the drop-down. For example, CLONE1.
    • Capture duration in minutes: Enter the duration to capture.
    • Start Date: The timestamp value specifies the date and time the workload capture on the production database should begin in MM/DD/YYYY, HH:MM format.
    • Capture Time: Enter the scheduled time you want to capture in (HH:MM).

      Click Save.

    The auto capture is scheduled at the Capture Time.

    Note:

    If there are multiple captures with the same capture name, the Configure auto capture/replay feature 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.

Replay a Workload on an Autonomous Database

After you complete a workload capture, you can replay it on an Autonomous Database instance.

The Replay workload recreates the actions you record during the workload capture of the production instance. The replay runs on a refreshable clone.

You can perform the Workload Capture/Replay feature in two ways:
  • Configure auto capture/replay: By configuring auto capture, you can automatically capture a workload from production database and replay it on a refreshable clone. See Configure Auto Capture/Replay for more information.
  • Manual replay: You can manually replay a workload capture from an Autonomous Database Instance that is stored on cloud Object Storage. See Replay a Workload Captured from an Autonomous Database for more information.

After you complete the workload capture, replay the workload on the target. You can:

Replay a Workload Captured from an Autonomous Database

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.

You can replay of a captured workload using the Replay workload feature on the Workload Capture/Replay page. You can manually replay workload either from an Autonomous Database instance or from a capture saved to Object Storage.

Replay workload from Autonomous Database instance

Prerequisite for manual replay:

To perform a manual replay, you must have a refreshable clone.

In this method, the captured workload is stored in binary files called capture files.
  1. On the Workload Capture/Replay page, click Replay Workload and select Replay a workload from an Autonomous Database.
  2. Select the capture from the Capture name drop-down field on the Replay a workload from an Autonomous Database dialog box.



  3. Click Replay.

    The Workload Capture/Replay page reappears, displays a message that the workload replay has started successfully.

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.

Replay a Workload from Capture Files Stored in Object Storage

In this method the capture files are downloaded from Object Storage for replay.

The replaying from Object Storage using Database Actions consists of parameters including Object store bucket URL, which points to the specific Object Storage bucket containing the capture files and a credential to access data in the Object Store.

  1. On the Workload Capture/Replay page, click Replay Workload and select Replay from Object Storage.
  2. On the Replay from capture files in object storage dialog, specify the following field values:



    • Replay Name: Enter the name of the replay. For example, REPLAY.
    • Object store bucket URL: Enter the object store bucket URL. For example, https://objectstorage.us-phoenix-1.oraclecloud.com/n/myoci/b/my_bucket/o/.
    • Credential name: Enter the name of the credential. For example, OBJ_STORE_CRED. The credential name must conform to Oracle object naming conventions, which do not allow spaces or hyphens.
    • Select Reconnect database after replay to reconnect database after replay.

    Click Replay.

    The Workload Capture/Replay page reappears, displays a message that the workload replay has started successfully.

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.