King0770-Notes-Mass-Account-Removal: Difference between revisions

No edit summary
No edit summary
Line 62: Line 62:
Faster  
Faster  


- Cons<vr>
- Cons<br>
Cumbersome
Cumbersome



Revision as of 18:00, 12 June 2019

This article details two methods of removing account in mass.

Method 1

Take the approach of running the 'zmprov -f suppression.cmd' command directly from the account's zimbraMailHost. That way, when the account is removed, the account blob & index data is removed as well; regaining back free disk space.

- Pros
Easy

Complete removal all account blob and index data, including removal of account data mysql data

- Cons
Process will be slow

If you have 400000 accounts to remove, you may need to take the measured approach of removing 100 accounts at a time from the zimbraMailHost.

zmprov sa zimbraMailHost=`zmhostname` | awk '{ print "da "$1 }' >> /tmp/accounts_removed

zmprov -v -f /tmp/accounts_removed >> /tmp/removedAccts.log

Method 2

Removal of account data from the ldap server; you may see something like this...

e.g.

zmprov da rick@lab.local
-l option is specified.  Only the LDAP entry of the account will be deleted.
DB data of the account and associated blobs will not be deleted.

Continue? [Y]es, [N]o: Y

The account data is removed from ldap, but the account blob and index data will need to be manually removed.

rm -rf /opt/zimbra/store/0/317/

rm -rf /opt/zimbra/index/0/317/

mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from appointment where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from appointment_dumpster  where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from data_source_item where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from imap_folder where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from imap_message where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from mail_item where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from mail_item_dumpster where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from open_conversation where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from pop3_message where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from purged_conversations where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from purged_messages where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from revision where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from revision_dumpster where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from tag where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from tagged_item where mailbox_id='317';"
mysql mboxgroup17 -e "SET FOREIGN_KEY_CHECKS=0;delete from tombstone where mailbox_id='317';"

- Pros
Faster

- Cons
Cumbersome

Manually removing account data will require complete understanding of how zimbra accounts are structured, see https://wiki.zimbra.com/wiki/Account_mailbox_database_structure


More articles written by me, https://wiki.zimbra.com/wiki/King0770-Notes

Jump to: navigation, search