Frequently asked questions
Power Monitoring Expert 2021 - How can I delete a device and all of its data?
FAQ000235776
19 May 2022
Issue
A meter was installed into the Power Monitoring Expert (PME) system and has been logging data, waveforms, and events for any length of time. For whatever the reason, this meter's data is no longer required and it is desired that all traces of this meter be completely removed from the databases.
Product Line
Power Monitoring Expert 2021 (PME)
Environment
SQL Server Management Studio
ION Databases
Cause
A meter was added to the software but is no longer needed. Some reasons may include: data is no longer needed; spelling error; test meter data deletion; etc.
Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up prior to performing this procedure.*
1. Back up the following databases: ION_Network, ION_Data, ApplicationModules.
2. Stop the ION Log Inserter service. It will also be necessary to stop the Windows services related to the Application Modules features. From PME 7.2.x and PME 8, these services were re-branded and start with "ApplicationModules".
3. Open the Management Console and locate the device in the list. Take note of the full group.name of the device as this information will be needed later to configure a SQL script. NOTE: It is entirely possible the device is not in the Management Console. If this is the case, it is likely the full group.name is already known.
4. Delete the device from the Management Console. If the following prompt appears, select Cancel and then proceed to Step 5:
5. If there are logical devices associated with the device to be deleted, the logical devices must first be removed. Take note of each group.name of the logical devices as these will be possibly needed later to configure a SQL script. Once each of the logical devices has been deleted from the Management Console, repeat Step 4 with the original device.
6. Once all devices have been documented by group.name and deleted from the Management Console, the following SQL script must be configured to delete each device individually.
7. Download and run the "DeleteSource_BatchDeleteDataPME2020_V04" script in SSMS (no need to enter any device name), this will create a stored procedure "spDM_DeleteSourceAndBatchDeleteData" in ION_Data DB that batch deletes data at 2500 rows per batch and finally the device itself.
You may call this SP to delete the device as below -
USE [ION_Data]
GO
spDM_DeleteSourceAndBatchDeleteData 'GroupName.DeviceName'
GO
(Note: GroupName.Device name should be as per the 'Name' in the table [ION_Data].[dbo].[Source])