How to compress Derby?
After a while, Derby disk space has to be returned to the operating system.
Even if the purge operation is properly done, Derby does not release disk space to the operating system.
To achieve that, Derby database has to be compressed.
Steps are:
Run 'ustat' to check if the WCC are up and running:
CA Services Status Report
Component Name Pid Status
------------------------------------ ------- --------------
CA-wcc-services Server 29036 running
CA-wcc-db Server 28960 running
CA-wcc Server 29178 running
Then stop all of them with:
unisrvcntr stop CA-wcc
unisrvcntr stop CA-wcc-services
unisrvcntr stop CA-wcc-db
Save Derby database with a tar command:
cd /opt/CA/WorkloadCC/derby
tar cvf /tmp/DB_FILES.tar ./DB_FILES/*
Copy attached file "derby_compress_.table" to /opt/CA/WorkloadCC/derby/lib and ensure OS owner/group and permissions are same as the other files
If you don't have write access to /opt/CA/WorkloadCC/derby/lib, you can copy it somewhere else.
Increase Derby memory in file /opt/CA/WorkloadCC/derby/conf/wrapper.conf
# Java Application
wrapper.java.command=../../jre/bin/java
#wrapper.java.initmemory=64
wrapper.java.initmemory=1024
#wrapper.java.maxmemory=512
wrapper.java.maxmemory=3072
(Later on you can keep these values to improve Derby performances)
To get the current size of the derby database, you can run:
du -sk /opt/CA/WorkloadCC/derby/DB_FILES/WCC_MAIN/seg0
Start Derby with:
unisrvcntr start CA-wcc-db
Executed CA-wcc-db start.........................................OK
cd /opt/CA/WorkloadCC/derby/lib
java -jar derbyrun.jar ij
ij version 10.8
ij> connect 'jdbc:derby://localhost:1527/WCC_MAIN' user 'wcc' password 'wcc';
Indeed if wcc is not the password, you'll have to replace it by yours
When logged on in derby, run this command to get the list of derby tables
To check if Derby responds properly, run
ij> show tables;
Then run the procedure with
run '/opt/CA/WorkloadCC/derby/lib/derby_compress.table';
It might be possible to get errors with tables 'ECLI_HISTORY' and ''WCC.ECLI_SAVED_COMMAND' because they don't exist if you never ran ECLI commands in WCC
To exit Derby, type quit;
Check new disk space with:
du -sk /opt/CA/WorkloadCC/derby/DB_FILES/WCC_MAIN/seg0
And finally start the 2 other WCC services with:
unisrvcntr start CA-wcc
unisrvcntr start CA-wcc-services
If for whatever reason there is a problem during this compress operation, rename ' /opt/CA/WorkloadCC/derby/DB_FILES ' and restore the tar file taken at the beginning of this procedure.