My company uses SQL2000 SP2 on Windows 2000 and we're seeing intermittent hanging on specific SQL jobs. The only commonality I can identify is that they all use xp_cmdshell.
Here is an example:
A scheduled job runs a stored procedure called sp_Run_rpt. The sp_Run_rpt is below:
CREATE PROCEDURE sp_Run_rpt (@strType varchar(1) = null,
@strDBServer varchar(20) = null,
@strDBName varchar(20)) AS
/*--------------------------------------------------*/
/* Execute a report and save output in a text file. */
/*--------------------------------------------------*/
set DEADLOCK_PRIORITY Low
declare @strCommand varchar(255)
select @strCommand = 'd:\Rpt_run.bat ' + @strType + ' ' + @strDBServer + ' ' + @strDBName
EXEC master..xp_cmdshell @strCommand, no_output
RETURN 0
/*--------------------------------------------------*/
/* //end */
/*--------------------------------------------------*/
GO
This job runs every 15 minutes, and will sometimes run successfully for days before it hangs. Can anyone help?