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.
Resources
Spok

Configuring the Message Purge Feature

This topic includes information for configuring the message purge feature in Spok Mobile. This is a required configuration.

The Spok Mobile system has the ability to automatically purge old messages from the system at the defined number of days. For example, if you would like the system to automatically purge the messages from being stored in the system after they are 10 days old, you can configure this information. The script that purges these messages runs at 12:00 AM daily, based on the SQL Server’s UTC time.

To do this, the Spok Mobile installer automatically installs a SQL script that is installed in the Database folder. After the installation is complete, this script (AmcomAmcPremiseCoreMessagePurge.sql) can be configured to automatically delete messages at the desired 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, the script can be run without any additional configuration. For information on how to run the script, see Running the Script.

NOTE: The message purge automatically deletes read and unread messages.

Validating the Correct Setup

Before configuring the number of days at which the messages are purged and before running the script, a configuration option must be checked and re-configured if set to the incorrect value. More specifically, before doing additional configuration, the Agent SPS setting must be set to “1” or enabled.

  1. Check the Agent XP value by running the following:
    EXEC SP_CONFIGURE 'Agent XPs'
    The following message displays:
    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 SP setting is set to 1 in your configuration, additional steps do not need to be performed.
  2. The following enables the advanced option for you:
    EXEC SP_CONFIGURE 'show advanced options',1
    GO
    RECONFIGURE
    GO
    EXEC SP_CONFIGURE 'show advanced options'
    You should see the run_value = 1
    Within “show advanced options,” this run_value shows us the advanced options are enabled and we can change them.
  3. Re-run the sp_configuration. This is where the run_value is set to 0.
    SP_CONFIGURE 'Agent XPs'
  4. Change the value to 1 by using the following:
    EXEC SP_CONFIGURE 'Agent XPs',1
    GO
    RECONFIGURE
  5. Restart your SQL Server Agent (from SQL Server Configuration Manager). The SQL Server Agent and its jobs display.

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.