Database Upgrade Error
“Help! We attempted to upgrade our PaperCut NG/MF server, but in the process we saw an error page in the browser that said “Database upgrade error”. What does this mean and how can we fix it?”
You may have stumbled across this error page while upgrading your PaperCut server. It means that during the upgrade process, the installer encountered an error when attempting to upgrade the database. This error page is intimidating, but contains useful clues to understand why the upgrade failed. This article mentions the errors and their corresponding resolutions that we know of.
util.ApplicationException: A previous database upgrade process from schema 39 did not complete successfully. The details of the previous upgrade are logged to ‘server/logs/server.log’.
This message tells us that the PaperCut server can’t be upgraded because the previous upgrade failed for any number of reasons. This behavior was introduced in PaperCut NG/MF 16.1 to prevent damage to the database that could be caused by re-running upgrade scripts on a partly upgraded database.
Here are two ways to recover from this situation…
- Restore the database from the most recent backup, following these steps to Downgrade PaperCut
- Check the most recent server.log file to attempt to uncover the root cause of the upgrade failure. If the problem (such as insufficient permissions) has been addressed, then follow the steps below reset the “db-upgrade-in-progress” flag and continue with the upgrade.
- On the PaperCut NG/MF Server, stop the Primary PaperCut Application server service.
- Now, open an Administrator level command prompt or terminal window.
- In the terminal window, navigate to the PaperCut db-tools.exe executable. On a 64-bit Windows server running PaperCut MF, the command for this is “CD C:\Program Files\PaperCut MF\server\bin\win”.
- Run the command
db-tools.exe set-config -y system.db-upgrade-in-progress N.
- Start the PaperCut NG/MF Application Server Service.
- Navigate to the web interface of the PaperCut server to observe the database upgrade and watch out for any new errors.
2021–05–21 10:37:03,722 ERROR liquibase:62 - C:/Program PaperCut MF/server/lib/sql/changelogs/db.changelog-master.yaml: changelogs/db.changelog-pc-003-release-18.2.yaml::pc-003-add-user-sync-source-columns::papercut-core: Change Set changelogs/db.changelog-pc-003-release-18.2.yaml::pc-003-add-user-sync-source-columns::papercut-core failed. Error: Cannot find the object “tbl_user” because it does not exist or you do not have permissions. [Failed SQL: ALTER TABLE [dbo].[tbl_user] ADD [primary_user_source_type] [varchar](30)] [WrapperSimpleAppMain]
In this example, the upgrade failed with the message “Liquibase operation failed” followed by “Cannot find the object ‘tbl_user’ because it does not exist or you do not have the permissions.” This has been seen to happen with Microsoft SQL databases when the service account does not have database owner (DBO) permissions.
- On the PaperCut NG/MF server, confirm what user account is used to connect to the database by checking the connection details in the server.properties file. On a 64-bit PaperCut NG/MF server running on Windows this file can be found in C:\Program Files\PaperCut MF\server\server.properties.
- Open this file using a plain-text editor like Notepad or Textedit as an Administrator.
- Look for the line starting with “database.username=” under the relevant database type to see the name of the user account.
- Confirm that this user account has db_owner permissions on the PaperCut database.
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set changelogs/db.changelog-pc-010-change-column-type-to-nvarchar-for-sql-server.yaml::pc-010-change-document_name-column-type::papercut-core: Reason: liquibase.exception.DatabaseException: The transaction log for database ‘Papercut’ is full due to ‘ACTIVE_TRANSACTION’.
This error happens when the transaction log on the database is full. One solution we’ve heard from customers is to edit the options on the database to allow “simple” growth mode for the upgrade period.
Still have questions?
Let us know! We love chatting about what’s going on under the hood. Feel free to leave a comment below or visit our Support Portal for further assistance.
Keywords: TODO, TODO