Product Line
ION Enterprise
StruxureWare Power Monitoring 7.0.x
Power Monitoring Expert 7.2.x
Power Monitoring Expert 8.x
Power Monitoring Expert 9.0
Power Monitoring Expert 2020
Power Monitoring Expert 2021
Power Monitoring Expert 2022
Power Monitoring Expert 2023
Environment
SQL Server Management Studio
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.*
The ION_Data and ION_SystemLog databases contain stored procedures called dbo.TrimRecords. These stored procedures can be executed manually using SQL Server Management Studio.
- In SQL Server Management Studio, expand either the ION_Data or ION_SystemLog database and go to Programmability > Stored Procedures.
- Right click on dbo.TrimRecords and select Execute Stored Procedure.
- In the Execute Procedure window, provide values for the following items:
ION_Data
@StartDate - use 'YYYY-MM-DD' format (Note: Keep single quotation marks around the date, e.g. to start trimming from January 31st, 2002, enter '2002-01-31')
@EndDate - use 'YYYY-MM-DD' format
@StartDate - use 'YYYY-MM-DD' format (Note: Keep single quotation marks around the date, e.g. to start trimming from January 31st, 2002, enter '2002-01-31')
@EndDate - use 'YYYY-MM-DD' format
Note: The trim job will trim data between the @StartDate and @EndDate. The @EndDate should be the more recent of the two dates.
@TrimDataLog - Set to 1 to trim Historical Data
@TrimWaveForm - Set to 1 to trim Waveforms
@TrimEvent - Set to 1 to trim Meter Events
@BatchDeleteNumber - Set to 2500 to optimize between overall duration versus avoiding lock escalation and exclusively locking DataLog2
@TrimWaveForm - Set to 1 to trim Waveforms
@TrimEvent - Set to 1 to trim Meter Events
@BatchDeleteNumber - Set to 2500 to optimize between overall duration versus avoiding lock escalation and exclusively locking DataLog2
Note: This option does not exist in older versions of the script
Below is an example that shows the values entered to trim the data from January 1st, 2016 until December 31st, 2022:
Below is an example that shows the values entered to trim the data from January 31st, 2002 until December 31st, 2010 with the older version of the script:
ION_SystemLog
@DaysToKeep - any records older than this number of days will be deleted
@Time - an optional setting that defaults to the current time and accepts hh:mm:ssformat to determine the time of day to trim to in local time
Below is an example that shows the values entered to trim the data from 30 days ago at 23:59:59:
- Once the parameters are set, click OK at the bottom of the window to begin the trim job.
- When the job has completed successfully, it will return a '0' in the query window.