Adding Workload Captures to Replay Schedules Using APIs

This section describes how to add workload captures to and remove workload captures from replay schedules using the DBMS_WORKLOAD_REPLAY package. For information about adding workload captures to replay schedules, see "Adding Workload Captures".

Before adding workload captures to a replay schedule, ensure that the following prerequisite is met:

To add workload captures to a replay schedule:

  1. Use the ADD_CAPTURE function:

    DBMS_WORKLOAD_REPLAY.ADD_CAPTURE (
       capture_dir_name    IN VARCHAR2,
       start_delay_seconds IN NUMBER  DEFAULT 0,
       stop_replay         IN BOOLEAN DEFAULT FALSE,
       take_begin_snapshot IN BOOLEAN DEFAULT FALSE,
       take_end_snapshot   IN BOOLEAN DEFAULT FALSE,
       query_only          IN BOOLEAN DEFAULT FALSE)
    RETURN NUMBER;
    
    DBMS_WORKLOAD_REPLAY.ADD_CAPTURE (
       capture_dir_name    IN VARCHAR2,
       start_delay_seconds IN NUMBER,
       stop_replay         IN VARCHAR2,
       take_begin_snapshot IN VARCHAR2 DEFAULT 'N',
       take_end_snapshot   IN VARCHAR2 DEFAULT 'N',
       query_only          IN VARCHAR2 DEFAULT 'N')
    RETURN NUMBER;
    

    This function returns an unique identifier that identifies the workload capture in this replay schedule.

    See:

    "About Query-Only Database Replay" for information about query-only database replays.

    Note:

    Query-only database replays are meant to be used and executed in test environments only.

    • Do not use query-only database replays on production systems.

    • Divergence is expected during query-only database replays.

  2. Set the capture_dir_name parameter to the name of the directory object that points to the workload capture under the top-level replay directory.

    The directory must contain a valid workload capture that is preprocessed on a system running the same database version as the replay system.

  3. Set the other parameters, which are optional, as appropriate.

    For information about these parameters, see Oracle Database PL/SQL Packages and Types Reference.

The following example shows how to add a workload capture named peak_wkld to a replay schedule by using the ADD_CAPTURE function in a SELECT statement.

SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('peak_wkld')
  FROM dual;

You can also use the DBMS_WORKLOAD_REPLAY package to remove workload captures from a replay schedule.

To remove workload captures from a replay schedule:

  1. Use the REMOVE_CAPTURE procedure:

    DBMS_WORKLOAD_REPLAY.REMOVE_CAPTURE (
       schedule_capture_number IN NUMBER);
    
  2. Set the schedule_capture_number parameter to the unique identifier that identifies the workload capture in this replay schedule.

    The unique identifier is the same identifier that was returned by the ADD_CAPTURE function when the workload capture was added to the replay schedule.

See Also: