---
title: "Upgrading CoraDB"
description: "Upgrade CoraDB to a new version: back up, migrate databases with unloaddb and loaddb, recreate locales and restart the services."
url: "https://www.coradb.ai/manual/upgrade.html"
markdown_url: "https://www.coradb.ai/manual/markdown/upgrade.md"
product: "CoraDB"
version: "1.0"
keywords: "upgrade coradb, coradb migration, coradb unloaddb loaddb, migrate coradb database, coradb new version"
---

# Upgrading CoraDB

Upgrading CoraDB has two parts: installing the new software and, when the database format changed, migrating the databases.

## Before you upgrade

- **Back up every database** with [backupdb](https://www.coradb.ai/manual/admin/admin_backup.html#backupdb).
- **Save the configuration**: the files in `$CORADB/conf` (`coradb.conf`, `coradb_broker.conf` and the others you changed) and `$CORADB_DATABASES/databases.txt`.
- **Check reserved words**: identifiers that became [reserved words](https://www.coradb.ai/manual/sql/keyword.html) in the new version must be renamed or quoted.
- **Locales**: if your databases use locales other than en_US, list them in `$CORADB/conf/coradb_locales.txt` of the new installation and compile them with `make_locale` before creating or migrating databases; see [Locale setting](https://www.coradb.ai/manual/sql/i18n_locale.html).
- **Drivers**: plan to update the drivers of your applications to the new version; the broker and the database server must have the same version.


## Migrating a database

When the database format changed, or to move a database to another machine, migrate it with [unloaddb](https://www.coradb.ai/manual/admin/admin_unload.html#unloaddb) and [loaddb](https://www.coradb.ai/manual/admin/admin_unload.html#loaddb). The example migrates `testdb`.

| Step | Linux | Windows |
|---|---|---|
| 1. Stop CoraDB | `coradb service stop` | Stop CoraDB with the Service Tray, or `coradb service stop` |
| 2. Unload the database with the **old** version, into a separate directory | `coradb unloaddb -S testdb` | same |
| 3. Keep the unload files (`testdb_schema`, `testdb_objects`, `testdb_indexes`, `testdb_trigger`), `databases.txt` and the configuration files in a safe place | | |
| 4. Delete the old database | `coradb deletedb testdb` | same |
| 5. Install the new version | See [Installing CoraDB](https://www.coradb.ai/manual/install.html) | same |
| 6. Create the database with the same locale as before | `coradb createdb testdb en_US.utf8` | same |
| 7. Load the unloaded files | `coradb loaddb -u dba -s testdb_schema -d testdb_objects -i testdb_indexes --trigger-file=testdb_trigger testdb` | same |
| 8. Back up the new database | `coradb backupdb -S testdb` | same |
| 9. Restore your settings in the new configuration files and start CoraDB | `coradb service start`, `coradb server start testdb` | Service Tray > *Service Start*, or the same commands |

- Create the database with the same language and charset as the old one; the charset decides how strings are stored and cannot be changed later. See [Charsets, collations & locales](https://www.coradb.ai/manual/sql/i18n.html).
- Copy parameter values from the old configuration files instead of replacing the new files with the old ones, so that new parameters keep their defaults. See [System parameters](https://www.coradb.ai/manual/admin/config.html) and [Broker configuration](https://www.coradb.ai/manual/admin/config_broker.html).
- Triggers are unloaded to a separate file, `testdb_trigger`, which loaddb loads after the data with `--trigger-file`, so that the triggers do not fire while the rows are loaded.

## After the upgrade

- **Java stored procedures**: load the Java classes into the new installation again with [loadjava](https://www.coradb.ai/manual/sql/jsp.html#loadjava-utility) and start the Java SP server; see [Enabling the Java SP server](https://www.coradb.ai/manual/sql/jsp.html#enabling-the-java-sp-server).
- **Statistics**: update the optimizer statistics of large tables with [UPDATE STATISTICS](https://www.coradb.ai/manual/sql/tuning.html#updating-statistics) so that plans are based on the new data.
- **Applications**: test the applications with the new drivers; query results can change when the behavior of statements or functions changes between versions.
