${DSWEB_DATABASE_PROFILENAME}
The variables in the following table can be used in any job manager and user-defined alert script. These variables represent values that are identified with the alert, such as the database name and job ID.
| Variable | Value returned |
|---|---|
| DSWEB_DATABASE_NAME | The physical database name. |
| DSWEB_DATABASE_PROFILENAME | The name that is associated with the database
when it is created on the databases page. This value is not the physical database name, but the unique identifier that is associated with the database. |
| DSWEB_INSTANCE_NAME | The DB2 instance name. |
| DSWEB_JOB_ID | The job that ran the script’s unique ID. |
| DSWEB_JOB_NAME | The name or label that you used for the current job. |
| DSWEB_LOGGEDIN_USER | The user ID that is used to run the script. This user ID can also be the SSH user ID. |
The variables in Table 2 can be used only in job manager scripts. These variables are defined only when they are triggered from the Alert Action feature.
| Variable | Value returned |
|---|---|
| DSWEB_ALERT_DETAIL | Key details or abstract about the alert. |
| DSWEB_ALERT_ID | The alert ID for the specified alert action. |
| DSWEB_ALERT_TYPE_NAME | The type of alert such as database status. |
The DBA team develops a script to extract audit records with the SYSPROC.AUDIT_DELIM_EXTRACT stored procedure. SYSPROC.AUDIT_DELIM_EXTRACT is accessible from /mnt/dba/scripts/extractaudit.sh in all of their Linux and UNIX systems. SYSPROC.AUDIT_DELIM_EXTRACT uses DB2 commands and other utilities to extract audit records and copy those records to the central server. The DBA team’s existing generic script expects the database name as an argument when started. The DBA team wants to create a script that extracts the database name. From the job manager, they can schedule the script to run at regular intervals to automate the extraction of the database name.
${DSWEB_DATABASE_PROFILENAME}
echo ==========================================
echo TRACE: Job name is '${DSWEB_JOB_NAME}', Job ID is '${DSWEB_JOB_ID}'
echo TRACE: Job is being run against Database Profile '${DSWEB_DATABASE_PROFILENAME}' with userID: '${DSWEB_LOGGEDIN_USER}'
echo TRACE: The database name is '${DSWEB_DATABASE_NAME}'
echo ==========================================
/mnt/dba/scripts/extractaudit.sh ${DSWEB_DATABASE_NAME}
After the DBA runs the script, the DBA then tests the output against another database to confirm that the script invocation from the job is working as expected. The DBA switches to the History view and verifies that the script has run successfully by viewing the execution log. The DBA then creates a schedule in the Schedules section to run the job weekly. The DBA selects the set of databases and time. The DBA also chooses to create monthly schedules for those databases that needs this job to run only on a monthly basis.