Tampilkan postingan dengan label SQL Server. Tampilkan semua postingan
Tampilkan postingan dengan label SQL Server. Tampilkan semua postingan

Jumat, 29 Mei 2015

"A SQL Server login already exists for . Delete the user and create a new user" error when switching a user ID from web client only to mixed mode access

I'm completing the deployment of Microsoft Dynamics GP 2013 R2's Project Accounting and Time Entry approval workflow for a customer in Alabama who is currently deploying web client for extranet access (and timesheet entry) and desktop client for intranet access.

As a result, since time entry employees are remote, we decided to setup these user accounts as web client only. However, the customer wanted to provide an alternative to the web client in case it became unavailable. This meant that these users would needed the ability to access the Microsoft Dynamics GP desktop client via a Terminal Server provisioned (albeit temporarily) to support this goal.

The Problem

To meet this requirement, we needed to adjust the user accounts in Dynamics GP to also support SQL Server authentication (in addition to web client access), by deselecting the Web Client user only check mark and completing the SQL Login credentials information. Upon attempting to save the changes we received the following error:

A SQL Server login already exists for userID. Delete the user and create a new user.


As it so turns out with most application errors, you cannot just follow the instructions literally to fix the problem. In this case, we had more than 85 web client only user accounts created so "Delete the user and create a new user" wasn't an option and I don't know why I had a gut instinct this recommendation would not work anyways.

It also turns out that I tested this in Microsoft Dynamics GP 2015 and had no issues switching a user account from Web Client user only to a mixed mode access user account.

NOTE: "mixed mode access" user is a terminology I came up with to identify a Microsoft Dynamics GP user account with access capabilities from both the web client and desktop client.

The Solution

In troubleshooting this problem, the first thing is to focus on the first part of the error message, "A SQL Server login already exists". If a login already exists on SQL Server, then it should be visible under Management Studio - bear in mind that each Dynamics GP user account was setup as a web client only account to begin with. In principle, there should be no SQL Server security principal for these type of accounts.

Management Studio did not show any account created for the Dynamics GP under the Security folder. So the next logical thing would be to run a statement to check for a SID for the account in question:

SELECT suser_sid('TheUserID');

This statement returned an actual SID number (a long hexadecimal set of characters), confirming at least there was a corresponding SID for the account, even though we could not see the actual account in Management Studio.

Next was to verify then, what account was assigned to that SID. In order to do this, I ran the following SQL statement:

SELECT name FROM sys.server_principals where sid = (SELECT suser_sid('TheUserID'));

As it turned out, this statement returned no results. So here's the conundrum... GP thinks there's a SQL login for a user account that doesn't really exists on SQL, but has a SID.

Now, because there wasn't an actual SQL login for the user ID in question, I went ahead and setup a new SQL login with the user account by running the following statement:

sp_addlogin('TheUserID', 'somePassword');

The statement was successful and I could now see the SQL login under the security folder.

The next thing was to then reset the Dynamics GP web client user flag and assign the SQL login to the user account:

UPDATE SY01400 SET WCUser = 0,  SQLLoginID = 'TheUserID' WHERE USERID = 'TheUserID';

Since Microsoft Dynamics GP passwords are encrypted on SQL Server, you will now need to log into Dynamics GP, pull up the user account under the User Maintenance window, and change the password in the SQL login credentials section.

I cannot assess whether this is a bug or not, but suffice to say the same behavior is not present in GP 2015, so I must lean towards it being a bug.

I hope you find these troubleshooting steps useful.

Until next post!

MG.-
Mariano Gomez, MVP

Minggu, 24 Mei 2015

DBMS: 12 Microsoft Dynamics GP: 0 error when updating to Microsoft Dynamics GP 2013 R2

Hello all! It's been quite a while since I've actually written anything of remote interest to anyone who follows my blog, but at the same time, you will be pleased to know that I've been quite busy in the consulting front, with upgrades, server migrations, complex multi-instance postings involving 10's of thousands of transactions, wrapping up some Field Service Automation projects, and the list goes on and on.

This time around I want to bring to the forefront, an issue I encountered updating from Microsoft Dynamics GP 2013 SP2 to Microsoft Dynamics GP 2013 R2 plus the latest service pack.

Background

My client requested a server migration to a new environment where they wanted to deploy Dynamics GP 2013 R2 web client (plus the latest service pack) and upgrade their relational database management system to Microsoft SQL Server 2014. This is something I'm absolutely comfortable with (for the most part) given also that my client was sitting at Microsoft Dynamics GP 2013 with Service Pack 2.

As it is customary with these types of request involving a server migration, I followed the very clear instructions outlined in KB 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. I have walked through this article more times than I care to mention and can pretty much recite the steps by heart.

During the Dynamics GP Utilities process on the system database, I kept receiving the error message:

"Microsoft Dynamics Utilities Install/Upgrade failed"

This seemed to be a recurring problem on the sySrsReports table during the system database update. Upon further inspection, I noticed the temp table created for the sySrsReports (sySrsReport_T) was still present and that dropping this table would allow Dynamics GP Utilities to continue processing the system database update to completion.

However, the company database updates were failing with the following error messages:

"The stored procedure GetBD_UpgradeStatus() of form duSQL Pass Through SQL returned the following results: DBMS: 12, Microsoft Dynamics GP: 0."


Upon clicking the OK button, the following error message would appear:

"The stored procedure UpdateDB_Upgrade() of form duSQL Pass Through SQL returned the following result: DMBS: 12, Microsoft Dynamics GP: 0."


The above two errors would reiterate a few times (5 or 6 to be exact) to finally produce the following error:

"The stored procedure getCompanyID() of form duSQLInstall Pass Trough SQL returned the following results: DBMS: 12, Microsoft Dynamics GP: 0."


And would come to rest with the error described at first. Now, I've done myriads of upgrades in my lifetime, but this one put me on a cliff for a while. The DEXSQL.LOG clearly did not show anything specific and the duinstall.log just showed execution messages ("Message encountered" messages) happening where the problem occurred.

In all fairness, the DEXSQL.LOG kept showing a "[Microsoft][SQL Server Native Client 10.0]Communication link failure" error which lead me to check the version of SQL Server Native Client I was running, which was version 10. I then upgraded to SQL Server Native Client 11.0 and nothing really changed.

I also realized the update was failing while attempting to create the table auto procedures for the wkPostingValidationState table. I then drop this table and its auto procedures and restarted the update in the hopes it would recreate the objects once more, but was not successful.

Suffice to say, I restored the system database and company databases in order to devise a different strategy.

The Solution

After tinkering with the installation, I decided to retrace my steps and realized that during the installation process, I chose to install Web Client Runtime Engine - after all, this machine was the web server and would be running a Single Machine instance of Dynamics GP. I then decided to install the Dynamics GP client on the database server without the Web Client Runtime Engine and launch GP Utilities once more. The update process ran flawlessly and without any errors!

I still cannot understand why the presence of Web Client Runtime Engine would have caused an error while updating a service pack, however I have to remind everyone of the official Microsoft stance: "the session host must only be used to perform very little administrative work". An update is certainly everything but a "little administrative work".

It was good to finally get pass these issues and complete the update process for my client.

Please take a look at my GPUG webinar on upgrades at:


Mariano's Toolbox: Upgrading to Microsoft Dynamics GP 2015 for dummies 


Until next post!

MG.-
Mariano Gomez, MVP

Senin, 15 Desember 2014

Microsoft Dynamics GP backups with Windows Azure Blob Storage Service - Follow up

As a follow up to my post yesterday (see Microsoft Dynamics GP backups with Windows Azure Blob Storage Service), an issue has been identified with Microsoft Dynamics GP 2015 running on SQL Server 2014 when choosing Microsoft Azure storage as the destination for the backup.

You will receive the following warning message:

The SQL Server version that you are using does not support backing up or restoring your database from Microsoft Azure storage.



I have traced the issue back to the logic in the '(L) RGRestoreBackupOption' of window BackupRestore of form syBackupRestore field change script, which seems to compare the build number even after it has determined the version number is greater than SQL Server 2012 SP1 CU2 (11.0.3339). Of course, the build number for SQL Server 2014 CU4 is 12.0.2430. Since 2430 is not greater than 3339, the script sets the validation flag to false, causing the script to abort with the message indicated above.

This problem is exclusive to Microsoft Dynamics GP 2015 RTM (14.00.0524) running on SQL Server 2014, and cannot be replicated if you are running Microsoft Dynamics GP 2013 R2 or Microsoft Dynamics GP 2015 on SQL Server 2012 SP1 CU2 or greater. Microsoft is currently aware of this situation (at least via the Dynamics GP Online Partner Technical Community Forum), but if you are

For more information on SQL Server 2014 build numbers, see Microsoft Support kb article 2936603, SQL Server 2014 build versions.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

Minggu, 14 Desember 2014

Microsoft Dynamics GP backups with Windows Azure Blob Storage Service

With the introduction of Dynamics GP 2013 R2, Microsoft delivered support for application database backups onto Windows Azure blob storage service from within GP itself.

Azure Blob storage is a service for storing large amounts of unstructured data, such as text or binary data, that can be accessed from anywhere in the world via HTTP or HTTPS. You can use Blob storage to expose data publicly to the world, or to store application data privately. Common uses of Blob storage include:

• Serving images or documents directly to a browser
• Storing files for distributed access
• Streaming video and audio
• Performing secure backup and disaster recovery
• Storing data for analysis by an on-premises or Azure-hosted service

In turn, Dynamics GP takes advantage of capabilities introduced in SQL Server 2012 SP1 CU2 to enable SQL Server backup and restore directly to the Windows Azure Blob service. See SQL Server Backup and Restore with Windows Azure Blob Storage Service for more information.

Note: Starting with SQL Server 2012 SP1 CU4, you can also use PowerShell to backup to and restore from Windows Azure Blob storage services.

As part of the backup and restore process, Microsoft Dynamics GP calls the syGPAzureBackupRestoreProcess system database stored procedure.


Configuring Microsoft Dynamics GP backups with Windows Azure Blog storage service

To take advantage of Windows Azure Blob storage service, you must begin by setting up an Azure storage account. The storage account is the starting point for all storage services. The storage account requirements are fairly straight forward: setup a URL prefix, associate a location or affinity group for your storage account, and determine the type of replication. See How To Manage Storage Accounts for additional information on replication options.

Note: The full URL will be the URL prefix followed by blob.core.windows.net.

Storage Account Setup
Upon creation of the storage account, the storage account name and its access key properties are required to authenticate to the Windows Azure Blob Storage service and its components.

Following the creation of the account, you will need a storage container. A container provides a grouping of a set of Blobs, and can store an unlimited number of Blobs. To write a SQL Server backup to the Windows Azure Blob service, you must have at least the root container created.

Container tab

Click on the Containers tab to setup a new container. Enter a name for the container, and select the type of access that will be provided to the container.


New Container setup
For more information on setting container access types, see Restrict Access to Containers and Blobs. Once the container has been setup, you should see your new container listed.

Container is now setup

Return to the storage account dashboard and click the Manage Access Keys option at the bottom of the window for the storage account you setup. You can copy the primary access key, which will be used to setup Microsoft Dynamics GP.

Manage Access Keys

In Microsoft Dynamics GP, go to Microsoft Dynamics GP | Maintenance | Backup to open the Back Up Company window. Follow these instructions:

1. Select the company you wish to backup
2. Choose Use Microsoft Azure storage as the destination for your backup
3. Enter the storage account name you created in Windows Azure
4. Paste the access key from the previous section.
5. Enter the URL to the container. The URL format is as follows:

https://storage-account.blob.core.windows.net/container-name


Back Up Company

6. Click on Verify account to validate your account settings and connectivity to the container then click OK to continue. The backup performance will depend on your internet connection speed.

Now that you have a pretty good grasp on the configuration, you can begin taking advantage of Windows Azure as a secure, always available option for your Microsoft Dynamics GP data. The best part is, the data geo-redundantly stored (if this option was selected when creating the storage account) and you no longer need to rely on tapes being exposed to damage.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

Selasa, 19 Agustus 2014

Microsoft Dynamics GP 2013 R2 Installation: Utilities changes

When executing Dynamics Utilities for a brand new installation of Microsoft Dynamics GP 2013 R2 you may have noticed a new window in the guiding wizard. This window is the Web Client SQL Server Login window, which allows you to specify a common SQL account that will be created during the system database setup process.

Web Client SQL Server Login window

In GP 2013 R2, users accessing the web client exclusively no longer require a SQL account to access the underlying data in the system and company databases they have been assigned to. However, their Active Directory credentials must be associated to their Microsoft Dynamics GP account (stored in the Users Master table (SY01400). Access to data is afforded via a common SQL Server login once the Active Directory credentials and the Microsoft Dynamics GP user credentials have been validated. This provides users with a single sign-on experience from the web client.


User Setup

The above is described in more detail by Jason Lech, Escalation Engineer at Microsoft in his article on Identity Management.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.IntelligentPartnerships.com

Selasa, 10 Juni 2014

Using Microsoft Dynamics GP Business Intelligence deployment utility to deploy custom SSRS reports

Using Microsoft Dynamics GP Business Intelligence deployment utility to deploy custom SSRS reports

Using Microsoft Dynamics GP Business Intelligence deployment utility to deploy custom SSRS reports - Part 2

In the previous installment, I outlined a technique to deploy your custom SQL Reporting Services reports using the standard Business Intelligence deployment utility provided by Microsoft Dynamics GP (Administration | Setup | System | Reporting Tools Setup). In this installment, I will provide the scripts needed to update the Microsoft Dynamics GP system database tables, sySrsReports and sySrsReportDataSources, respectively.

-- Created by Mariano Gomez, MVP
-- This code is licensed under the Creative Commons
-- Attribution-NonCommercial-ShareAlike 3.0 Generic license.
declare @objectId uniqueidentifier;
declare @rptContent varbinary;
declare @reportName varchar(255);

-- custom report name information
set @reportName = 'Contract Deferred Revenue Detail Report';
select @rptContent = Content from ReportServer.dbo.Catalog where Name = @reportName;

-- setup a new GUID for the custom object
set @objectId = NEWID();

-- adds record for custom SRS report
insert into sySrsReports(ObjectID, LanguageID, DictionaryID, ObjectType, ObjectDescription, FolderName, DisplayName, TableName, CurrentVersion, MinSrsVersion, IsKpi, IsIsv, IsMultiCompany, IsCRM, IsConfigurationFile, BinaryBlob)
values(@objectId, 0, 0, 2, '', 'Sales', @reportName, 'MainTableNameHere', '12.00.1295', '10.5.1600', 0, 0, 0, 0, 0, @rptContent)

-- add data source information with the following DataSourceType and DataSourceID values
-- DataSourceType DataSourceID
---------------------------------------------
-- 1 DataSourceGPSystem
-- 2 DataSourceGPCompany
-- 3 Custom data source name
-- 4 DataSourceCRMOrganization

insert into sySrsReportDataSources(ObjectID, DataSourceType, DataSourceID, ModelID)
values (@objectId, 3, 'YourDataSourceName', 'Model_ID_Value');

A bit about the script...

The first step is to declare a couple variables that will host the report name and actual report definition language (rdl) content for the report. This information can be found in the dbo.Catalog table in the ReportServer database.

Next, we need to create a unique identifier (GUID) value for the report that we need to deploy. With this information, we can proceed to add the SRS report information to the sySrsReports table.

We can then add the data source information to the sySrsReportDataSources table. Keep in mind that there needs to be an entry for each data source listed.

That's it!

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.IntelligentPartnerships.com