samc technologies blogs

SAMC Technologies staff feel it's important to share our experiences with others as part of our open communication approach.  Please feel free to send us any comments you have regarding our blogs. 

Dynamics SQL: Clear Stuck Batches

Here are the scripts you will need to clear a batch to reprocess in the event GP crashes during batch processing. The SQL scripts to fix this are found in the KB article #850289.
Have everyone log out of GP. Use SSMS Activity Monitor to verify or exec sp_Who2 in Management Studio.
Always create a backup of your database prior to executing any queries that modify data. It takes less time to restore from backup than to rebuild completely in most cases.

DELETE DYNAMICS..ACTIVITY
DELETE DYNAMICS..SY00800
DELETE DYNAMICS..SY00801
DELETE TEMPDB..DEX_LOCK
DELETE TEMPDB..DEX_SESSION

To clear the status of the batch run the following where 'n' is your batch number:

UPDATE SY00500
SET MKDTOPST=0
,BCHSTTUS=0
WHERE BACHNUMB='n'