Remapping Users Using APIs

This section describes how to remap users for a consolidated replay using the DBMS_WORKLOAD_REPLAY package. For information about remapping users, see "Remapping Users for Consolidated Database Replay".

Before remapping users, ensure that the following prerequisites are met:

To remap users:

  1. Use the SET_USER_MAPPING procedure:

    DBMS_WORKLOAD_REPLAY.SET_USER_MAPPING (
       schedule_cap_id IN NUMBER,
       capture_user    IN VARCHAR2,
       replay_user     IN VARCHAR2);
    
  2. Set the schedule_capture_id parameter to a participating workload capture in the current replay schedule.

    The schedule_capture_id parameter is the unique identifier returned when adding the workload capture to the replay schedule, as described in "Adding Workload Captures to Replay Schedules Using APIs".

  3. Set the capture_user parameter to the username of the user or schema captured during the time of the workload capture.

  4. Set the replay_user parameter to the username of a new user or schema to which the captured user is remapped during replay.

    If this parameter is set to NULL, then the mapping is disabled.

This example shows how to remap the PROD user used during capture to the TEST user during replay for the workload capture identified as 1001.

EXEC DBMS_WORKLOAD_REPLAY.SET_USER_MAPPING (1001, 'PROD', 'TEST');

See Also:

Oracle Database PL/SQL Packages and Types Reference for information about the SET_USER_MAPPING procedure