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
Step 2: Back up your data
- Create an XML backup of your existing data. See Manually Backup the Site. Make a note of the location where you put the XML file. You will need it later to import 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.
- If you are using an external database, make a separate backup using the utilities that were installed with that database. This also is a precautionary measure.
Step 3: Set up the new database
Choose the database setup instructions for your new database, and follow those instructions to do the following:
- 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
Now you will install Confluence again, with a different home directory path and installation path.
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
Note that Confluence bundles some database drivers, but you'll need to install the driver yourself if it is not bundled. Follow the database setup instructions for your new database, to download and install the database driver if necessary.
Step 6. Run the Confluence setup wizard and copy your data to your new database
Step 7. Re-install your Marketplace apps
Step 8. Check settings for new machine
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
Step 2: Back up your data
- Create an XML backup of your existing data. See Manually Backup the Site. Make a note of the location where you put the XML file. You will need it later to import 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. - If you are using an external database, make a separate backup using the utilities that were installed with that database. This also is a precautionary measure.
Step 3: Set up the new database
Choose the database setup instructions for your new database, and follow those instructions to do the following:
- 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
Now you will install Confluence again, with a different home directory path and installation path.
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
Note that Confluence bundles some database drivers, but you'll need to install the driver yourself if it is not bundled. Follow the database setup instructions for your new database, to download and install the database driver if necessary.
Step 6. Run the Confluence setup wizard and copy your data to your new database
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
Step 9. Check settings for new machine
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.