Huntland Services Ltd

Tel: +44 (0)1392-490518
Fax: +44 (0)1392-428003
Enquiries@huntland.co.uk

Removing Unwanted Machine Entries

 

Back

Download This Article

 

Sometimes a machine entry can persist in the Monitor\All Computers node of the MOM Administrators Console even though the agent is no longer active.  To remove unwanted entries or if you need to delete all references to a machine in the database, follow this procedure:

Make sure the machine in question has had the MOM Agent deinstalled.

Make sure the machine is not accidentally still included in one of the Managed Computer  Rules.  This can be easily done where wild cards are being used to identify machines. e.g. deleting a rule "Computer Name = Server1" will have no effect if another rule uses "Computer Name matches wildcard Serv*".  By removing all rules which reference the machine, MOM should remove all references to the machine from the Monitor node.

If the machine persists, use the following SQL to delete all records for the machine in the database. Backup your database first.  Substitute the name of the machine where indicated:

Use OnePoint
Go
Declare @computerID uniqueidentifier
Set @computerID = (Select idComputer from Computer Where name = 'Put your machine name in here' AND domain = 'Put your Domain Name in here')

-- Events
Delete From EventParam 
WHERE idEvent IN (Select idEvent FROM Event WHERE idloggedon=@ComputerID)
Delete From EventConsolidated 
WHERE idEvent IN (Select idEvent FROM Event WHERE idLoggedOn=@ComputerID)
Delete From Event 
WHERE idGeneratedBy = @computerID

-- Alerts
Delete From alertEventSuppression 
WHERE idAlert IN (Select idAlert FROM alert WHERE idComputer=@ComputerID)
Delete From AlertHistory 
WHERE idAlert IN (Select idAlert FROM alert WHERE idComputer=@ComputerID)
Delete From alert 
WHERE idComputer=@ComputerID

-- Perf Data

Delete From SampledNumericData 
WHERE idSampledNumericDataSource IN 
(Select idSampledNumericDataSource From SampledNumericDataSource where idComputer = @computerID)
Delete From SampledNumericDataSource 
WHERE idComputer = @computerID

--DasServer
Delete From dasservers 
WHERE name IN (Select name FROM Computer WHERE idComputer=@computerId)

-- Computer
Delete From computerattribute 
WHERE idComputer=@ComputerID
Delete From ComputerResponsibility 
WHERE idConfigManager=@ComputerID
Delete From ComputerToComputerRule 
WHERE idCOmputer=@ComputerID
Delete From Configuration 
WHERE idComputer=@ComputerID
Delete From computer 
WHERE idComputer = @computerID