Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20625

Re: Purge old configs from database based on the config type

$
0
0

Hi mezdem, I got Solarwinds tech update an my case and SQL queries to purge configs from database based on the config type. I thought you might find this helpful for your task.

Here is the email from the tech

_______________________________

We have the queries which should help you. You need to run all four of them, it is possible to do it one by one.

ATTENTION!
Before deploying them please make sure you have up to date FULL BACKUP of your database.

Instructions:
These queries are examples for Cisco EW-4506E devices, you need to modify the expression between apostrophes after "NodeCaption like " according to pattern which you can use to specify which devices' startup configs need to be deleted. NodeCaption in database means Name of the node in web console. If you want to use other criteria like IP address instead of Name, please let us know and we will modify the queries for you.
Also don't hesitate to contact us in case you are not sure or you just want our assistance. We can arrange remote session and do this together.

You can check that your device definition expression is correct by running following query:
SELECT TOP 1000 ca.ConfigID, ca.NodeID, ca.ConfigTitle, ca.DownloadTime, ca.ConfigType, nod.NodeCaption, nod.AgentIP FROM [dbo].[ConfigArchive] ca JOIN [dbo].[Nodes] nod ON ca.NodeID = nod.NodeID WHERE ca.NodeID <> '' AND ca.NodeID = nod.NodeID AND ca.ConfigType = 'Startup' AND nod.NodeCaption like '%4506%'


SQL queries for deleting startup configs:
1. delete from LatestComparisonResults where ConfigType = 'Startup' and NodeID in (select NodeID from Nodes where NodeCaption like '% 4506%')
2. delete from ConfigArchive where ConfigType='Startup' and NodeID in (select NodeID from Nodes where NodeCaption like '% 4506%')
3. delete from ComparisonCache where CacheID in (select CacheID from CacheDiffResults where ConfigType='Startup' and NodeID in (select NodeID from Nodes where NodeCaption like '% 4506%'))
4. delete from CacheDiffResults where ConfigType='Startup' and NodeID in (select NodeID from Nodes where NodeCaption like '% 4506%')


Please let me know if this helps or if you require further assistance.
________________________________________



Viewing all articles
Browse latest Browse all 20625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>