Say you have a number of scheduled jobs that all start at the same time, perhaps coming from a master server (MSX). If they use shared resources (virtual machines in same host and/or a common SAN) you might want to spread the load a bit. I usually call a stored procedure as a first job step, and that procedure wait a random number of minutes between 0 and 30. This is the RandWait procedure.
- The first parameter, @sec_or_min, specifies the unit to wait. Allowed values are 's' (seconds) or 'm' (minutes, the default).
- The second parameter is the timespan, @span tinyint, with a default of 30. I.e., the proc will paus between 0 and this value. 0 means no waiting, useful for (temporarily) disabling waiting.
EXEC RandWait @sec_or_min = 'm', @span = 30
EXEC RandWait @sec_or_min = 's', @span = 10