Migrating to Another Database
This document describes how to migrate your Confluence data from your existing database to another database. The instructions are designed primarily for migrating from an evaluation to a production database.
Large data sets will require third party database migration tools.
This page covers the following scenarios:
- Moving from the embedded, trial database to a supported external database.
- Moving from one external database to another, for example from Oracle to PostgreSQL (provided your dataset is not large)
- Upgrading to a new version of the same external database. Note: you don't need to migrate your data if you're upgrading the database in place.
If you are moving your database from one server to another you can change the JDBC URL in <confluence-home>/confluence.cfg.xml
(if you are using a direct JDBC connection) or in the definition of your datasource (if you are connecting via a datasource).
Please see the note at the bottom of this page, if you are migrating MySQL database from one server to another.
Limitations of database migration
Database migration
There are two ways you can perform the migration, both described on this page:
Method one is the standard procedure.
Use method two if the total size of attachments in your installation exceeds 500MB.
Migrating to an Amazon Aurora database
If you plan to migrate to an Amazon Aurora database, see Configuring Confluence Data Center to work with Amazon Aurora. This guide explains how to migrate to an Amazon Aurora cluster and connect it to Confluence Data Center.
Method one – standard procedure
Step 1: Take note of your Marketplace apps
Take note of the apps (also knowns as plugins or add-ons) currently installed and enabled in Confluence, so that you can reinstate them later. Make a note of the following for each app:
- App name and vendor
- Version
- Enabled or disabled status. This is useful if you have enabled or disabled modules yourself, making your configuration differ from the default.
Step 2: Back up your data
- Create an XML backup of your existing data. See Back up a Site. Make a note of the location where you put the XML file. You will need it later to restore your Confluence data into your new database.
- Stop Confluence.
- Make a copy of the Confluence Home directory. This is a precautionary measure, to ensure you can recover your data if it is mistakenly overwritten.
- Make a separate backup using the utilities that were installed with your external database. This also is a precautionary measure.
Step 3: Set up the new database
- Install the database server.
- Perform any required configuration of the database server, as instructed.
- Add the Confluence database and user. Make a note of the username and password that you define in this step. You will need them later, when running the Confluence Setup Wizard.
Step 4. Install Confluence (same version number) in a new location
Note: You must use the same version of Confluence as the existing installation. (If you want to upgrade Confluence, you must do it as a separate step.) For example, if your current site is running Confluence 5.1.2, your new installation must also be Confluence 5.1.2.
When running the Confluence installer:
- Choose Custom Install. (Do not choose to upgrade your existing installation.)
- Choose a new destination directory. This is the installation directory for your new Confluence. It must not be the same as the existing Confluence installation.
- Choose a new home directory. This is the data directory for your new Confluence. It must not be the same as the existing Confluence installation.
Step 5. Download and install the database driver if necessary
Step 6. Run the Confluence setup wizard and copy your data to your new database
When running the Confluence setup wizard:
- Select Production Installation as the installation type.
- Enter your license key, as usual.
- The next screens will depend on your license type:
- If you are using a Confluence Data Center license, under Choose your deployment type, select either non-clustered (single node) or clustered.
- If you are using a Confluence Server license, select My own database then select your particular database from the Database type from the dropdown menu.
- Enter your database details. Use test connection to check your database is set up correctly.
- On the load content step, select Empty Site. You will need to restore from backup after you've completed the setup wizard.
- After you've completed the setup wizard, go to Administration > General Configuration > Backup and restore and follow the steps on Restore a Site.
Step 7. Re-install your Marketplace apps
- Use the same version of the app as on your old Confluence site.
- The data created by the app will already exist in your new Confluence site, because it is included in the XML backup.
Step 8. Check settings for new machine
If you are moving Confluence to a different machine, you need to check the following settings:
- Configure your new base URL. See Configuring the Server Base URL.
- Check your application links. See Linking to Another Application.
- Update any gadget subscriptions from external sites pointing to this Confluence site. For example, if your Jira site subscribes to Confluence gadgets, you will need to update your Jira site.
- Review any other resources that other systems are consuming from Confluence.
Method two – for installations with a large volume of attachments
Before you start
These instructions only apply to attachments stored in the file system. If you store attachments in the database see Attachment Storage Configuration to find out how to migrate between different attachment storage methods.
Step 1: Take note of your Marketplace apps
Take note of the apps (also knowns as plugins or add-ons) currently installed and enabled in Confluence, so that you can reinstate them later. Make a note of the following for each app:
- App name and vendor
- Version
- Enabled or disabled status. This is useful if you have enabled or disabled modules yourself, making your configuration differ from the default.
Step 2: Back up your data
- Create an XML backup of your existing data. See Back up a Site. Make a note of the location where you put the XML file. You will need it later to restore your Confluence data into your new database.
- Stop Confluence.
- Make a copy of the attachments directory (
<CONFLUENCE-HOME-DIRECTORY>\attachments
) in your Confluence Home directory. You will need it later to copy your Confluence attachments data into your new Confluence installation. - Make a separate backup using the utilities that were installed with your external database. This is also a precautionary measure.
Step 3: Set up the new database
- Install the database server.
- Perform any required configuration of the database server, as instructed.
- Add the Confluence database and user. Make a note of the username and password that you define in this step. You will need them later, when running the Confluence Setup Wizard.
Step 4. Install Confluence (same version number) in a new location
Note: You must use the same version of Confluence as the existing installation. (If you want to upgrade Confluence, you must do it as a separate step.) For example, if your current site is running Confluence 5.1.2, your new installation must also be Confluence 5.1.2.
When running the Confluence installer:
- Choose Custom Install. (Do not choose to upgrade your existing installation.)
- Choose a new destination directory. This is the installation directory for your new Confluence. It must not be the same as the existing Confluence installation.
- Choose a new home directory. This is the data directory for your new Confluence. It must not be the same as the existing Confluence installation.
Step 5. Download and install the database driver if necessary
Step 6. Run the Confluence setup wizard and copy your data to your new database
When running the Confluence setup wizard:
- Select Production Installation as the installation type.
- Enter your license key, as usual.
- The next screens will depend on your license type:
- If you are using a Confluence Data Center license, under Choose your deployment type, select either non-clustered (single node) or clustered.
- If you are using a Confluence Server license, select My own database then select your particular database from the Database type from the dropdown menu.
- Enter your database details. Use test connection to check your database is set up correctly.
- On the load content step, select Empty Site. You will need to restore from backup after you've completed the setup wizard.
- After you've completed the setup wizard, go to Administration > General Configuration > Backup and restore and follow the steps on Restore a Site.
Step 7: Copy your attachments across
Copy the contents of the attachments directory (<CONFLUENCE-HOME-DIRECTORY>\attachments
) from your old Confluence Home directory to your new Confluence Home directory.
Step 8. Re-install your Marketplace apps
- Use the same version of the app as on your old Confluence site.
- The data created by the app will already exist in your new Confluence site, because it is included in the XML backup.
Step 9. Check settings for new machine
If you are moving Confluence to a different machine, you need to check the following settings:
- Configure your new base URL. See Configuring the Server Base URL.
- Check your application links. See Linking to Another Application.
- Update any gadget subscriptions from external sites pointing to this Confluence site. For example, if your Jira site subscribes to Confluence gadgets, you will need to update your Jira site.
- Review any other resources that other systems are consuming from Confluence.
A note about case sensitivity in your database
'Collation' refers to a set of rules that determine how data is sorted and compared. Case sensitivity is one aspect of collation. Other aspects include sensitivity to kana (Japanese script) and to width (single versus double byte characters).
Setting up a new Confluence instance
For new Confluence instances, we recommend using case sensitive collation for your Confluence database. This is the default collation type used by many database systems.
Note: Even if the database is configured for case sensitive collation, Confluence reduces all usernames to lower case characters before storing them in the database. For example, this means that 'joebloggs', 'joeBloggs' and 'JoeBloggs' will be treated as the same username.
Migrating an existing Confluence instance to a different database
The default Confluence configuration uses case sensitive database collation. This is typical of databases created under default conditions. If you are migrating from this type of configuration to a new database, we recommend that the new database uses case sensitive collation. If you use case insensitive collation, you may encounter data integrity problems after migration (for example, via an XML import) if data stored within your original Confluence site required case sensitive distinctions.
Migrating MySQL database between servers
Confluence 7.11 and higher versions introduced Database triggers and procedures. If you use mysqldump
for migration, you need to add additional parameters to your mysqldump
command. For more details see Confluence MySQL database migration causes content_procedure_for_denormalised_permissions does not exist error.
In addition, Confluence uses DEFINER
clauses for its procedures that have hardcoded user information and hostname/IP of the server. When a database dump is generated that will export procedures having username/account in their DDL. Errors will happen if that dump is imported into a Database without the same username/account and privileges granted. For more information, see MySQL error 1449: The user specified as a definer does not exist.
Troubleshooting
See our troubleshooting guide if you're unable to restore your XML backup.