KNOWN ISSUE: How do I purge Audit Inventory data from the database?

Article:TECH41981  |  Created: 2009-04-29  |  Updated: 2014-09-04  |  Article URL http://www.symantec.com/docs/TECH41981
NOTE: If you are experiencing this particular known issue, we recommend that you Subscribe to receive email notification each time this article is updated. Subscribers will be the first to learn about any releases, status changes, workarounds or decisions made.
Article Type
Technical Solution


Issue



The Symantec Management Console does not provide a way to purge old Audit Inventory information. How do I remove old and unwanted data from the database?


Environment



SMP 7.0 MR4

SMP 7.1

SMP 7.5


Cause



The Inv_Audit table contains records of items or resources (computers, software, dataclasses, etc) that have been changed as well as the user that changed them, but not what was changed.  The Audit data for an item can be viewed by right clicking an item and selecting Properties, then selecting the Audit tab.  Purging Inv_Audit will only remove the data located on this tab.

Removal of this data will not impact the inventory process or any existing inventory data.


Solution



Applies to Symantec Management Platform 7.0.x

You can use a manual process to purge the unwanted data. The query shown below purges data from the Inv_Audit table. You can modify this query to suit your requirements, and then run it against the database to remove the appropriate data.

The example below removes all records that are older than a specified number of days (the current setting is 10 days). You can also modify this query to remove records based on resource type, or on the user ID of the user running the query.  

-- Identify the resources which are going to have some data purged.
select distinct _ResourceGuid
into #resources
from Inv_Audit 
where DateDiff(d, Inv_Audit.AuditDate, GETDATE()) > 10
 
declare @DataClassGuid uniqueidentifier
set @DataClassGuid = '57beb323-f925-4689-872f-1bf3aa3f7632'      
 
declare @Guid uniqueidentifier
declare cur_Guid CURSOR FOR
      select _ResourceGuid from #resources
 
-- Purge old data.
delete from Inv_Audit
where DateDiff(d, Inv_Audit.AuditDate, GETDATE()) > 10
and Inv_Audit._ResourceGuid in (select r._ResourceGuid from #resources r)
 
if(@@error = 0 AND @@rowcount > 0)
begin
    -- Ensure resource update summary and history are correct after the fact.
      open cur_Guid
      fetch next from cur_Guid into @Guid
      while @@FETCH_STATUS = 0
      begin
            exec spResourceUpdateSummary @Guid, null, @DataClassGuid
 
            exec spResourceGenerateHistorySnapshot @Guid, @DataClassGuid
           
            fetch next from cur_Guid into @Guid
      end
      close cur_Guid
      deallocate cur_Guid
end
drop table #resources

Purging data by age

The above query is set up to purge data that is older than 10 days old from the Inv_Audit table. If you want to specify a different number of days, change both instances of the number 10 to the appropriate number.

Purging data by resource type

If you want to purge data based on its resource type, replace both DateDiff(d, Inv_Audit.AuditDate, GETDATE()) > 10 expressions with the following:

Inv_Audit._ResourceGuid in (select Guid from ItemResourceType where ResourceType = ’<resourceTypeGuidGoesHere>’)

Purging data by user ID

If you want to purge data based on the user who is performing the action (for example, to remove all entries where the user is the service account), replace both DateDiff(d, Inv_Audit.AuditDate, GETDATE()) > 10 expressions with the following:

Inv_Audit.UserId = ’<UserNameGoesHere>’

Applies to Symantec Management Platform 7.1.x

The Symantec Management Platform 7.1 Sp1 and above (includes 7.5) includes a purge for the Inv_Audit table.

Stop the "Altiris Support Service"
Stop Altiris Server service and make a backup before modifying this file.

On SMP 7.1.x, edit the C:\ProgramData\Symantec\SMP\Settings\CoreSettings.config file.

Search for the value in coreSettings.config called AuditPurgeMaxAge which is -1 at the moment . In order to enable this functionality, a positive value LIKE 15 (number of days) should be assigned to the parameter.

After editing,
Start the "Altiris Service"
Start the "Altiris Client Message Dispatcher"
Start the "Altiris File Receiver"
Start the "Altiris Support Service"

 

By default this functionality is disabled. In order to make it enabled, there is a value in coreSettings.config called AuditPurgeMaxAge which is -1 at the moment . In order to enable this functionality, a positive value like 15 (number of days) should be assigned to the parameter. This value is the Number of days used to delete records which have AuditDate less than or equal to current date minus maxAge.

 


Supplemental Materials

SourceETrack
Value1630894
Description

Logged in Etrack (Symantec) database


Legacy ID



46872


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


Terms of use for this information are found in Legal Notices