Submit a ticketCall us

Putting Your Logs Where They Belong with the New SolarWinds Log Manager for Orion

The new SolarWinds® Log Manager for Orion® finally puts your log data right where it belongs, in the heart of your Orion console. Gain insight into the performance of your infrastructure by monitoring your logs in a unified console allowing you to see a wealth of information about the health and performance of your network and servers.

Reserve a Seat for Wednesday May 23rd 11am CDT | Reserve a Seat for Tuesday May 22nd 10:30am GMT | Reserve a Seat for Tuesday May 22nd 1pm SGT / 3pm AEST

Home > Success Center > VoIP & Network Quality Manager (VNQM) > Remove the VNQM database from the SQL server

Remove the VNQM database from the SQL server

Table of contents

Overview

This article describes how to fully clear out the VNQM database from the SQL server.

This query removes all VNQM data, tables, views, functions and procedures. Make sure you backup your database ahead of time in the event an incident occurs.

Environment

VNQM version 4.x

Steps

The query below removes the VNQM database and all it's components from your SQL server.

Run the following query directly from the SQL server using SQL Management Studio:

-- WARNING: BE CAREFUL USING THIS SCRIPT !!!
-- THIS SCRIPT REMOVES ALL Voip* TABLES FROM THE DATABASE. THIS CAUSES LOSE OF ALL VNQM DATA INLCUDING IPSLA SITES, IP SLA OPERATIONS, CALL MANAGERS AND STATISTICS !!!
DECLARE @table_object_id int
DECLARE @table_name varchar(max)
DECLARE @table_type varchar(max)
DECLARE @fk_name varchar(max)
DECLARE @fk_parent_name varchar(max)
DECLARE @stmt nvarchar(max)
DECLARE table_cursor CURSOR FAST_FORWARD FOR
SELECT o.object_id, o.name, o.[type]
FROM sys.objects o
JOIN sys.schemas s ON o.schema_id=s.schema_id
WHERE s.name='dbo' AND o.[type] IN ('U','V') AND o.name LIKE 'Voip%'
OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @table_object_id, @table_name, @table_type
WHILE @@FETCH_STATUS=0
BEGIN
    DECLARE fk_cursor CURSOR FAST_FORWARD FOR
    SELECT fk.name, parent.name
    FROM sys.foreign_keys fk
    JOIN sys.objects parent ON fk.parent_object_id=parent.object_id
    JOIN sys.schemas fk_s ON fk.schema_id=fk_s.schema_id
    JOIN sys.schemas parent_s ON parent.schema_id=parent_s.schema_id
    WHERE fk_s.name='dbo' AND parent_s.name='dbo' AND fk.referenced_object_id=@table_object_id
    OPEN fk_cursor
    FETCH NEXT FROM fk_cursor INTO @fk_name, @fk_parent_name
    WHILE @@FETCH_STATUS=0
    BEGIN
        
        SET @stmt = 'ALTER TABLE [dbo].['+@fk_parent_name+'] DROP CONSTRAINT ['+@fk_name+']'
        EXEC [dbo].sp_executesql @statement = @stmt
        FETCH NEXT FROM fk_cursor INTO @fk_name, @fk_parent_name
    END
    CLOSE fk_cursor
    DEALLOCATE fk_cursor
    SET @stmt = CASE @table_type WHEN 'V' THEN 'VIEW' ELSE 'TABLE' END
    SET @stmt = 'DROP '+@stmt+' [dbo].['+@table_name+']'
    EXEC [dbo].sp_executesql @statement = @stmt
    FETCH NEXT FROM table_cursor INTO @table_object_id, @table_name, @table_type
END
CLOSE table_cursor
DEALLOCATE table_cursor
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[GetVoipDbVersion]') AND xtype in (N'FN', N'IF', N'TF'))
    DROP FUNCTION [dbo].[GetVoipDbVersion]

 

 

 

Last modified

Tags

Classifications

Public