Would someone know the linux command to delete all the cdr records?
I do have access to Linux using putty and nnsupport account.
Backing up these Bcm's takes longer and longer since we can't uncheck the call detail recording when doing a backup...
Once you have logged into the BCM via SSH, Do the following
"su" and then the root password
"cd /var/nn/CDRDataFiles"
"ls -al"
"ls *.2029* | xargs rm -rf"
The last command deletes all records for the year 2029. Just press the arrow up key and change the year and press enter again.
Repeat the task to delete all the years of CDR data that you don't need.
Remember to remove the " when copying the lines of data and the "ls -al" command can be run again at any time whilst in SSH to check what data is still present in that folder. You might want to do a full BCM backup prior to making the changes so that all the CDR data is saved within the backup as it can be restored if needed at a later date.
Once you have done the deletions, do a full backup and the backup size will be much smaller.
If you use the ZOC tool as I prefer this to PuTTY, then I have attached a script that might help.
There were over 172200 entries in my BCM system. The last 4 years were my CDR data from when I first installed the system. My BCM system originally had those from the previous customer’s calling history! The same might also be with your database. Unix can't delete them with the normal utility as they are too numerate.
Let's say you have files from 2009? or 2010 you want to wipe? Unix is your friend. Because I only have recent logs now, my examples are for 2013, but just change the date for your scenario.
If you want to look for only the 2013 logs, then enter:
ls -al *.2013* <cr>
You will get a complete list for 2013. Try substituting the 2013 for 2009 etc. If you get a HUGE list, let's count them by using the command
ls -al *.2009* | wc -l <cr>
1080 <-- you'll get a little number after a few seconds. "wc" is
"Word count" and "-l" means count lines. The "|" means it’s the 'pipe' the output of the first command to the next. This is a clever command to know? That's what makes Unix handy for complex tasks. Do not mix the pipe | up with a capital I or small letter-L. This is the vertical line, near a back-slash on a British keyboard.
Now, if you want to wipe those old darned logs? If they are large in number, the normal delete command "rm" won't do it. It barfs on the amount of input data. So, there's another way, piping the listing to another utility which does what it's told for everything piped to it.
As in the above scenario, let's wipe out the 2009 (or whatever) logs. ENSURE you are in the correct directory: pwd <cr>
/var/nn/CDRDataFiles <-- OK, if we didn't move around, then it’s safe to begin the deletions.
We remove the target files by selecting certain ones, and pushing them to a command to do it: The below will remove all files from the year 2009:
ls *.2009* | xargs rm -rf <cr>
It will take a few seconds.
Check to see if they're gone:
ls *.2009* <cr> <-- and you should get nothing back.
[root@DraytonBCM50V2 CDRDataFiles]# ls *.2009*
ls: *.2009*: No such file or directory
I used the rm command on my own system and found you need to use the -f option to force delete the files. Otherwise it asks for confirmation on every file. So I ran the following commands after making /var/nn/CDRDataFiles the working directory to delete all CDR records from all years other than 2018;
rm -f *.2015*
rm -f *.2016*
rm -f *.2017*
Now when I enter the ls command it only shows records for the year 2018.
I ran a backup before and after deleting the CDR records. After deleting the years 2015-2017 my backup size went from 5.99mb to 2.65mb. I am still able to see CDR records using the CDR utility, so it looks like all is working as it should.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.