dcsimg

How do I remove extra host IDs from an MS SQL database?

Products

Webtrends Analytics 8.5
Webtrends Analytics 8.7
Webtrends Analytics 9.x

Cause

Extra HostIDs exist in the Webtrends system database for hosts no longer in use or which no longer exist.

Resolution

Remove references to the old hosts by running queries against the database to delete rows that pertain to the offending HostIDs.

1. Stop the Webtrends services. For more information, refer toOrder to stop and start the Webtrends services by version

2. Back up the system database using Microsoft SQL Server Management Studio. Management Studio Express for SQL Server 2005 is available from the following URL:

http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&displaylang=en

For installations using SQL Server 2008+, download and install SQL Server Management Studio from the following URL:

http://www.microsoft.com/web/gallery/install.aspx?appsxml=www.microsoft.com%2Fweb%2Fwebpi%2F2.0%2FWebProductList.xml%3Bwww.microsoft.com%2Fweb%2Fwebpi%2F2.0%2FWebProductList.xml&appid=134%3B135

3. After installing SQL Management Studio, back up the wtMaster and wt_sched databases. Refer to one of the following KB articles depending on the version of SQL Server used:
How do I perform a manual system backup on a Webtrends installation which uses MS SQL Server 2005?
How do I perform a manual system backup on a Webtrends installation which uses MS SQL Server 2008?

4. Using SQL Management Studio, execute the following queries, replacing in each line with the name of the host to be removed:
DELETE FROM wt_sched.dbo.wt_capability WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_pollrate WHERE ComponentInstallationID IN (select ComponentInstallationID from wt_sched.dbo.wt_componentinstallation WHERE HostID = ”);
DELETE FROM wt_sched.dbo.wt_componentinstallation WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_hostmetricconfiguration WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_hostgroupmember WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_hostmetrichistory WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_hostservicerole WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_hostsetting WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_lock WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_TaskStatus;
DELETE FROM wt_sched.dbo.wt_TaskChronicle;
DELETE FROM wt_sched.dbo.wt_HostStatus;
DELETE FROM wt_sched.dbo.wt_Monitoralertresolvehistory;
DELETE FROM wt_sched.dbo.wt_MonitorResultAction;
DELETE FROM wt_sched.dbo.wt_MonitorResult;
DELETE FROM wt_sched.dbo.wt_ServiceStatus;
DELETE FROM wt_sched.dbo.wt_ComponentStatus WHERE HostID = ”;
DELETE FROM wt_sched.dbo.wt_eventstatus;
DELETE FROM wt_sched.dbo.wt_processrecord WHERE hostid = ”;
DELETE FROM wt_sched.dbo.wt_host WHERE hostid = ”;

5. Close Management Studio and start the Webtrends services.