The JSS keeps every recon for every computer. It only needs the last one. In large estates this can be GB’s of data and can slowdown or stop upgrades.
Heres how to clean the tables
###########
# flush reports, keep newest reports for each computer only
# count before
select count(*) from reports;
#make a new table with all the same columns
create table reports_new like reports;
#copy only the newest location_history for each computer
insert into reports_new select * from reports where report_id in (SELECT MAX(report_id) FROM reports GROUP BY computer_id);
#table switcheroo
rename table reports TO reports_old, reports_new TO reports;
# count after
select count(*) from reports;
#if all looks good
drop table reports_old;
###########
# flush applications, keep only newest report_id found in flushed reports
# count before
select count(*) from applications;
#make a new table with all the same columns
create table applications_new like applications;
#make new table from the remaining newest report_id
insert into applications_new select * from applications where report_id in (select report_id from reports);
#table switcheroo
rename table applications TO applications_old, applications_new TO applications;
#count after
select count(*) from applications;
#if all looks good
drop table applications_old;
# flush reports, keep newest reports for each computer only
# count before
select count(*) from reports;
#make a new table with all the same columns
create table reports_new like reports;
#copy only the newest location_history for each computer
insert into reports_new select * from reports where report_id in (SELECT MAX(report_id) FROM reports GROUP BY computer_id);
#table switcheroo
rename table reports TO reports_old, reports_new TO reports;
# count after
select count(*) from reports;
#if all looks good
drop table reports_old;
###########
# flush applications, keep only newest report_id found in flushed reports
# count before
select count(*) from applications;
#make a new table with all the same columns
create table applications_new like applications;
#make new table from the remaining newest report_id
insert into applications_new select * from applications where report_id in (select report_id from reports);
#table switcheroo
rename table applications TO applications_old, applications_new TO applications;
#count after
select count(*) from applications;
#if all looks good
drop table applications_old;
Clear Pending and Failed Commands
View and clear pending commands:
Before clearing or viewing, select the database:
use jamfsoftware;
To view Pending:
select count(*) from mobile_device_management_commands where apns_result_status !='Acknowledged';
To clear Pending codes:
delete from mobile_device_management_commands where apns_result_status !='Acknowledged';
View and clear failed commands:
To view Failed commands:
select count(*) from mobile_device_management_commands where apns_result_status !='Error';
To clear Failed codes:
delete from mobile_device_management_commands where apns_result_status !='Error';