Skip to main content
Older versions of Internet Explorer will not support certain site features. Chrome, Safari, Firefox, and Edge will provide the best experience.
Spok

Configuring the Message Purge Feature

This topic describes how to configure the message purge feature in Spok Mobile. This is a required configuration.

Spok Mobile automatically purges old messages from the system after a specified number of days. For example, you can configure the system to automatically purge messages after they are 10 days old. The script that purges these messages runs at 12:00 AM daily, based on the SQL Server’s UTC time.

The Spok Mobile installer automatically installs the SQL script AmcomAmcPremiseCoreMessagePurge.sql in the Database folder. After the installation is complete, this script can be configured to automatically delete messages after a specified number of days.

Note that the default value for the message purge feature is 5 days, and the value cannot be set to less than 3 days. If the default value does not need to be changed, you can run the script without any additional configuration. For information on how to run the script, see Running the Script.

The automatic message purge feature will delete both read and unread messages.

Validating the Correct Setup

Before configuring the message purge feature, and before running the script, ensure that the Agent XPs setting is set to "1" or enabled. If it is not set to "1", you must adjust the value.

  1. Check the Agent XPs value by running the following:
        EXEC SP_CONFIGURE 'Agent XPs'
  2. The following message appears:
        Msg 15123, Level 16, State 1, Procedure sp_configure, Line 51
    The configuration option ‘agent xps’ does not exist, or it may be an advanced option.
    NOTE: If the Agent XPs setting is set to 1 in your configuration, stop here and do not perform the steps below.
  3. If Agent XPs is not set to 1, run the following to enable the advanced option:
        EXEC SP_CONFIGURE 'show advanced options',1
    GO
    RECONFIGURE
    GO
    EXEC SP_CONFIGURE 'show advanced options'


    You should see run_value = 1
    Within “show advanced options,” this run_value indicates that the advanced options are enabled and can be modified.
  4. Re-run the sp_configuration. This will set the run_value to 0.
        SP_CONFIGURE 'Agent XPs'
  5. Change the value to 1 by running the following:
        EXEC SP_CONFIGURE 'Agent XPs',1
    GO
    RECONFIGURE
  6. Restart your SQL Server Agent from the SQL Server Configuration Manager). The SQL Server Agent and its jobs will appear.

Configuring the Number of Days

  1. In the Scripts folder, access the AmcomAmcPremiseCoreMessagePurge.sql script. This script is located in the following location: <INSTALL_DIRECTORY>\Amcom Software\Mobile Connect Services\Database\AmcomAmcPremiseCoreMessagePurge.sql. The script displays.
  2. Edit the Declare@RetentionDays char =5 field. For example, if you would like the system to purge messages every three days, you would configure the field to the following: Declare@RetentionDays char =3.
  3. Save the changes.

Running the Script

  1. Access Microsoft SQL Server Management Studio. Microsoft SQL Server Management Studio displays.
  2. Run the AmcomAmcPremiseCoreMessagePurge.sql script against the server that has the AmcomAmcPremiseCore database. For detailed information on how to run SQL scripts in the Microsoft SQL Server Management Studio, refer to Microsoft’s technical documentation.

Re-Running the Script

The AmcomAmcPremiseCoreMessagePurge.sql script is intended to be run one time after the original installation of Spok Mobile; however, the script can be manually re-run by performing the following steps:

  1. Access Microsoft SQL Server Management Studio. Microsoft SQL Server Management Studio displays.
  2. Delete the AmcomAmcPremiseCoreMessagePurge job. For detailed information on how to delete jobs in Microsoft SQL Server Management Studio, refer to Microsoft’s technical documentation.
  3. Re-run the AmcomAmcPremiseCoreMessagePurge.sql script against the server that has the AmcomCore database. For detailed information on how to run SQL scripts in the Microsoft SQL Server Management Studio, refer to Microsoft’s technical documentation.