Auto-generate for the next sequence number for a System Number value for a computer fails to work

Article:TECH164120  |  Created: 2011-07-07  |  Updated: 2014-06-03  |  Article URL http://www.symantec.com/docs/TECH164120
Article Type
Technical Solution


Issue



When creating a new computer, the System Number value does not auto-generate to the next expected sequence value. However, when the Auto-Generate button is used, the correct value then is generated. Note: This issue affects any resource that uses an Auto-Generate field (denoted by a yellow "*" button), such as Computers, Purchase Orders, etc.


Environment



Any CMDB Solution version.


Cause



The CMDB default value for the field has been manually saved with a specific number and/or the mask for it has been manually changed. This causes this number to always be used instead of the next number in the sequence. This can occur if a user has viewed the resource in CMDB Default Values and then saved it (which saves the auto-generated number upon opening the edit window for the resource) or changed the value manually and then saved it, or if the user has added a mask or datamask to the data class.


Solution



Remove the default value for the affected field so that it is blank. This restores the auto-generate ability for the field, enabling it to use the next number in the sequence. In some cases, the data class for the affected field may have been modified by the user. Changing its Mask, Start number or Datamask may result in this issue or similar problems of having the auto-generate field work correctly. Verify that the default values are present for the affected data class to ensure that these are not an issue.

Depending on the CMDB Solution version, different workarounds and solutions are available. Refer to the appropriate section below for the specific version.

For CMDB Solution 7.1 SP2/7.5 (non-SP1)

These two CMDB Solution versions have a defect that prevents the below workarounds from other sections from working. This issue is resolved in CMDB Solution 7.5 SP1. To resolve this issue in CMDB Solution versions 7.1 SP2/7.5 (non-SP1), the Item table record for the CMDB Defaults must be reset for its System Number value (or which ever field is the issue, such as from Monitors, etc.), then IIS reset. Note: If the user re-saves any default values in the future, they will need to re-apply this SQL solution, as re-saving overwrites the database record each time. This should therefore be avoided, as this function is not working correctly, as noted here.
 

  1. Run the following query:

    USE Symantec_CMDB
    SELECT State
    FROM Item
    WHERE Guid = '8A163EC6-5C54-42F8-93B6-40A5A638C9ED'
    -- Review the State column, it may be easiest to copy and paste this into Notepad, for the value of what "System Number" is, for example, "Comput000010". Note: This field is difficult to read all of the text directly in SQL, and so this is why it may be easier to just copy
    -- and paste it's value directly into Notepad, or into a new query window, to more easily review. Then, use this value in the SET statement, below, to replace with a blank ''.

    UPDATE Item
    SET State = (SELECT REPLACE (CAST (STATE AS NVARCHAR (MAX)), 'Comput<number>', '')) -- Where "<number>" is the number sequence to replace.
    FROM Item
    WHERE Guid = '8A163EC6-5C54-42F8-93B6-40A5A638C9ED'

    For example:

    UPDATE Item
    SET State = (SELECT REPLACE (CAST (STATE AS NVARCHAR (MAX)), 'Comput000010', '')) -- Where "Comput000010" is the listed system number from Step 1.
    FROM Item
    WHERE Guid = '8A163EC6-5C54-42F8-93B6-40A5A638C9ED'
     
  2. Verify that the value in the AeXNSAssetTagCounter table for the first record is the current System Number to use. This is not the next number it will be, but the last System Number used.  If not, update this using the following script:

    UPDATE AeXNSAssetTagCounter
    SET AssetTagCounter = <number> -- Where "<number>" is the seed number to change.
    WHERE AssetTagMask = ''
    SELECT *
    FROM AeXNSAssetTagCounter

    For example:

    UPDATE AeXNSAssetTagCounter
    SET AssetTagCounter = 50 -- Where "50" is the seed number. This is then going to be "Comput000051" once a new computer is created.
    WHERE AssetTagMask = ''
    SELECT *
    FROM AeXNSAssetTagCounter
     
  3. On the Symantec Management Platform Server, reset IIS.
  4. Open a new browser and access the Symantec Management Platform (after IIS has finished resetting, otherwise errors will occur while it cycles), then create a new computer. The correct new System Number is then used.


For Symantec Management Platform 7.0/7.1 (pre-SP1)/7.5 (non-SP1)

  1. In the Symantec Management Platform Console, click on the Settings button > All Settings.
  2. Expand Service and Asset Management.
  3. Expand CMDB Solution.
  4. Click on Default Values.
  5. Click on the affected resource type, such as Computer or Purchase Order.
  6. Remove any value in the auto-generate field, such as System Number for Computer or Purchase Order Number for Purchase Order.
  7. Click on the OK button to save changes.

    If the above steps fail to resolve the issue, continue with step 8.
     
  8. In the Symantec Management Platform Console, click on the Settings button > All Settings.
  9. Expand Service and Asset Management.
  10. Expand Resource and Data Class Settings.
  11. Expand Data Classes.
  12. Locate the data class type and click on it. For example, for a computer's system number, this is found under the CMDB Data Classes > Identity data class.
  13. Click the pencil button for the affected data class to edit it.
  14. Verify that the Mask is blank, the Start number is 0 and that the Datamask is also blank.
  15. Click on the OK button to save changes.


For Notification Server 6.0

  1. In the Altiris Console 6.5, click on the View > Configuration menu. Or if using the Altiris Console 6.0, click on the Configuration tab.
  2. Expand Solution Settings.
  3. Expand CMDB Solution.
  4. Click on Default Values.
  5. Click on the affected resource type, such as Computer or Purchase Order.
  6. Remove any value in the auto-generate field, such as System Number for Computer or Purchase Order Number for Purchase Order.
  7. Click on the OK button to save changes.

    If the above steps fail to resolve the issue, continue with step 8.
     
  8. In the Altiris Console 6.5, click on the View > Configuration menu. Or if using the Altiris Console 6.0, click on the Configuration tab.
  9. Expand Resource Settings.
  10. Expand Data Classes.
  11. Locate the data class type and click on it. For example, for a computer's system number, this is found under the CMDB Data Classes > Identity data class.
  12. Click the pencil button for the affected data class to edit it.
  13. Verify that the Mask is blank, the Start number is 0 and that the Datamask is also blank.
  14. Click on the OK button to save changes.


SQL Troubleshooting


 In SQL, information regarding the auto-generate next sequence number can be found by running the following query:

USE Symantec_CMDB -- For Notification Server 6, substitute this line with "USE Altiris".
SELECT *
FROM AeXNSAssetTagCounter

This will return results that look something like the following:

Figure 1: Example SQL query showing auto-generate sequence numbers


The AssetTagCounter field is the value of the next number in the sequence. For example, in Figure 1, the POrder00000000 (Purchase Orders) value for it next number in the sequence is 1. The expectation is then that when a new Purchase Order is created, its Purchase Order Number will then be "POrder00000002". If the script is ran again, the AssetTagCounter will then be 2 for POrder00000000. Note: This equals the eight digits of zero for the AssetTagMask "00000000" plus the AssetTagCounter "1", which still results in an eight-digit number.

If the numbers listed here are incorrect, use a SQL script to manually modify them to their correct expected values. For example, if the AssetTagCounter should be 50 for the Purchase Order field, meaning, the next Purchase Order created will be POrder00000051, then use the following example script to modify this:

USE Symantec_CMDB
UPDATE AeXNSAssetTagCounter
SET AssetTagCounter = 50
WHERE AssetTagMask = 'POrder00000000'
SELECT *
FROM AeXNSAssetTagCounter

This will modify the AssetTagCounter line, then run a SELECT query to show the results.

To change the System Number, this is the first column, which has a blank AssetTagMask. The number 838 designates this, and therefore the next System Number to generate would be xxxx839 (depending on the resource). For example, "Comput0000839". The following example script can be used to change this to a different number in the sequence:

USE Symantec_CMDB
UPDATE AeXNSAssetTagCounter
SET AssetTagCounter = 100
WHERE AssetTagMask = ''
SELECT *
FROM AeXNSAssetTagCounter




Article URL http://www.symantec.com/docs/TECH164120


Terms of use for this information are found in Legal Notices