Troubleshooting login problems after database restore in Dynamics GP

Question:

How can I resolve the login issue for users after restoring a database from backup? I have checked that the users exist in SQL and are mapped correctly in the SY01400 table, and that the Dynamics DB Tool can connect with sa. What else should I try?

Answer:

How to fix login issues after restoring a database from backup

If you have restored a database from backup and your users are unable to login, you may need to perform some additional steps to ensure that the database is properly configured and synchronized with the Dynamics GP application. In this article, we will discuss some common causes and solutions for this problem.

One possible reason why your users cannot login is that the database name or the server name has changed after the restore. This can cause the Dynamics GP application to point to the wrong database or server, resulting in a login failure.

Solution 1: Update the DYNAMICS.SET file

The DYNAMICS.SET file is a configuration file that stores the information about the database and server names for each company in Dynamics GP. If the database name or server name has changed, you need to update this file accordingly. You can do this by following these steps:

  • Locate the DYNAMICS.SET file in the Dynamics GP installation folder on the client machine. The default location is C:\Program Files (x86)\Microsoft Dynamics\GP2018.
  • Open the file with a text editor such as Notepad.
  • Find the line that starts with “0=” and change the database name and server name to match the new ones. For example, if the new database name is GP2024 and the new server name is SQLSERVER, the line should look like this:
  • `0=GP2024,SQLSERVER`

  • Save and close the file.
  • Repeat these steps for each client machine that needs to access the restored database.
  • Cause 2: The database users are orphaned

    Another possible reason why your users cannot login is that the database users are orphaned. This means that the database users are not associated with the corresponding SQL Server logins, which are required for authentication. This can happen when the database is restored from a different server or instance, or when the SQL Server logins are recreated or changed.

    Solution 2: Sync the database users with the SQL Server logins

    To fix the orphaned users, you need to sync the database users with the SQL Server logins. You can do this by using the Dynamics GP Utilities or by running a SQL script. Here are the steps for both methods:

    Method 1: Using the Dynamics GP Utilities

  • Launch the Dynamics GP Utilities from the Start menu or the Dynamics GP installation folder.
  • Log in as the sa user or a user with sysadmin privileges.
  • Select the company that you want to sync the users for and click Next.
  • On the Additional Tasks window, select Synchronize All and click Process.
  • Wait for the process to complete and click Exit.
  • Method 2: Using a SQL script

  • Open the SQL Server Management Studio and connect to the SQL Server instance that hosts the restored database.
  • Open a new query window and paste the following script:
  • “`sql USE [master] GO DECLARE @dbname sysname SET @dbname = ‘GP2024’ — Change this to your database name EXEC sp_msforeachdb ‘IF ”?” = @dbname BEGIN USE [?] EXEC sp_change_users_login ”Auto_Fix”, ”sa”, NULL, ”sa” EXEC sp_change_users_login ”Auto_Fix”, ”DYNSA”, NULL, ”DYNSA” EXEC sp_change_users_login ”Auto_Fix”, ”LESSONUSER1”, NULL, ”LESSONUSER1” EXEC sp_change_users_login ”Auto_Fix”, ”LESSONUSER2”, NULL, ”LESSONUSER2” — Add more lines for each user that you want to sync END’ GO “`

  • Modify the script to match your database name and the users that you want to sync. You can get the list of users from the SY01400 table in the restored database.
  • Execute the script and check the results for any errors.
  • Cause 3: The database is not compatible with the Dynamics GP version

    A third possible reason why your users cannot login is that the database is not compatible with the Dynamics GP version that you are using. This can happen when the database is restored from a different version of Dynamics GP, or when the Dynamics GP application is upgraded or downgraded.

    Solution 3: Update the database version

    To make the database compatible with the Dynamics GP version, you need to update the database version by running the Dynamics GP Utilities. Here are the steps:

  • Launch the Dynamics GP Utilities from the Start menu or the Dynamics GP installation folder.
  • Log in as the sa user or a user with sysadmin privileges.
  • Select the company that you want to update the version for and click Next.
  • On the Additional Tasks window, select Update Company and click Process.
  • Wait for the process to complete and click Exit.
  • Conclusion

    In

this article, we have discussed some common causes and solutions for the login issue that may occur after restoring a database from backup. We hope that this article has helped you to resolve the problem and get your users back to work. If you still encounter any issues, please contact your Dynamics GP partner or Microsoft support for further assistance.

Leave a Reply

Your email address will not be published. Required fields are marked *

Privacy Terms Contacts About Us