CEL and CDR data remove from disk


#1

Hi,
how to remove this data from db to reclaim hdd space?


#2

With a SQL sentence. The database you want to modify is asteriskcdrdb and the tables are cdr and cel. If you want to delete some records, use the DELETE sentence with a WHERE clause. If you want to remove all records, use the TRUNCATE sentence.


(Andreas Keller) #3

Hi,

SSH to the server.
mysql -p
(enter)
use asteriskcdrdb;
DELETE from cdr WHERE calldate < ‘2018-12-31 00:00:00’;

In the example above any CDR before 2019 will be deleted. Change the date to whatever date you would like to use.


(Tom Ray) #4

Actually that will deleted everything up Midnight of the 31st, which means there will be the CDRs for the 31st still in there. You need to do this as 2019-01-01 00:00:00 if you want to get everything before 2019 deleted.


(Andreas Keller) #5

:blush: right… but he should get the concept.


#6

Thanks!
I knew this command before, but now error has occurred:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘00:00:00’’ at line 1

Maria v. 5.5.60


#7

You need to use the to_date function, or whatever the equivalent to that is available on MariaDB


(system) closed #8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.