ลบ Log ในฐาน Hosxp

posted on 12 Nov 2015 11:23 by tahwan

  ลบตาราง log (ใช้เมื่อจำเป็นจริงๆ เก็บไว้ 1 ปีน่าจะพอนะ เผื่อต้องการเพิ่มพื่้นที่ของ Hardisk)

มีขั้นตอนดังนี้

Tools --> SQL Query --> Copy คำสั่งทีละคำสั่ง --> Execute -->OK

 

DELETE FROM vn_stat_log WHERE log_datetime < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE vn_stat_log;
DELETE FROM replicate_log WHERE event_time < DATE_ADD(NOW(), INTERVAL -365 DAY);
OPTIMIZE TABLE replicate_log;
DELETE FROM ksklog WHERE logtime < DATE_ADD(NOW(), INTERVAL -1 YEAR) or modifytype ='fail' ;
OPTIMIZE TABLE ksklog;
DELETE FROM opitemrece_log WHERE event_date_time < DATE_ADD(NOW(), INTERVAL -2 YEAR) ;
OPTIMIZE TABLE opitemrece_log;
DELETE FROM patient_log WHERE log_datetime < DATE_ADD(NOW(), INTERVAL -1 YEAR) ;
OPTIMIZE TABLE patient_log;
DELETE FROM lab_entry_log WHERE log_date_time < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE lab_entry_log;
DELETE FROM opitemrece_finance_log WHERE log_datetime < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE opitemrece_finance_log;
DELETE FROM report_access_log WHERE access_date_time < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE report_access_log;
DELETE FROM patient_emr_log WHERE access_datetime < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE patient_emr_log;
DELETE FROM rx_operator_log WHERE log_datetime < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE rx_operator_log;
DELETE FROM pttype_log WHERE change_date_time < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE pttype_log;
DELETE FROM lab_access_log WHERE log_date_time < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE lab_access_log;
DELETE FROM hosxp_chat_log WHERE chat_time < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE hosxp_chat_log;
DELETE FROM ipt_cancel_log WHERE cancel_datetime < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE ipt_cancel_log;
DELETE FROM ipt_chart_location_log WHERE log_datetime < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE ipt_chart_location_log;
DELETE FROM system_backup_log WHERE backup_datetime < DATE_ADD(NOW(), INTERVAL -1 YEAR);
OPTIMIZE TABLE system_backup_log;
DELETE FROM ipt_diagnosis_log WHERE ipt_diagnosis_log_date < DATE_ADD(CURDATE(), INTERVAL -1 YEAR);
OPTIMIZE TABLE ipt_diagnosis_log;
DELETE FROM opdcard_print_log WHERE print_date < DATE_ADD(CURDATE(), INTERVAL -1 YEAR);
OPTIMIZE TABLE opdcard_print_log;

 

Comment

Comment:

Tweet