article Manually trim performance data from a SQL Server DB

This article explains how to delete historical data from an up.time MS SQL DataStore. See related articles for MySQL and Oracle DataStores. The tables listed in the article are valid for up.time 7; although the logic applies to any release of up.time, you may receive errors for tables that do not exist. You may want to delete historical data if the up.time Archive process has timed out and data older than the Archive Policy still exists in the data store. You may also choose to manually delete historical data to free up the threads for regular monitoring that the up.time Archive process would occupy. For ease, a stored procedure that accomplishes the same as the statements below is available by contacting Support at [email protected].

 

The following commands will delete all performance data prior to a specified date:

  • Get the earliest sample ID for the specified day. All data samples collected prior to this day will be deleted. Replace DATE below with your target date in the format YYYY-MM-DD:

select min(id) from performance_sample where CONVERT(CHAR(10),sample_time,120) = 'DATE';

  • Use the ID from the previous command in place of ID in the following commands. It is strongly recommended that deletions be completed in small chunks (e.g. 2 weeks or 1 month at a time) rather than attempting one large delete statement.

delete from performance_aggregate where sample_id <ID; go;

delete from performance_cpu where sample_id <ID; go;

delete from performance_disk where sample_id <ID; go;

delete from performance_disk_total where sample_id <ID; go;

delete from performance_esx3_workload where sample_id <ID; go;

delete from performance_fscap where sample_id <ID; go;

delete from performance_network where sample_id <ID; go;

delete from performance_nrm where sample_id <ID; go;

delete from performance_psinfo where sample_id <ID; go;

delete from performance_lpar_workload where sample_id <ID; go;

delete from performance_vxvol where sample_id <ID; go;

delete from performance_who where sample_id <ID; go;

  • Get the earliest VMware sample ID for the specified day. All data samples collected prior to this day will be deleted. Replace DATE below with your target date in the format YYYY-MM-DD:

select min(id) from net_device_perf_sample where CONVERT(CHAR(10),sample_time,120) = 'DATE';

  • Use the ID from the previous command in place of ID in the following commands. It is strongly recommended that deletions be completed in small chunks (e.g. 2 weeks or 1 month at a time) rather than attempting one large delete statement.

delete from vmware_perf_aggregate where sample_id < ID; go;

delete from vmware_perf_cluster where sample_id < ID; go;

delete from vmware_perf_datastore_usage where sample_id < ID; go;

delete from vmware_perf_datastore_vm_usage where sample_id < ID; go;

delete from vmware_perf_disk_rate where sample_id < ID; go;

delete from vmware_perf_entitlement where sample_id < ID; go;

delete from vmware_perf_host_cpu where sample_id < ID; go;

delete from vmware_perf_host_disk_io where sample_id < ID; go;

delete from vmware_perf_host_disk_io_adv where sample_id < ID; go;

delete from vmware_perf_host_network where sample_id < ID; go;

delete from vmware_perf_host_power_state where sample_id < ID; go;

delete from vmware_perf_mem where sample_id < ID; go;

delete from vmware_perf_mem_advanced where sample_id < ID; go;

delete from vmware_perf_network_rate where sample_id < ID; go;

delete from vmware_perf_vm_cpu where sample_id < ID; go;

delete from vmware_perf_vm_disk_io where sample_id < ID; go;

delete from vmware_perf_vm_network where sample_id < ID; go;

delete from vmware_perf_vm_power_state where sample_id < ID; go;

delete from vmware_perf_vm_storage_usage where sample_id < ID; go;

delete from vmware_perf_vm_vcpu where sample_id < ID; go;

delete from vmware_perf_watts where sample_id < ID; go;

  • Get the earliest Network Device sample ID for the specified day. All data samples collected prior to this day will be deleted. Replace DATE below with your target date in the format YYYY-MM-DD:

select min(id) from net_device_perf_sample where CONVERT(CHAR(10),sample_time,120) = 'DATE';

  • Use the ID from the previous command in place of ID in the following commands. It is strongly recommended that deletions be completed in small chunks (e.g. 2 weeks or 1 month at a time) rather than attempting one large delete statement.

delete from net_device_perf_ping where sample_id < ID; go;

delete from net_device_perf_port where sample_id < ID; go;

  • Delete the retained date from before the specified date. All data samples collected prior to this day will be deleted. Replace DATE below with your target date in the format YYYY-MM-DD:

delete from erdc_decimal_data where CONVERT(CHAR(10),sample_time,120) = 'DATE'; go;

delete from erdc_int_data where CONVERT(CHAR(10),sample_time,120) = 'DATE'; go;

delete from erdc_string_data where CONVERT(CHAR(10),sample_time,120) = 'DATE'; go;

delete from ranged_object_value where CONVERT(CHAR(10),sample_time,120) = 'DATE'; go;

Related Articles


Manually trim performance data from an Oracle DataStore

RatingViews
article

WARNING: These commands are permanent. All deleted data will be lost. Ensure that you complete a full data backup before proceeding with these commands. The following commands will delete all...

By: uptime Support | Date Created: 6-24-2011 | Last Modified: 3-3-2013 | Index: 528

  2075

Manually trim performance data from a MySQL DataStore

RatingViews
article

The following commands will dump all performance data up until a specified date and delete the corresponding records. # cd /mysql/bin # ./mysql -uuptime -puptime -P3308 --protocol=tcp uptime_v4...

By: uptime Support | Date Created: 12-31-1969 | Last Modified: 3-1-2013 | Index: 281

  4864

SQL Server DataStore historical data purge script

RatingViews
article

This script will purge old data from your SQL Server DataStore

By: uptime Support | Date Created: 8-12-2010 | Last Modified: 6-8-2011 | Index: 476

  5134

Limited Performance Data Available

RatingViews
article

By: uptime Support | Date Created: 6-15-2006 | Last Modified: 1-16-2013 | Index: 082

  10314

Performance Monitor error: limited performance data available

RatingViews
article

This error is normally a result of the CPU time interval within the performance monitor being shorter than the data collection rate of the associated agents performance data collector. More...

By: uptime Support | Date Created: 12-31-1969 | Last Modified: 8-31-2011 | Index: 289

  5000

User Comments



No comments have been posted.

Copyright © 2021 IDERA, Inc.   Legal   Privacy Statement