Violation of PRIMARY KEY constraint 'PK_#ExceptionGuids__<part of guid>'
search cancel

Violation of PRIMARY KEY constraint 'PK_#ExceptionGuids__<part of guid>'

book

Article ID: 176891

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

Any attempt to assign a software delivery package to replicate to specific Package Servers only, as seen in the screenshot below, would result in a successful rendering of Page 1, but as soon as Page 2 or "All" was selected to display, the page fails to load and the following is logged in the NS log file:

 First select "Package Servers Individually"

Second: The grid will now load and display the first 10 Package Servers available (no screenshot). Clicking on Page 2 or "All" in the display to show Package Server 11 - 20 causes the following error to be displayed:

 

At the time this error is displayed, the following is the cooresponding entry in the Notification Server Log File:

Notification Server Log FileName: C:\Program Files\Altiris\Notification Server\Logs\a.log

Priority: 1

Date: 03/25/2009 3:21:38 PM

Tick Count: 907310281

Host Name: SERVERNAME

Process: w3wp.exe (8476)

Thread ID: 9076

Module: AltirisNativeHelper.dll

Source: Altiris.NS.UI.Controls.PkgSvrSelectionCtrl.BindGrid

Description: Unable to bind the grid to the GUIDs of the selected sites or package servers for PkgSvrSelectionCtrl ( Unhandled exception.  Type=System.Data.SqlClient.SqlException Msg=Violation of PRIMARY KEY constraint 'PK__#ExceptionGuids___38DD2856'. Cannot insert duplicate key in object 'dbo.#ExceptionGuids'.

The statement has been terminated. Src=.Net SqlClient Data Provider

StackTrace=

   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)

   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

   at Altiris.NS.UI.Controls.PkgSvrSelectionCtrl.GetAssignmentTable(PkgSvrAssignmentType method)

   at Altiris.NS.UI.Controls.PkgSvrSelectionCtrl.BindGrid() )

Cause

To display the grid that lists the available Package Servers, Notification Server does a lookup against the known package servers and attempts to write that list to a temporary SQL table named #ExceptionGUIDS. The temporary table is built using a no duplicate key. In this case, duplicate Package Servers were attempting to be written to the temporary table and causing the error message.

Resolution

The solution is to identify the Package Server that is attempting to be duplicated in the #ExceptionsGUIDs list then remove the offending Package Server from the Package Servers list. There are two options to determine this, Option 1 is to run the SQL statement in SQL Management Studio used by the stored procedure, Option 2, is to run Altiris Profiler to capture the data.

Option 1: Identify the Package GUID and then run a SQL query to find the duplicates.

  1. On the NS Server open the Altiris 6.5 console and choose View > Resources
  2. Expand Software Management > Software Delivery Packages > Windows
  3. On the right-hand window, find the Software Delivery Package where the problem is occuring.
  4. Right-click on the package and choose Properties.
  5. On the General tab, copy the GUID for the package.
  6. Replace the GUID highlighted in red below, with the one you just copied and run this query in SQL Query Analyzer. This query will give you the list of the duplicated package servers to use in the next step.

    SELECT vComputerResource.Guid, Inv_AeX_AC_Identification.[Name],Count(*)
    FROM CollectionMembership
    INNER JOIN vComputerResource ON CollectionMembership.ResourceGuid = vComputerResource.Guid
    AND CollectionMembership.CollectionGuid = '4C31E964-D085-42D8-BFB0-D439B4C61E47'
    INNER JOIN Inv_AeX_AC_Identification ON vComputerResource.Guid = Inv_AeX_AC_Identification._ResourceGuid
    LEFT JOIN SWDPackageServer ON vComputerResource.Guid = SWDPackageServer.PkgSvrId
    AND SWDPackageServer.PackageId = '<INSERT PACKAGE GUID HERE>'
    group by vComputerResource.Guid, Inv_AeX_AC_Identification.[Name] having count(*) > 1 ORDER BY Inv_AeX_AC_Identification.[Name]

  7. Back in the Notification Server 6.5 console, click on Configure > Package Servers > Package Server Setup. This will bring you to the Status tab of the Package Servers.
  8. Find the Package Server that is being duplicated.
  9. Highlight it by single-clicking it, then click the X button to delete it from the list. It is very important that you now choose the Apply button at the bottom of this menu. Equally important - after the configuration has been applied, click on the Refresh button next to the X so that this grid is redrawn.
  10. Repeat steps 7, 8 and 9 until all of the Package Servers listed in the SQL query have been removed.
  11. Repeat Steps 1 through 3 and attempt to re-create the problem. If the page is now loading properly, go back to the Notification Server, and add the Package Server(s) back to the list of available package servers.

Note: It is recommended to add the Package Servers one at a time in the event there are additional problems with a specific Package Server. In a few instances, it was necessary to uninstall all components of the Altiris NS Agent from the Package Server before being able to successfully re-add it. If the previous steps did not correct the issue proceed to Option 2 to use Profiler.

     

    Option 2: Use Altiris Profiler to find the GUID of the offending Package Server:

    1. Connect to the Notification Server using Microsoft Remote Desktop as Terminal Server session 0. For mstsc.exe version 6.0.6001 or higher the command line is "mstsc.exe /admin". For mstsc.exe version 6.0.6000 or older, use "mstsc.exe /console"
    2. Open the Software Delivery Package for editing. NS Console > Resources Tab > Resource Management > Resources > Software Management > Software Delivery > Windows
    3. Double-click on the package you wish to change.
    4. Click on the Advanced Tab and keep this window open.
    5. From the Windows Start Menu, launch Altiris Profiler. Start > All Programs > Altiris > Diagnostics > Altiris Profiler
    6. If prompted to restart the NS Services and IIS, choose Yes.
    7. Cancel the Profiler Wizard
    8. In Altiris Profiler, under the Profiling menu, choose "Clear Trace" > "Clear Trace" in order to clear out any previous traces that have been performed
    9. Choose Options > SQL Filters > and check the first box "Only log SQL data that contains the following text" to read: #ExceptionGUID as illustrated in the screenshot below and click OK to save the filter:
    10. Begin profiling by clicking on either the Green Play symbol next to the sign icon, or selecting the Profiling menu and choosing Profiling > Start Profiling > Start Profiling
    11. Switch over to the open Software Delivery Package Window
    12. Under the "Selected Package Server" section of the screen, atempt to load Page 2 and the error will be recreated.
    13. From the error message, click "Show Details" Important - DO NOT CLOSE THIS WINDOW as it might be necessary to repeat this process multiple times.
    14. Now switch back to Altiris Profiler and stop the trace by clicking on the Red Stop square next to the Play button, or by choosing the Profiling menu and clicking Profiling > Stop Profiling
    15. Click on the "Code Trace" tab in Altiris Profiler and scroll all the way down to the bottom and you will see multiple "insert into #ExceptionGUID but the very last entry will be a red line. Reading the last two lines, you'll find the GUID and/or name of the Package Server in question. Make a note of the name of the Package Server.
    16. Back in the Notification Server 6.5 console, click on Configure > Package Servers > Package Server Setup. This will bring you to the Status tab of the Package Servers.
    17. Find the Package Server that is being duplicated. Highlight it by single-clicking it, then click the X button to delete it from the list. It is very important that you now choose the Apply button at the bottom of this menu. Equally important - after the configuration has been applied, click on the Refresh button next to the X so that this grid is redrawn.
    18. Now flip back to the open package window that is displaying the error message. From Internet Explorer's menu, refresh the page and the entire package page should reload. Click on the Advanced Tab and attempt to go to page 2 again. If this works, you have corrected the problem. If the problem continues, repeat the entire process to find the next package server. Note that in one instance there were 5 package servers that were causing the issue so this process had to be repeated 5 times. Do not continue to the next step until you have identified all of the offending Package Servers.
    19. If the page is now loading properly, go back to the Notification Server, and add the Package Server back to the list of available package servers.
    20. If the problem continues at this point, remove the server from the list of available package servers, and now fix the problem on the package server. You might have a duplicate GUID that is causing this problem. In this case, uninstall the Package Server agent and all NS Agent components from the Package Server. Back on the NS server, delete the computer record from the "All Computers" collection. Upon reinstallation of the NS agent on the Package Server, the NS will see this server as a new resource and now assign a new GUID to the computer.
    21. If the problems persists contact Symantec Technical Support.

    Applies To
    Notification Server 6.0 SP3 R9 and later.

    Attachments