#!/bin/sh

USERNAME="$1"
PASSWORD="$2"

sqlplus / as sysdba <<EOF
    CREATE USER $USERNAME IDENTIFIED BY $PASSWORD;
    GRANT EXECUTE ON DBMS_WORKLOAD_CAPTURE TO $USERNAME;
    GRANT EXECUTE ON DBMS_WORKLOAD_REPLAY TO $USERNAME;
    GRANT CREATE SESSION TO $USERNAME;
    GRANT CREATE ANY DIRECTORY TO $USERNAME;
    GRANT SELECT_CATALOG_ROLE TO $USERNAME;
    GRANT BECOME USER TO $USERNAME;
    GRANT CONNECT, RESOURCE, DBA TO $USERNAME;
quit
EOF

