Running and scheduling stored procedures for eMessage
eMessage Reports in 9.1 uses the data that is contained in staging tables, which are populated by stored procedures. The stored procedures perform a delta refresh operation. Run the stored procedures at least once per day. If you run the procedures more frequently, the delta refresh method prevents multiple concurrent runs.
The following table provides information about the stored procedures and the tasks that they complete:
Guidelines for running stored procedures for eMessage
Use the following guidelines for running stored procedures:
*
*
*
*
*
When the scripts have run successfully, they display a final return code of 0.
Sample configuration of stored procedures for Oracle
Note the following guidelines when you configure stored procedures for the Oracle database:
*
IBM® recommends using Oracle Automatic Memory Management (AMM). For more information, go to http://docs.oracle.com/cd/B28359_01/server.111/b28310/memory003.htm
*
*
The following example illustrates how to create a job and generate a run identifier. The example also illustrates the job ID when the job completes.
Example for creating a run identifier
The following example shows how to get a job number every day at 21:00 hours without an end date. The jobs start on August 19, 2013:
declare
jobno number;

BEGIN
DBMS_JOB.submit (job =>:jobno,
what => 'sp_runid;',
next_date => to_date('19-Aug-2013 21:00','DD-MON-YYYY HH24:MI' ),
interval => 'sysdate+1');
commit;
END;
/
Example for processing contact data
The following example shows how to schedule a batch job to process contact data. The job runs at 21:10 hours every day:
declare
jobno number;

BEGIN
DBMS_JOB.submit (job =>:jobno,
what => 'sp_populate_mailing_contacts;',
next_date => to_date('19-Aug-2013 21:10','DD-MON-YYYY HH24:MI' ),
interval => 'sysdate+1');
commit;
END;
/
Example for processing response data
The following example shows how to schedule a batch job to process response data. The job runs at 21:10 hours every day:
declare
jobno number;

BEGIN
DBMS_JOB.submit (job =>:jobno,
what => 'sp_populate_mailing_responses;',
next_date => to_date('19-Aug-2013 21:10','DD-MON-YYYY HH24:MI' ),
interval => 'sysdate+1');
commit;
END;
/
Example for processing SMS contact data
*
The following example shows how to get a job number every day at 21:00 hours without an end date. The jobs start on August 19, 2013:
BEGIN
DBMS_JOB.submit (job =>:jobno,
what => 'sp_populate_SMS_contacts;',
next_date => to_date('19-Aug-2013 21:10','DD-MON-YYYY HH24:MI' ),
interval => 'sysdate+1');
commit;
END;
/
Example for processing SMS response data
The following example shows how to get a job number every day at 21:00 hours without an end date. The jobs start on August 19, 2013:
BEGIN
DBMS_JOB.submit (job =>:jobno,
what => 'sp_populate_SMS_responses;',
next_date => to_date('19-Aug-2013 21:10','DD-MON-YYYY HH24:MI' ),
interval => 'sysdate+1');
commit;
END;
/
Sample configuration of stored procedures for Microsoft SQL Server
Note the following guidelines when you configure stored procedures for the Microsoft SQL Server database:
*
*
*
1.
2.
Example for creating a run identifier
Define the following command:
DECLARE @return_value int
EXEC @return_value = [dbo].[SP_RUNID]
SELECT 'Return Value' = @return_value
GO
Example for processing contact data
Define the following command:
DDECLARE @return_value int
EXEC @return_value = [dbo].[SP_POPULATE_MAILING_CONTACTS]
SELECT 'Return Value' = @return_value
GO
Schedule the job to run at least 10 minutes after the job that generates the run identifier.
Example for processing response data
Define the following command:
DECLARE @return_value int
EXEC @return_value = [dbo].[SP_POPULATE_MAILING_RESPONSES]
SELECT 'Return Value' = @return_value
GO
Schedule the job to run at least 10 minutes after the job that generates the run identifier.
Example for processing SMS contact data
Define the following command:
DDECLARE @return_value int
EXEC @return_value = [dbo].[SP_POPULATE_SMS_CONTACTS]
SELECT 'Return Value' = @return_value
GO
Example for processing SMS contact data
Define the following command:
DDECLARE @return_value int
EXEC @return_value = [dbo].[SP_POPULATE_SMS_RESPONSES]
SELECT 'Return Value' = @return_value
GO
Sample configuration of stored procedures for IBM® DB2®
Note the following guidelines when you configure stored procedures for the IBM® DB2® database:
*
The database must be DB2® version 9.7.8 or higher.
*
Create new jobs in DB2® Administrative Task Scheduler (ATS)
*
Complete the following steps before configuring stored procedures for IBM® DB2®:
1.
Set the DB2_ATS_ENABLE registry variable to YES, TRUE, 1, or ON. Restart the DB2® database after you set the variable.
2.
Users that belong to the SYSADM or SYSCTRL group can create this space. Use the following query to verify that the space exists:
SELECT TBSPACE FROM SYSCAT.TABLESPACES WHERE TBSPACE = 'SYSTOOLSPACE'
3.
EMESSAGE: Database that contains the eMessage system tables.
USER1: Owner of the EMESSAGE database
DB2ADMIN: DB2® administrative user
Administrator: Super user
4.
Connect to DB2® as an administrative user and run the following grant commands:
*
*
*
*
5.
*
*
Example for creating a run identifier
This example shows how to get a job number every day at 20:50 hours without an end date.
call SYSPROC.ADMIN_TASK_ADD('RunID_Job',null,null,
null,'50 20 * * *','USER1','SP_RUNID',null,null,null)
Example for processing contact data
This example shows how to schedule a batch job to process contact data. In this example, the job runs at 21:00 hours every day.
call SYSPROC.ADMIN_TASK_ADD('Response_Job',null,null,null,'00 21 * * *',
'USER1','SP_POPULATE_MAILING_RESPONSES',null,null,null)
Schedule the job to run at least 10 minutes after the job that generates the run identifier.
Example for processing response data
This example shows how to schedule a batch job to process response data. In this example, the job runs at 21:00 hours every day.
call SYSPROC.ADMIN_TASK_ADD('Response_Job',null,null,
null,'00 21 * * *','USER1','SP_POPULATE_MAILING_RESPONSES',null,
null,null)
Schedule the job to run at least 10 minutes after the job that generates the run identifier.