Current Position:Home > In SQL Server Agent jobs, how do you use @os_run_priority in a job step?

In SQL Server Agent jobs, how do you use @os_run_priority in a job step?

Update:11-30Source: network consolidation
Advertisement
After completing a SQL Server backup I need to take a copy of the backup file to another drive.
I'm planning to use copy or xcopy, but I'd like to set the process priority to "low".
I see there is an "os_run_priority" parameter to sp_add_jobstep so I know it should be possible. But I can't find any documentation of how to use it.
Currently I'm just doing a CmdExec step like this:-
start /low xcopy "E:\FullBackups\*.*"  "G:\FullBackups\" /s /j
Unfortunately, one side effect of using "start /low" is that the command is now asynchronous, so SQL Agent doesn't know when the copy has finished, or whether it copied successfully or not. Any suggestions on how to do this?
Thanks

The Best Answer

Advertisement
The documentation for @os_run_priority says Reserved which means that you should not use it. (It could be that it is only intended for jobs that SQL Server sets up itself, or that it has no function at all, but remains for legacy reasons.)
I am not sure that it is a good idea to lower the priority. The copy operation can consume quite some memory which can compete with SQL Server. That competition is not going to stop, just because you lower the priority but make matters worse.
Erland Sommarskog, SQL Server MVP, [email protected]