Diese Sammlung von Befehlen und allgemeinem Wissen kann für alle nützlich sein.

Kopano Datenbank Struktur / Aufbau

TabellennameGrösseBeschreibung
abchanges
acl
changes
defferdupdate
hierarchy
indexproperties
lobGrösste Tabelle enthält alle E-Mails inkl. Attachments wenn in DB gespeichert
mvproperties
names
object
objectmvproperty
objectrelation
outgoingqueue
properties
receivefolder
searchresults
settings
singleinstances
stores
syncedmessages
syncs
tproperties
users
versionsHier wird jeweils die Version nachgetragen bei einem Update.
Datenbank Kopano ehemals Zarafa

Dazu gibt es 4 stored procedures:

  • GetBestBody
  • GetProps
  • PrepareGetProps
  • StreamObj

Das gesamte SQL Script einer leeren Kopano Installation mit allen Tabellen gibt es hier.

SQL Erstellungscript öffnen ohne Daten – Bitte diesen Text anwählen

— MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) — — Host: localhost Database: kopano — —————————————————— — Server version 10.5.18-MariaDB-0+debw11u1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE=’+00:00′ */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=’NO_AUTO_VALUE_ON_ZERO’ */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; — — Table structure for table `abchanges` — DROP TABLE IF EXISTS `abchanges`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `abchanges` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `sourcekey` varbinary(255) NOT NULL, `parentsourcekey` varbinary(255) NOT NULL, `change_type` int(11) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`parentsourcekey`,`change_type`,`sourcekey`), UNIQUE KEY `changeid` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `abchanges` — LOCK TABLES `abchanges` WRITE; /*!40000 ALTER TABLE `abchanges` DISABLE KEYS */; /*!40000 ALTER TABLE `abchanges` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `acl` — DROP TABLE IF EXISTS `acl`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `acl` ( `id` int(11) NOT NULL DEFAULT 0, `hierarchy_id` int(11) unsigned NOT NULL DEFAULT 0, `type` tinyint(4) unsigned NOT NULL DEFAULT 0, `rights` int(11) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`hierarchy_id`,`id`,`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `acl` — LOCK TABLES `acl` WRITE; /*!40000 ALTER TABLE `acl` DISABLE KEYS */; INSERT INTO `acl` VALUES (1,1,2,1531),(2,1,2,1531),(1,2,2,1531),(2,2,2,1531); /*!40000 ALTER TABLE `acl` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `changes` — DROP TABLE IF EXISTS `changes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `changes` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `sourcekey` varbinary(64) NOT NULL, `parentsourcekey` varbinary(64) NOT NULL, `change_type` int(11) unsigned NOT NULL DEFAULT 0, `flags` int(11) unsigned DEFAULT NULL, `sourcesync` int(11) unsigned DEFAULT NULL, PRIMARY KEY (`parentsourcekey`,`sourcekey`,`change_type`), UNIQUE KEY `changeid` (`id`), UNIQUE KEY `state` (`parentsourcekey`,`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `changes` — LOCK TABLES `changes` WRITE; /*!40000 ALTER TABLE `changes` DISABLE KEYS */; INSERT INTO `changes` VALUES (1,’0′,”,0,NULL,1); /*!40000 ALTER TABLE `changes` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `deferredupdate` — DROP TABLE IF EXISTS `deferredupdate`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deferredupdate` ( `hierarchyid` int(11) unsigned NOT NULL, `folderid` int(11) unsigned NOT NULL, `srcfolderid` int(11) unsigned DEFAULT NULL, PRIMARY KEY (`hierarchyid`), KEY `folderid` (`folderid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `deferredupdate` — LOCK TABLES `deferredupdate` WRITE; /*!40000 ALTER TABLE `deferredupdate` DISABLE KEYS */; /*!40000 ALTER TABLE `deferredupdate` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `hierarchy` — DROP TABLE IF EXISTS `hierarchy`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hierarchy` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `parent` int(11) unsigned DEFAULT 0, `type` tinyint(4) unsigned NOT NULL DEFAULT 0, `flags` smallint(6) unsigned NOT NULL DEFAULT 0, `owner` int(11) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `parenttypeflags` (`parent`,`type`,`flags`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `hierarchy` — LOCK TABLES `hierarchy` WRITE; /*!40000 ALTER TABLE `hierarchy` DISABLE KEYS */; INSERT INTO `hierarchy` VALUES (1,NULL,1,0,2),(2,1,3,0,2); /*!40000 ALTER TABLE `hierarchy` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `indexedproperties` — DROP TABLE IF EXISTS `indexedproperties`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `indexedproperties` ( `hierarchyid` int(11) unsigned NOT NULL DEFAULT 0, `tag` smallint(6) unsigned NOT NULL DEFAULT 0, `val_binary` varbinary(255) DEFAULT NULL, PRIMARY KEY (`hierarchyid`,`tag`), UNIQUE KEY `bin` (`tag`,`val_binary`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `indexedproperties` — LOCK TABLES `indexedproperties` WRITE; /*!40000 ALTER TABLE `indexedproperties` DISABLE KEYS */; INSERT INTO `indexedproperties` VALUES (1,4095,’\0\0\0\0‰bÿïû{Mc›Å–|Kµ‚4\0\0\0\0\0\0\0\0\0\0\0\0\0\0′),(2,4095,’\0\0\0\0‰bÿïû{Mc›Å–|Kµ‚4\0\0\0\0\0\0\0\0\0\0\0\0\0\0′); /*!40000 ALTER TABLE `indexedproperties` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `lob` — DROP TABLE IF EXISTS `lob`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `lob` ( `instanceid` int(11) unsigned NOT NULL, `chunkid` smallint(6) unsigned NOT NULL, `tag` smallint(6) unsigned NOT NULL, `val_binary` longblob DEFAULT NULL, PRIMARY KEY (`instanceid`,`tag`,`chunkid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci MAX_ROWS=1000000000 AVG_ROW_LENGTH=1750; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `lob` — LOCK TABLES `lob` WRITE; /*!40000 ALTER TABLE `lob` DISABLE KEYS */; /*!40000 ALTER TABLE `lob` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `mvproperties` — DROP TABLE IF EXISTS `mvproperties`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mvproperties` ( `hierarchyid` int(11) unsigned NOT NULL DEFAULT 0, `orderid` smallint(6) unsigned NOT NULL DEFAULT 0, `tag` smallint(6) unsigned NOT NULL DEFAULT 0, `type` smallint(6) unsigned NOT NULL DEFAULT 0, `val_ulong` int(11) unsigned DEFAULT NULL, `val_string` longtext DEFAULT NULL, `val_binary` longblob DEFAULT NULL, `val_double` double DEFAULT NULL, `val_longint` bigint(20) DEFAULT NULL, `val_hi` int(11) DEFAULT NULL, `val_lo` int(11) unsigned DEFAULT NULL, PRIMARY KEY (`hierarchyid`,`tag`,`type`,`orderid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `mvproperties` — LOCK TABLES `mvproperties` WRITE; /*!40000 ALTER TABLE `mvproperties` DISABLE KEYS */; /*!40000 ALTER TABLE `mvproperties` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `names` — DROP TABLE IF EXISTS `names`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `names` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nameid` int(11) DEFAULT NULL, `namestring` varchar(185) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `guid` binary(16) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `gni` (`guid`,`nameid`), UNIQUE KEY `gns` (`guid`,`namestring`), KEY `nameid` (`nameid`), KEY `namestring` (`namestring`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `names` — LOCK TABLES `names` WRITE; /*!40000 ALTER TABLE `names` DISABLE KEYS */; /*!40000 ALTER TABLE `names` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `object` — DROP TABLE IF EXISTS `object`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `object` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `externid` blob DEFAULT NULL, `objectclass` int(11) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`,`objectclass`), UNIQUE KEY `id` (`id`), UNIQUE KEY `externid` (`externid`(255),`objectclass`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `object` — LOCK TABLES `object` WRITE; /*!40000 ALTER TABLE `object` DISABLE KEYS */; /*!40000 ALTER TABLE `object` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `objectmvproperty` — DROP TABLE IF EXISTS `objectmvproperty`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `objectmvproperty` ( `objectid` int(11) unsigned NOT NULL DEFAULT 0, `propname` varchar(185) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, `orderid` tinyint(11) unsigned NOT NULL DEFAULT 0, `value` text DEFAULT NULL, PRIMARY KEY (`objectid`,`orderid`,`propname`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `objectmvproperty` — LOCK TABLES `objectmvproperty` WRITE; /*!40000 ALTER TABLE `objectmvproperty` DISABLE KEYS */; /*!40000 ALTER TABLE `objectmvproperty` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `objectproperty` — DROP TABLE IF EXISTS `objectproperty`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `objectproperty` ( `objectid` int(11) unsigned NOT NULL DEFAULT 0, `propname` varchar(185) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, `value` text DEFAULT NULL, PRIMARY KEY (`objectid`,`propname`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `objectproperty` — LOCK TABLES `objectproperty` WRITE; /*!40000 ALTER TABLE `objectproperty` DISABLE KEYS */; /*!40000 ALTER TABLE `objectproperty` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `objectrelation` — DROP TABLE IF EXISTS `objectrelation`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `objectrelation` ( `objectid` int(11) unsigned NOT NULL DEFAULT 0, `parentobjectid` int(11) unsigned NOT NULL DEFAULT 0, `relationtype` tinyint(11) unsigned NOT NULL, PRIMARY KEY (`objectid`,`parentobjectid`,`relationtype`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `objectrelation` — LOCK TABLES `objectrelation` WRITE; /*!40000 ALTER TABLE `objectrelation` DISABLE KEYS */; /*!40000 ALTER TABLE `objectrelation` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `outgoingqueue` — DROP TABLE IF EXISTS `outgoingqueue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `outgoingqueue` ( `store_id` int(11) unsigned NOT NULL DEFAULT 0, `hierarchy_id` int(11) unsigned NOT NULL DEFAULT 0, `flags` tinyint(4) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`hierarchy_id`,`flags`,`store_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `outgoingqueue` — LOCK TABLES `outgoingqueue` WRITE; /*!40000 ALTER TABLE `outgoingqueue` DISABLE KEYS */; /*!40000 ALTER TABLE `outgoingqueue` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `properties` — DROP TABLE IF EXISTS `properties`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `properties` ( `hierarchyid` int(11) unsigned NOT NULL DEFAULT 0, `tag` smallint(6) unsigned NOT NULL DEFAULT 0, `type` smallint(6) unsigned NOT NULL, `val_ulong` int(11) unsigned DEFAULT NULL, `val_string` longtext DEFAULT NULL, `val_binary` longblob DEFAULT NULL, `val_double` double DEFAULT NULL, `val_longint` bigint(20) DEFAULT NULL, `val_hi` int(11) DEFAULT NULL, `val_lo` int(11) unsigned DEFAULT NULL, `comp` tinyint(1) DEFAULT 0, PRIMARY KEY (`hierarchyid`,`tag`,`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `properties` — LOCK TABLES `properties` WRITE; /*!40000 ALTER TABLE `properties` DISABLE KEYS */; INSERT INTO `properties` VALUES (1,12289,30,NULL,’Admin store’,NULL,NULL,NULL,NULL,NULL,0),(2,12289,30,NULL,’root Admin store’,NULL,NULL,NULL,NULL,NULL,0); /*!40000 ALTER TABLE `properties` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `receivefolder` — DROP TABLE IF EXISTS `receivefolder`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `receivefolder` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `storeid` int(11) unsigned NOT NULL DEFAULT 0, `objid` int(11) unsigned NOT NULL DEFAULT 0, `messageclass` varchar(185) NOT NULL DEFAULT ”, PRIMARY KEY (`id`), UNIQUE KEY `storeid` (`storeid`,`messageclass`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `receivefolder` — LOCK TABLES `receivefolder` WRITE; /*!40000 ALTER TABLE `receivefolder` DISABLE KEYS */; /*!40000 ALTER TABLE `receivefolder` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `searchresults` — DROP TABLE IF EXISTS `searchresults`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `searchresults` ( `folderid` int(11) unsigned NOT NULL DEFAULT 0, `hierarchyid` int(11) unsigned NOT NULL DEFAULT 0, `flags` int(11) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`folderid`,`hierarchyid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `searchresults` — LOCK TABLES `searchresults` WRITE; /*!40000 ALTER TABLE `searchresults` DISABLE KEYS */; /*!40000 ALTER TABLE `searchresults` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `settings` — DROP TABLE IF EXISTS `settings`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `settings` ( `name` varchar(185) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, `value` blob NOT NULL, PRIMARY KEY (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `settings` — LOCK TABLES `settings` WRITE; /*!40000 ALTER TABLE `settings` DISABLE KEYS */; INSERT INTO `settings` VALUES (‘attachment_storage’,’files’),(‘charset’,’utf8mb4′),(‘imapseq’,’3′),(‘server_guid’,’cåù¸âNÀœ¢\n·8vFÏ’),(‘source_key_auto_increment’,’\0\0\0\0\0\0\0\0′); /*!40000 ALTER TABLE `settings` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `singleinstances` — DROP TABLE IF EXISTS `singleinstances`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `singleinstances` ( `instanceid` int(11) unsigned NOT NULL AUTO_INCREMENT, `hierarchyid` int(11) unsigned NOT NULL DEFAULT 0, `tag` smallint(6) unsigned NOT NULL DEFAULT 0, `filename` varchar(255) DEFAULT NULL, PRIMARY KEY (`instanceid`,`hierarchyid`,`tag`), UNIQUE KEY `hkey` (`hierarchyid`,`tag`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `singleinstances` — LOCK TABLES `singleinstances` WRITE; /*!40000 ALTER TABLE `singleinstances` DISABLE KEYS */; /*!40000 ALTER TABLE `singleinstances` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `stores` — DROP TABLE IF EXISTS `stores`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `stores` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `hierarchy_id` int(11) unsigned NOT NULL DEFAULT 0, `user_id` int(11) unsigned NOT NULL DEFAULT 0, `type` smallint(6) unsigned NOT NULL DEFAULT 0, `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ”, `company` int(11) unsigned NOT NULL DEFAULT 0, `guid` blob NOT NULL, PRIMARY KEY (`user_id`,`hierarchy_id`,`type`), UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `stores` — LOCK TABLES `stores` WRITE; /*!40000 ALTER TABLE `stores` DISABLE KEYS */; INSERT INTO `stores` VALUES (1,1,2,0,’SYSTEM’,0,’‰bÿïû{Mc›Å–|Kµ‚4′); /*!40000 ALTER TABLE `stores` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `syncedmessages` — DROP TABLE IF EXISTS `syncedmessages`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `syncedmessages` ( `sync_id` int(11) unsigned NOT NULL, `change_id` int(11) unsigned NOT NULL, `sourcekey` varbinary(64) NOT NULL, `parentsourcekey` varbinary(64) NOT NULL, PRIMARY KEY (`sync_id`,`change_id`,`sourcekey`), KEY `sync_state` (`sync_id`,`change_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `syncedmessages` — LOCK TABLES `syncedmessages` WRITE; /*!40000 ALTER TABLE `syncedmessages` DISABLE KEYS */; /*!40000 ALTER TABLE `syncedmessages` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `syncs` — DROP TABLE IF EXISTS `syncs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `syncs` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `sourcekey` varbinary(64) NOT NULL, `change_id` int(11) unsigned NOT NULL, `sync_type` int(11) unsigned DEFAULT NULL, `sync_time` datetime NOT NULL, PRIMARY KEY (`id`), KEY `foldersync` (`sourcekey`,`sync_type`), KEY `changes` (`change_id`), KEY `sync_time` (`sync_time`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `syncs` — LOCK TABLES `syncs` WRITE; /*!40000 ALTER TABLE `syncs` DISABLE KEYS */; INSERT INTO `syncs` VALUES (1,”,1,1,’2023-02-08 21:43:21′); /*!40000 ALTER TABLE `syncs` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `tproperties` — DROP TABLE IF EXISTS `tproperties`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tproperties` ( `folderid` int(11) unsigned NOT NULL DEFAULT 0, `hierarchyid` int(11) unsigned NOT NULL DEFAULT 0, `tag` smallint(6) unsigned NOT NULL DEFAULT 0, `type` smallint(6) unsigned NOT NULL, `val_ulong` int(11) unsigned DEFAULT NULL, `val_string` longtext DEFAULT NULL, `val_binary` longblob DEFAULT NULL, `val_double` double DEFAULT NULL, `val_longint` bigint(20) DEFAULT NULL, `val_hi` int(11) DEFAULT NULL, `val_lo` int(11) unsigned DEFAULT NULL, PRIMARY KEY (`folderid`,`tag`,`hierarchyid`,`type`), KEY `hi` (`hierarchyid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `tproperties` — LOCK TABLES `tproperties` WRITE; /*!40000 ALTER TABLE `tproperties` DISABLE KEYS */; /*!40000 ALTER TABLE `tproperties` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `users` — DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `externid` blob DEFAULT NULL, `objectclass` int(11) NOT NULL DEFAULT 0, `signature` varbinary(255) NOT NULL DEFAULT ‘0’, `company` int(11) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `externid` (`externid`(255),`objectclass`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `users` — LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` VALUES (1,NULL,196610,”,0),(2,NULL,65537,”,0); /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; — — Table structure for table `versions` — DROP TABLE IF EXISTS `versions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `versions` ( `major` int(11) unsigned NOT NULL DEFAULT 0, `minor` int(11) unsigned NOT NULL DEFAULT 0, `micro` int(11) unsigned NOT NULL DEFAULT 0, `revision` int(11) unsigned NOT NULL DEFAULT 0, `databaserevision` int(11) unsigned NOT NULL DEFAULT 0, `updatetime` datetime NOT NULL, PRIMARY KEY (`major`,`minor`,`micro`,`revision`,`databaserevision`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; — — Dumping data for table `versions` — LOCK TABLES `versions` WRITE; /*!40000 ALTER TABLE `versions` DISABLE KEYS */; INSERT INTO `versions` VALUES (8,7,0,0,118,’2023-02-04 11:01:58′),(8,7,25,0,118,’2023-02-04 11:01:58′); /*!40000 ALTER TABLE `versions` ENABLE KEYS */; UNLOCK TABLES; — — Dumping routines for database ‘kopano’ — /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = ‘NO_UNSIGNED_SUBTRACTION,STRICT_ALL_TABLES’ */ ; /*!50003 DROP PROCEDURE IF EXISTS `GetBestBody` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_general_ci */ ; DELIMITER ;; CREATE DEFINER=`kopano`@`localhost` PROCEDURE `GetBestBody`(hid integer, OUT bestbody integer) DETERMINISTIC BEGIN DECLARE best INT; DECLARE CONTINUE HANDLER FOR NOT FOUND SET bestbody = 0 ; # Get body with lowest id (RTF before HTML) SELECT tag INTO bestbody FROM properties WHERE hierarchyid=hid AND tag IN (4105, 4115) ORDER BY tag LIMIT 1; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = ‘NO_UNSIGNED_SUBTRACTION,STRICT_ALL_TABLES’ */ ; /*!50003 DROP PROCEDURE IF EXISTS `GetProps` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_general_ci */ ; DELIMITER ;; CREATE DEFINER=`kopano`@`localhost` PROCEDURE `GetProps`(IN hid integer, IN mode integer) BEGIN DECLARE bestbody INT; IF mode = 1 THEN call GetBestBody(hid, bestbody); END IF; SELECT 0, tag, properties.type, val_ulong, val_string, val_binary, val_double, val_longint, val_hi, val_lo, 0, names.nameid, names.namestring, names.guid FROM properties LEFT JOIN names ON properties.tag-34049=names.id WHERE hierarchyid=hid AND (tag <= 34048 OR names.id IS NOT NULL) AND (tag NOT IN (4105, 4115) OR mode = 0 OR (mode = 1 AND tag = bestbody)) UNION SELECT count(*), tag, mvproperties.type, group_concat(length(mvproperties.val_ulong),':', mvproperties.val_ulong ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_string),':', mvproperties.val_string ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_binary),':', mvproperties.val_binary ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_double),':', mvproperties.val_double ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_longint),':', mvproperties.val_longint ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_hi),':', mvproperties.val_hi ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_lo),':', mvproperties.val_lo ORDER BY mvproperties.orderid SEPARATOR ''), 0, names.nameid, names.namestring, names.guid FROM mvproperties LEFT JOIN names ON mvproperties.tag-34049=names.id WHERE hierarchyid=hid AND (tag <= 34048 OR names.id IS NOT NULL) GROUP BY tag, mvproperties.type; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_UNSIGNED_SUBTRACTION,STRICT_ALL_TABLES' */ ; /*!50003 DROP PROCEDURE IF EXISTS `PrepareGetProps` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_general_ci */ ; DELIMITER ;; CREATE DEFINER=`kopano`@`localhost` PROCEDURE `PrepareGetProps`(IN hid integer) BEGIN SELECT 0, tag, properties.type, val_ulong, val_string, val_binary, val_double, val_longint, val_hi, val_lo, hierarchy.id, names.nameid, names.namestring, names.guid FROM properties JOIN hierarchy ON properties.hierarchyid=hierarchy.id LEFT JOIN names ON properties.tag-34049=names.id WHERE hierarchy.parent=hid AND (tag <= 34048 OR names.id IS NOT NULL); SELECT count(*), tag, mvproperties.type, group_concat(length(mvproperties.val_ulong),':', mvproperties.val_ulong ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_string),':', mvproperties.val_string ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_binary),':', mvproperties.val_binary ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_double),':', mvproperties.val_double ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_longint),':', mvproperties.val_longint ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_hi),':', mvproperties.val_hi ORDER BY mvproperties.orderid SEPARATOR ''), group_concat(length(mvproperties.val_lo),':', mvproperties.val_lo ORDER BY mvproperties.orderid SEPARATOR ''), hierarchy.id, names.nameid, names.namestring, names.guid FROM mvproperties JOIN hierarchy ON mvproperties.hierarchyid=hierarchy.id LEFT JOIN names ON mvproperties.tag-34049=names.id WHERE hierarchy.parent=hid AND (tag <= 34048 OR names.id IS NOT NULL) GROUP BY tag, mvproperties.type; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_UNSIGNED_SUBTRACTION,STRICT_ALL_TABLES' */ ; /*!50003 DROP PROCEDURE IF EXISTS `StreamObj` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_general_ci */ ; DELIMITER ;; CREATE DEFINER=`kopano`@`localhost` PROCEDURE `StreamObj`(IN rootid integer, IN maxdepth integer, IN mode integer) BEGIN DECLARE no_more_rows BOOLEAN; DECLARE subid INT; DECLARE subsubid INT; DECLARE subtype INT; DECLARE cur_hierarchy CURSOR FOR SELECT id,hierarchy.type FROM hierarchy WHERE parent=rootid AND type=7; DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_rows = TRUE; call GetProps(rootid, mode); call PrepareGetProps(rootid); SELECT id,hierarchy.type FROM hierarchy WHERE parent=rootid; OPEN cur_hierarchy; the_loop: LOOP FETCH cur_hierarchy INTO subid, subtype; IF no_more_rows THEN CLOSE cur_hierarchy; LEAVE the_loop; END IF; IF subtype = 7 THEN BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND set subsubid = 0; IF maxdepth > 0 THEN SELECT id INTO subsubid FROM hierarchy WHERE parent=subid LIMIT 1; SELECT id, hierarchy.type FROM hierarchy WHERE parent = subid LIMIT 1; IF subsubid != 0 THEN # Recurse into submessage (must be type 5 since attachments can only contain nested messages) call StreamObj(subsubid, maxdepth-1, mode); END IF; ELSE # Maximum depth reached. Output a zero-length subset to indicate that we’re # not recursing further. SELECT id, hierarchy.type FROM hierarchy WHERE parent=subid LIMIT 0; END IF; END; END IF; END LOOP the_loop; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; — Dump completed on 2023-02-08 21:43:22

Kopano Datenbank Version anpassen

Die Datenbank muss die korrekte Version haben. Leider gibt es kein Tool oder eine genaue Datenbankstruktur. Wenn ihr aber vorgängig mit der Community Version gearbeitet habt, dann ist eure Datenbank möglicherweise bereits auf einer höheren Kopano Version. Somit muss die Version der Datenbank vor dem Restore oder direkt nach dem Restore geändert werden.

mysql -h localhost -u USERNAME -p kopano

SELECT * FROM versions

UPDATE versions SET major = '8' WHERE major = '10'; 

UPDATE versions SET micro = '25' WHERE micro = '80' AND updatetime = '2019-02-20 19:57:28';

In der Tabelle “versions” kann mittels einem Select den gesamten Inhalt anzeigen. In meinem Fall musste ich die Major Version auf “8” ändern und die Micro Version auf 25 anstatt “80”. Achtung wenn Ihr keine Erfahrung mit solchen Updates solltet Ihr zuerst ein paar Tests machen und natürlich mit einer Kopie arbeiten. Die Major Version ist “8” die Minor “7” und die Micro “25”. Bei Revision ist “0” und Datenbankrevision “118”. Dies bezieht sich auf die Kopano Version vom Februar 2022 -> Kopano Core 8.7.25.

Kopano Datenbank manuell sichern

Es ist sicher nie eine schlechte Idee wenn man weiss wie man eine Datenbank sichert. Noch besser ist es wenn man auch das Backup wiederherstellen kann (restore). Diese beiden Schritte werde ich euch hier zeigen. Dafür ist ein wenig SQL Verständnis notwendig aber wenn man eine Software wie Kopano zuhause betreibt sollte man sich damit auseinander setzen.

Als erstes muss ich mir Gedanken machen wohin ich die Datenbank speichern möchte. Am einfachsten ist es wenn ich die Datenbank zuerst auf dem virtuellen Server zwischenspeichere und diese dann von dort weiterverarbeite. Ich könnte aber auch ein Netzlaufwerk mounten und die Sicherung direkt auf ein Netzlaufwerk speichern. Da seit ihr frei und es gibt keine genaue Vorschriften wie man es machen muss / soll. Wichtig ist einfach die Daten die da drin sind können von allen gelesen werden, falls ein Backup in die falschen Hände gerät.

Damit der Befehl ausgeführt werden kann muss man

mysqldump -u kopanosql -p kopano --single-transaction --routines > /home/kopano/backups/kopanobackup140122023.sql

Kopano Datenbank zurück laden (restore)

Wer bereits eine bestehende Datenbank hat will diese auf dem neuen Server natürlich zurückladen. So kann man alle Daten wiederherstellen und man hat seinen gesamten E-Mail Verlauf. Als erstes muss man die gesicherte Datenbank auf den neuen Server laden und dort in ein Verzeichniss wo man nachher Zugriff hat.

Ich habe die Datenbank unter: /home/USERNAME gespeichert damit ich diese von diesem Verzeichnis aus in die Datenbank laden kann. Es muss nicht dieses Verzeichnis sein, ihr könnt gut einen anderen Ordner auswählen. Der Datenbankname in diesem Beispiel lautet “kopano” und der Benutzer “kopanosql”.

mysql -u kopanosql -p kopano < /home/kopano/kopanobackup140122023.sql

Starten und stoppen vom Kopano Server

sudo systemctl start kopano-server
sudo systemctl stop kopano-server

Kopano neuen Benutzer anlegen

Um in Kopano einen neuen Benutzer anzulegen sind folgende 2 Befehle notwendig. Die in Grossbuchstaben geschrieben Wörter müssen natürlich ersetzt werden.

kopano-admin -c KOPANOBENUTZER -p PASSWORT -e EMAILADRESSE -f 'BENUTZERNAME'
kopano-cli -u KOPANOBENUTZER --create-store

Postfix

SASL Konfiguration für Postfix damit der jeweilige Abesender über die korrekte E-Mail Adresse versendet und die korrekten Anmeldedaten hat.

sudo nano /etc/kopano/postfix/sasl_passwd
meinemusteradresse@gmx.ch BENUTZERNAMEGMX:PASSWORTGMX

Mit Postmap konvertieren oder keine Ahnung warum man das machen muss aber gemäss Postfix Anleitung ist dies nötig.

sudo postmap /etc/kopano/postfix/sasl_passwd

Sender Relay

sudo nano /etc/kopano/postfix/sender_relay
meinemusteradresse@gmx.ch [mail.gmx.net]:587

Mit Postmap konvertieren oder keine Ahnung warum man das machen muss aber gemäss Postfix Anleitung ist dies nötig.

sudo postmap /etc/kopano/postfix/sender_relay

Postfix Mail Log

Manchmal kann es hilfreich sein das Log von Postfix zu öffnen. Normalerweise ist das Log dazu unter /var/log zu finden.

sudo nano /var/log/mail.err

Fetchmail

Um in Fetchmail das Log anzuschauen kann man das wie folgt machen und man bekommt sehr schnell einen Überblick was bei Fetchmail gerade läuft.

Installation von Fetchmail:

sudo apt install fetchmail

Die Fetchmail Accounts werden in der “fetchmail-accounts” Datei gepflegt.

sudo nano /var/lib/fetchmail/fetchmail-accounts

Hier werden die verschiedenen Accounts hinterlegt. Alle die hier eingegeben E-Mail Accounts werden von Fetchmail abgefragt und die Mails werden dem jeweiligen Kopano User zugestellt. Das ermöglicht nun dass ihr mehrere E-Mails in dasselbe Postfach laden könnt. Das bedeutet ihr könnt von verschiedenen Domains die E-Mails in ein Postfach laden. Natürlich könnt ihr auch pro E-Mail Adresse jeweils einem Kopano Benutzer zuordnen.

poll mailserver.hoststar.hosting proto pop3 user deine@email.ch pass PASSSWORT options ssl smtpaddress localhost forcecr mda "/usr/sbin/kopano-dagent -s KOPANOBENUTZERNAME";

Hinzu sollte in der Datei “fetchmail-accounts” auch ein Postmaster definiert werden. Dieser erhält dann bei Problemen allfällige E-Mails.

set postmaster "admin@deindomain.ch";

Das Log von Fetchmail kann wie folgt angeschaut werden, da seht ihr wenn etwas falsch konfiguriert habt.

tail -f /var/log/fetchmail.log

Starten und Stoppen von Fetchmail.

sudo systemctl start fetchmail
sudo systemctl stop fetchmail