Upgrading Confluence from 5.5 to latest version.
Asked by Artur Yasyulevich:

Hello,

I have Conflunce 5.5 on Windows server(not cloud)with separate Apache 6(it is not in Conf directory) and MS SQL Server 2008 R2 data base. This configuration was inherited by me from previous admin without explanations. So i'm trying to understand myself how to upgrade Confluence. I tried to update it by installer to version 5.10.9 with updating DB to MS SQL 2014. I succeed DB update and it works with Confluence 5.5. But when I tried to update Confluence installer "shouts" for an error "Problems reading the installation directory". I think I should use manual installation(unzip). The questions are:

1) What should be the sequence of actions? During the upgrade, I need to update Java (6-\>8), Data Base (2008-\> 2014), Apache (6-\> 8) and Confluence itself. Or it is not critical?(We don't have test environment, that's why i'm asking). I read Atlassian upgrade manuals and still asking.

2) Is it good idea to upgrade from Conf 5.5 to 5.10.9, and then to 5.10.9-\>Latest version?

Or it is better to do 5.5-\>Latest version?

3) I thought that I have EAR/WAR distribution configuration because catalogs for Confluence, Apache are not in one place. Am I right?

4) How can I do future upgrades using installer if I have **EAR/WAR distribution configuration**(catalogs for Confluence, Apache are not in one place and installer don't see them I think)?

Every your idea and answer will help me!!!


Answers:
author: Artur Yasyulevich
body: Hi Ann!

Thank you for your help!

Finally I found some time and successfully migrated to standalone version from EAR/WAR(lost some time to do customizations to Tomcat).

Looking forward to do update to 6.7.0 using installer.

When i'm done, i'll tell you.

comments: author: AnnWorley
body: Thanks for keeping the forum in the loop as you traverse the upgrade course!


author: Artur Yasyulevich
body: For three days me and DB admin were trying to do the update. We:

1) Updated DB from MS SQL 2008-\>2014 SP2.

2) Changed the compatibility level of the database to SQL2014.

3) Changed collation to "SQL_Latin1_General_CP1_CS_AS"(tried different ways).

4) Pointed to bundled Java (build 1.8.0_162-b12).

5) Do the customization to Tomcat '.xml' files.

6) Start the confluence.

Finally, we always have an error on startup confluence web page settings(the text of error is below). Looks like the primary\\candidate keys can't migrate to 2014 version or maybe when changing collation. Do you have idea what to do?


author: Artur Yasyulevich
body: Upgrade failed. Please consult the system logs for details. You will need to fix these problems, restore your database and confluence home directory to the pre upgrade state. Then retry the upgrade. Upgrade error message: Upgrade task com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentToCeoConversionUpgradeTask@75245df6 failed during the SCHEMA_UPGRADE phase due to: StatementCallback; uncategorized SQLException for SQL \[ALTER TABLE CONTENT add constraint c_prevver foreign key (PREVVER) references CONTENT(CONTENTID)\]; SQL state \[S0000\]; error code \[1776\]; There are no primary or candidate keys in the referenced table 'CONTENT' that match the referencing column list in the foreign key 'c_prevver'.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: There are no primary or candidate keys in the referenced table 'CONTENT' that match the referencing column list in the foreign key 'c_prevver'.


author: AnnWorley
body: Hi Artur,

It sounds like you are making a lot of progress despite the most recent disappointing outcome. You seem to have completed all the platform upgrades.

I found a support case where that error (**There are no primary or candidate keys in the referenced table 'CONTENT' that match the referencing column list in the foreign key 'c_prevver'** .) was encountered during an upgrade from 5.5.x while using MS SQL server. In their case they had run the upgrade once and gotten the isolation level error**'READ_COMMITTED_SNAPSHOT' must be ON** and then a subsequent upgrade generated the error you are reporting during **Upgrade task com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentToCeoConversionUpgradeTask.**

It is unfortunate that you don't have a test instance, as the suggested steps are:

1. [Rollback Confluence to the pre upgrade state](https://confluence.atlassian.com/confkb/how-to-rollback-to-a-previous-version-of-confluence-316113136.html)
2. Set up a new, blank database, configured based on our preferred configuration (isolation level, collation etc.): [Database Setup for SQL Server](https://confluence.atlassian.com/doc/database-setup-for-sql-server-9258.html)
3. Set up a fresh instance of Confluence 5.5, connected to the empty database with the preferred configuration.
4. Import an [XML site backup](https://confluence.atlassian.com/doc/manually-backing-up-the-site-152405.html) from the rolled back instance into the fresh Confluence 5.5. instance
5. Run the upgrade again.

If there are issues after step 5, please post any new errors.

Thanks and have a good Friday,

Ann


author: Artur Yasyulevich
body: Hi Ann,

Thanks for quik answer!

Before every work I make a snapshot of the server, and after I restore from it, if the update failed. So now I have 5.5 standalone configuration with MS SQL 2008(with old collation **Cyrillic_General_CI_AS,** not **SQL_Latin1_General_CP1_CS_AS**).

So I have a pre upgrade state now and planning to do steps 1-5 as you said.

Few questions:

1) on step 3, fresh empty DB must be same version as i have now(MS SQL 2008)? and on step 5 I do the DB update from MS SQL 2008-\>2014 SP2 and change the compatibility level of the database to SQL2014?

2) does step 4(Import XML backup) means some kind of migration data to new fresh database? So after import is complete, the fresh database is filled with data?


author: Artur Yasyulevich
body: And can I use Windows installer in step 3 or it would be a standalone distribution?


author: AnnWorley
body: Hi Artur,

You can use the installer. The XML site backup will contain all the data but not the user installed plugins. Please see [Restoring a Site](https://confluence.atlassian.com/doc/restoring-a-site-152034.html) for more details.

On step 3, the ideal database version would be MS SQL 2008. However, the collation must be set before installing Confluence 5.5. The [SQL server setup for Confluence 5.5](https://confluence.atlassian.com/display/CONF55/Database+Setup+for+SQL+Server) called for the collation: **SQL_Latin1_General_CP1_CS_AS.**

After restoring the XML back-up you would check whether all is well (looks the same and logins work) and then upgrade the database and then upgrade Confluence.

Thanks,

Ann


author: Artur Yasyulevich
body: Hi Ann,

Thank you very much for your help, it was really useful! Finally - i'm done with update!


author: Benjamin Yu
body: I had the same problem: trying to upgrade from 5.04 to 7.x on linux with reverse proxy. installation is ok, but when I try to restore data from prod to the staging server, it is not working. Why? Please help!!


author: AnnWorley
body: Hi Artur,

It's great to hear you are upgrading!

If at all possible, please spin up a test environment for a trial run of this procedure. It could save unplanned downtime. [Create a staging environment for upgrading Confluence](https://confluence.atlassian.com/doc/create-a-staging-environment-for-upgrading-confluence-866094180.html)

It is pretty easy to migrate from EAR/WAR. Long story short, extract the new Confluence archive, edit the confluence/WEB-INF/classes/confluence-init.properties to point at your existing home directory and then start Confluence. The new Tomcat will be bundled in the archive and will take the place of the Tomcat that Confluence is using now. There can be some customizations in your existing Tomcat - this article describes how to deal with those: [How to migrate Confluence from an EAR or WAR Distribution to a Standalone version](https://confluence.atlassian.com/confkb/how-to-migrate-confluence-from-an-ear-or-war-distribution-to-a-standalone-version-707626290.html)

1- For the sequence of actions, Install the Java upgrade, and upgrade SQL Server after you shut down Confluence 5.5 and before you start Confluence 6.7. That way while Confluence 5.5 is running it will be using [supported platforms for 5.5](https://confluence.atlassian.com/display/CONF55/Supported+Platforms) then when you start Confluence 6.7 it will be running on [supported platforms for 6.7](https://confluence.atlassian.com/doc/supported-platforms-207488198.html)

If you use the installer for the upgrade, you won't even have to upgrade JAVA as the JAVA JRE is bundled with the installer.

2- Per our [Upgrading Confluence](https://confluence.atlassian.com/doc/upgrading-confluence-4578.html) doc there is no reason to upgrade to an intermediate version, from Confluence 5, upgrade directly to the latest version of Confluence 6. Please do review the upgrade doc because it has a lot of "before you start" info that could save you trouble later.

3 - The directories should be as described in [Confluence Home and other important directories](https://confluence.atlassian.com/doc/confluence-home-and-other-important-directories-590259707.html) if you have a standalone install.

4- After you migrate off EAR/WAR (to be completed before the upgrade) the instance will be like any other and you can use the installer method.

I look forward to any follow up questions and wish you the best of luck with the upgrade.

Cheers,

Ann


Tags: apache

collation

migration

ms-sql

server

update

windows