Using the Named System Database Feature for Microsoft Dynamics GP 2013
After visiting with a group of Partners who attended the Technical Airlift this past week in Fargo, it became clear that the design intent behind the Named System Database feature and the perception of how it could be used in the field were not on the same page. With that, I decided that we really need to clear this misconception up and walk though the details of what the Named System Database feature can and can’t do for you.
Bottom-line, the Named Database feature essentially allows you to now have a different database name for the DYNAMICS database.Â Since our inception onto the SQL Platform, the system database has always been called DYNAMICS.Â With the Microsoft GP 2013 release, NEW INSTALLATIONS now have an option to name their system database anything they wish up to a length of ten characters and so long as it conforms to SQL Server’s naming requirements, ie…no special characters and doesn’t start with a number. With that stated, please go back and read that last sentence completely again to ensure you understand what itÂ says!Â
I want to point out two key words there:Â NEW INSTALLATIONS.Â This would mean that if you are a current user of Microsoft Dynamics GP, there is not upgrade path or support for changing your system database name to something other than DYNAMICS and in reality, there is no benefit in doing so either.
The primary reasonÂ that Microsoft implemented this feature was to enable Hosting Partners the ability to host multiple customer data sets on a single instance of SQL Server. No longer would those Hosting Partners have to install a second or third instance of SQL Server on a physical host consuming resources with no apparent benefit. The secondary assumption madeÂ with this feature is that the Hosting Partner would responsible for maintaining and providing the system level admin work as well.Â This essentially translates into:
- Controlling access toÂ the “sa” password
- Controlling access the DYNSA login as there is only one DYNSA login that will be used for the instance of SQL Server
- Providing additional SQL Server rights using a standard GP account by managing server and database security role membership.
- Controlling access to SQL Management Studio and the query tool.
At this point, I hope that you are starting to get a better picture of what this feature enables and what it doesn’t.Â So if you are a single on-premise Dynamics GP customer, there really is no reason for you to move to this feature.Â In addition, when you are planning your upgrade to Dynamics GP 2013, the upgrade is supported using the DYNAMICS system database. So at a minimum, you have to be ON Dynamics GP 2013 in order to take advantage of the feature, not upgradingÂ to Dynamics GP 2013.
With that said, theÂ business reasons as to why you would need to move to Named Database functionality are:
- You currently have an on-premise deployment and want to move to a hosted environment
- You have multiple physical installs of Dynamics GP and you want to consolidate down to a single install on one SQL Server (not company combining)
- Hosting Partners needing to consolidate their current hosted deployments
and because these reasons do have merit, we needed to find a method of how to “migrate” an existing Dynamics GP 2013 customer into a Named Instance of Dynamics GP.Â The stepsÂ documented belowÂ enable this possibility.Â As of right now, thereÂ are no plans to build out a tool to enable such a process as the cost benefit of building and testing a tool when compared with performing what we consider,Â mostly SQL Admin work, is really difficult to justify. In addition, our impression is that these steps mostly apply to Hosting Partners and not the general Dynamics GP community.Â Either way, providing this information to everyone does have it benefits and I hope that you take the time to understand and dig into these steps.Â It will only help you better understand the database to GP client relationship with each other.
Before we begin, there are several planning aspects that need to be in place prior to starting this exercise and those are:
- Database name conflicts
- GP login name conflicts
- Administering Dynamics GP within the application
- Granting access to SQL Management Studio
Below is more detail regarding each planning point listed above.Â If you don’t spend the time walking through each component, you will only have to deal with them once you attempt to perform the LIVE migration.
Database Name Conflicts:
For obvious reasons, we know that it isn’t possible to have the same database nameÂ within a single instance of SQL Server. So you first will need to analyze the existing database names that you plan on migrating to ensure there are no conflicts.Â If the TWO database is present, that database will have to be sequenced in order to restore it.Â For example, TWO01 or TWO02.Â In fact,Â DynUtils will auto increment the Lesson Company up to 99 times, ie…TWO99.Â After the 99 instances of the Lesson Company, the installerÂ isn’t able to move forward andÂ requires the end user to enter a NEW database name from the Lesson Company. The best/recommended choice in this case would be to delete the Sample Company from the existing system and then re-add itÂ after migration so the re-sequencingÂ occurs through DynUtils.Â But if youÂ are understanding what I am really saying hereÂ and reading between the lines, I am mentioning the action of “renaming” of databases. The reason I point that out is because once you start getting a number of databases deployed on the SQL Server, overall management of those databases can become challenging.Â Because of that, I would consider identifying a naming convention for each customer AND their company databases.Â While the naming restrictions hasn’t changed (still limited to 5 characters), changing the name of the database is something to consider.Â You might have to take actionÂ if there are duplicate company database names!Â One strategy of name consolidation would be if Company ABC has database XYZ,Â why not have all of their databases begin with the letter A and end up with a database name of AXYZ? From a SQL Management perspective, all of those customer databases are in order and grouped together.Â Something to think about here!
I have attached a script located in the GPDatabaseUpdates.zip named GPCompanyUpdateDBName.sql and GPSystemDBCompanyRename.sqlÂ These statements will traverse through the available tables within the company database and update INTERID value for the columns:
Please be sure to read teh instructions at the top of each script. If there are additional products that carry the INTERID value within a different column, the attached script will need to be modified or manual updates will need to take place.Â Again, this script is used for renaming a company database to something different. You will need to make a change in the script and provide the current system database.Â There is a WILDCARD that needs to change:Â %SYSTEMDB%
**Note: Making this change willÂ have an impact on other items such as existingÂ SQL Jobs, Management Reporter, Web Services, eConnect and so on.Â Be sure to perform this action in a test environment first before executing a production move.
GP Login Name Conflicts:
Identify the GP User name conflicts prior to any system database renaming. If action isn’t taken prior to the movement of the system database, dealing with the fall out on the destination SQL Server isn’t going to be easy. In thinking through this process, we recommend if conflicts are found regarding user accounts, the following steps should be taken:
- Create a new user account that is distinct on the existing systemÂ and not on the destination SQL Server
- Grant the same application security access as the duplicate user account.
- Delete the duplicate user account from with Dynamics GP.
- Delete the SQL Login from the SQL Server to ensure it isn’t present.
When considering the Lesson User accounts, if those are present within the source databases, those should also be removed entirely from the source SQL Server by deleting them through the application.Â There can only be ONE SET of Lesson User accounts and the Dynamics GP 2013 Dyn Utilities doesn’t create multiple versions of these accounts.Â So in all likelihood, what needs to happen in this case is create normal users and grant them access to the Lesson Company.Â This, of course, would also deduct a system manager license when logged in.
Administering Dynamics GP within the application:
This topic does becomes a bit more black and white in terms of what you are able to do within the Dynamics GP 2013 application. But with a focus on separation of duties with regards to what is considered an application focused task and what is system focused task can be different from company toÂ company.Â Because of this, breaking these duties down in writing so there is a clearly defined path for who is responsible for what definitely helps identify how best to manage the application and its supporting systems. There are many system level actions that can be managed within the Dynamics GP application today that don’t require access to the ‘sa’ login or SQL Management Studio, to include the management of user accounts. Taking advantage of the SQL Server System and Database Roles can enable specific GP users accountsÂ the ability to perform user management focused tasksÂ within the Dynamics GP application. Unfortunately, thisÂ is an option not used by many asÂ we have all grown up to utilize the revered ‘sa’ account.Â In addition, even though the core product can use database roles for security access to specific tasks,Â there are still products out there today that require the ‘sa’ login, and PSTL (Professional Services Tools Library)Â is one of those.
With that, I am happy to announce that with Dynamics GP 2013, PSTLÂ will no longer require access to the ‘sa’ login to perform functions.Â The GP user accounts that performs tasks within PSTL today simply need to become aÂ member of the database owner (db_owner) database role for the given companies and system database. YEAH!!! If you are still using applications that require the use of ‘sa’ (with the exception of DynUtils), please consider opening a support caseÂ with the owner of the product and inquire as to when those changes can be included. From a hosting perspective, this change in business logic is going to need to change otherwise, the hosting partner will have to be involved in these types of application focused actions that still require ‘sa’.
Granting access to SQL Management Studio:
For customers wanting to get access to their data through SQL Management Studio, thisÂ is an option that can be accommodated. By using the built-inÂ Database roles within SQL, it is possible to create an account and grant the correct level of permissions needed to access the appropriate databases. With that said, what would be needed to accomplish this is:
- A new SQL Server login (Windows or Standard account).Â Can’t use their GP login as the password is encrypted and SQL Management Studio doesn’t recognize the encryption.
- Take the new SQL login and make a member of the db_owner database role for the system database and the associated company databases.
- If backup permissions are needed for owned databases, add the SQL Login to the db_backupoperator database role.Â
**Note: When taking these steps above, there is an implicit action taken called: VIEW ANY DATABASE.Â What this enables is the ability to SEE the actual databases being hosted in the instance of SQL. However, seeing the name of the database is the only action available since actual permissions are only granted to the specific databases needed.
Steps to move a Dynamics GP 2013 Deployment to a Named Database Deployment:
- Upgrade to Dynamics GP 2013 on the existing SQL Server. Get good backups after conversion and before starting any migration work.
- Remove any duplicate GP Users names that have been identified and create new GP Users along with setting security as required.
- Capture the SQL logins from the source SQL Server using Knowledge Article: 878449
How to transfer an existing Microsoft Dynamics GP, Microsoft Small Business Financials, or Microsoft Small Business Manager installation to a new server that is running Microsoft SQL Server (KB 878449)
- Load the captured SQL logins from the source SQL Server onto the destination SQL Server. You will need to deal with any exceptions that occur during this process.
- Restore the DYNAMICS database using a DIFFERENT DATABASE NAME (within the guidelines listed above) onto the destination SQL Server.Â For example, when restoring the database, you can restoreÂ a backup and have the backup tool also create a newÂ database usingÂ a new databaseÂ nameÂ such asÂ DYN02.Â One of the key steps during this process will be to ensure that the Physical file name (GPSDYNAMICSDAT.mdf) gets changed to match the new system database name.Â Â An exampleÂ of renaming to a system database name of DYN02 would be:Â Current File Name: GPSDYNAMICSDAT.mdfÂ Â New FileÂ Name: GPSDYN02DAT.mdfÂ Â Same would also apply to the database log file as well.
- Restore the company databases as required.
- If database name conflicts exist or renaming of the company databases is planned, make those change at this point using the steps above at the time of restore.
- Update the database compatibility level for each restored databaseÂ to match the version of SQL Server you are going to.
SQL Server 2008/2008 R2:Â sp_dbcmptlevel DYN02, 100
SQL Server 2012:Â sp_dbcmptlevel DYN02, 110
- Set the database owner to DYNSA using the script below for all restored databases.
Â Â Â Â Â
- Script out the following object from one of the company databases and make the required edits listed below:
- For one of the company databases being re-assigned to a new system database, go into SQL Management Studio and locate the AccountTransactions SQL view
- Right click on the view andÂ chose “Script View asÂ ALTER” to a new query window.
- Once the syntax of the SQL view is visible, perform a FIND for the string DYNAMICS.Â Â ThereÂ are three instances of the DYNAMICS database name which is used like:Â DYNAMICS.dbo.MC40200
- For each instance of the DYNAMICS database name, you will need to change this to your new system database name.Â For example: DYN02.dbo.MC40200
- After modifying the SQL view, load the updatedÂ view against each of the company databases associated with the new system database.
- Run the following script from the attached zip fileÂ to update the system databaseÂ information to correct reflect the new system database name. Please be sure to read teh instructions at the top of each script.
- Â Run Database Maintenance tool against the new system database and all of the company databases regenerating all of the objects within the database.
**Note: Making this change willÂ have an impact on other items such as existing SQL Jobs, Management Reporter, Web Services, eConnect and so on.Â Be sure to perform this action in a test environment first before executing a production move.
Â At this point, all of the key pointers within the system and company database should be updated.Â The next steps are to deal withÂ the additional and integrating products that also have a dependency on the NAME of the databases. Once that is complete, log into the Dynamics GP client and begin your testing.
LookingÂ forward to your feedback regardingÂ this information. The first questionÂ probably willÂ be something like:Â “Is this supported through the support team?”Â In short,Â probablyÂ not. I am leaving this open primarily because as people go through these processes, if issues are encountered that forces a changeÂ to this content, we would like to know about it so the content can be updated for others.Â But if the intent is to open a support case because you have aÂ scheduledÂ engagementÂ that requires you to make these types of changes, getting full support for this probably won’t happen. Because of that, making test runs through the entire process ensures that all required changes are made.Â We are expecting the hosting partners will be doing as its supports their business directly. If you have any follow up questions or concerns, please comment on this post or feel free to email me directly andÂ I will attempt to help the best I can.
September 26, 2012
Â· Aaron Donat Â· No Comments
Tags: aaron donat, Customizations, Dexterity, dynamics, featured, gp 2013, integration, security, Smartlist Builder, support debugging tool, web-client Â· Posted in: Blogs I Follow Total Views: 1,024