Ensure all users log out of GP, then run
------------------------------------------------------------------------------
DELETE FROM [DYNAMICS].[dbo].[ACTIVITY]
DELETE FROM [DYNAMICS].[dbo].[SY00800]
DELETE FROM [DYNAMICS].[dbo].[SY00801]
DELETE FROM [tempdb].[dbo].[DEX_LOCK]
DELETE FROM [tempdb].[dbo].[DEX_SESSION]
------------------------------------------------------------------------------
If it says a batch is stuck / being edited, and there is no one else in the system
UPDATE SY00500 SET MKDTOPST=0, BCHSTTUS=0 where BACHNUMB='XXX'