![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgS2PVSBg47L2qZ9jYNEPZq12fVf50ezuV7QUk6Prc7YI7vtFToJCcY0QKaQ4tE82mPxVEYhiBsS5QeHDCzPnGtvRXh1oVT6Ar1HiqdMMA36b996rFB3TI0BDyjeCjKsroSIQuioFC3gnk/s400/ClearData01.jpg)
In an attempt to replicate this issue, the most logical place to start was to login into Dynamics GP as my 'sa' user and open the Clear Data window and try to do something there.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5yAWaQfAdh1B-jOVIsI_j7foV8XVfc-_EMGAkTMS60v72bkKFN3svBTro30_IbJDCk8zmhx4soSqiVVxuc_pNbwS1YTPKHzIkJLk72m5KdBLZvR_5jQ8BfUR5yESyItFRdZ8cNKOOsUw/s400/ClearData02.jpg)
Since Clear Data is a distructive process, the Dynamics GP Development team figured they had to find a way to prevent users from accessing the system while this process was being executed by, perhaps, the system administrator. This is how the Clear Data Comp reserved user ID was born. When the window is first accessed by the system administrator, Dynamics GP checks for any users currently available in the system. If there are no users, it will display the Clear Data window and create a record for the Clear Data Comp user ID in the system databases User Activity table (DYNAMICS.dbo.ACTIVITY). The following query shows the content of the ACTIVITY table.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJPMJ9bCO4nPd2BuSTFtOnBZu_7jhSJxdI0cLL6zIH9hOw7_2m1Fel_kdqtzUjKSEjZ5UdNLyw26DRDbNwdu5TVa_DyXAA7f2DqFcF7F_2z9If83yXkfL-AlrKvPKw2d3uO88KwBc9G20/s400/ClearData03.jpg)
If a second user attempts to access the same company, the code will check for the Clear Data Comp user activity record before allowing the user to access the company. If the record is found, the system will issue the error message originally described.
Since this user ID is internal to the application, there are no locks placed or sessions logged in the tempdb..DEX_LOCK or tempdb..DEX_SESSION tables respectively. If you noted the query results, the Clear Data Comp user ID's SQL session ID is 0.
What happens when Dynamics GP crashes in middle of running Clear Data?
If the system crashes in middle of the Clear Data process or SQL Server becomes unavailable, the ACTIVITY record for the Clear Data Comp user ID will not be properly released. Hence, when users attempt to log back into the company they will receive the same error message.
To correct this problem, the system administrator must log into SQL Server Management Studio and remove the record by running the following query:
-- created by Mariano Gomez, MVP
DELETE FROM ACTIVITY WHERE USERID = 'Clear Data Comp'
Hope this helps in your troubleshooting efforts and to understand another one of those 'old' Dynamics maintenance utilities.
No comments:
Post a Comment