Resets the Microsoft SQL Server Notification Services application quantum clock to the start time of a previous quantum. A new quantum is created with the same UTC (Coordinated Universal Time or Greenwich Mean Time) start time as the quantum specified in the stored procedure. This allows you to replay past quanta.
The following two scenarios show how you can use this stored procedure:
When testing an application, you can add one scheduled subscription, and then test that subscription by resetting the quantum clock as needed.
When diagnosing system problems, you can reset the quantum clock and reproduce past system behavior. All processing, such as event batches and timed subscriptions, is replayed exactly as in real time, as long as the NS$instance_name service is running and the instance is enabled.
Notification Services creates the NSSetQuantumClock stored procedure in the application database when you create the instance. When you update the application, Notification Services recompiles the stored procedure.
This stored procedure is in the application's schema, which is specified by the SchemaName element of the application definition file (ADF). If no schema name is provided, the default schema is dbo.
You must disable the generator before running NSSetQuantumClock.
In the application definition file (ADF), ensure that the ChronicleQuantumLimit and SubscriptionQuantumLimit values are zero, which means there is no limit to how far back you can process quanta. If nonzero limits are specified, the generator might skip the quantum of interest.
Vacuum processing removes data from the system. If you have removed data of interest, the processing of that data cannot be replayed.
When Notification Services tries to catch up on prior quanta, the older quanta take precedence and are processed first. When you initialize the quantum clock, be aware that new quanta might be processed later than scheduled.
The following example shows how to reset the quantum clock to replay previous quanta, starting at quantum number 1. A new quantum is entered into the NSQuantum1 table with a new quantum number, but with a StartTime value equal to the StartTime value of quantum 1.
The application uses the default SchemaName settings, which places all application objects in the dbo schema.
EXEC dbo.NSSetQuantumClock @QuantumId = 1;
For example, if four quanta currently exist in the NSQuantum1 table, and quantum 1 started at 2002-05-23 17:23:37.640, when you run this example, quantum 5 is entered with a start time of 2002-05-23 17:23:37.640. When you enable the generator, the generator replays all quanta starting at quantum 1.