Using the Database Upgrade Tool¶
The Liferay Database Upgrade Tool is a client program for upgrading Liferay DXP and Liferay Portal databases offline.
Always back up your data and installation before upgrading. Testing the upgrade process on backup copies is advised.
If you’re upgrading from 6.2 or earlier, update your file store configuration. See the Updating the File Store for more information.
Modifying a database while it’s detached from your Liferay instance allows you to tune the database for upgrade operations, prune unnecessary data (e.g., unneeded versions of Web Content, Documents, and more) to improve upgrade performance, and resolve upgrade issues. These activities are especially important for upgrading DXP and any large, critical Portal environments safely and as quickly as possible. After you’ve accounted for tuning and pruning the database and completing relevant tasks described in Upgrade Basics, you’re ready to setup up the new installation and upgrade the database using the upgrade tool.
If you’re upgrading to a new Liferay Docker image and want to use the upgrade tool, use it from a Liferay Tomcat Bundle of the new Liferay version. The tool is in the bundle’s
If you installed the new Liferay release on an application server, create a
[Liferay Home]/tools/portal-tools-db-upgrade-client folder, download the upgrade tool, and install the tool to the new folder.
Liferay DXP (Subscription)
Go to the Downloads page and select the DXP version and the Product/Service Packs file type. In the listing that appears, click Download for the Liferay DXP Upgrade Client.
Go to the Downloads page. In the Liferay Portal downloads menu, select Other files and click Download. The latest Liferay Portal release assets GitHub page appears. Click on
Setting Up a New Installation¶
Replace the new Liferay installation’s
[Liferay Home]/datafolder with the
[Liferay Home]/datafolder from your backup.
If you’re upgrading to 7.2, disable search indexing using a configuration file in your new installation’s
[Liferay Home]/files/osgi/configs/folder. For example,
mkdir -p osgi/configs
echo "indexReadOnly=\"true\"" >> osgi/configs/com.liferay.portal.search.configuration.IndexStatusManagerConfiguration.config
DXP/Portal 7.3+ disables/re-enables search indexing automatically.
If you want to upgrade your Marketplace app data along with the Liferay database upgrade, download the latest version of each app targeted for the new Liferay version and copy it to your
[Liferay Home]/deployfolder. Otherwise, you can install the apps after the database upgrade and upgrade their data as described in the Post-Upgrade Considerations.
If you’re using Advanced File System Store or Simple File System Store with a modified storage location, export your file store settings to a
.configfile and copy it to your new
If you’re using Advanced File System Store, you must configure it with a
.configfile in the new installation before upgrading the database.
Here’s an example
com.liferay.portal.store.file.system.configuration.AdvancedFileSystemStoreConfiguration.configfile with the required
Use your database vendor’s recommended JDBC database driver. If you’re using MySQL, for example, set
portal-ext.propertiesfile and replace the MySQL JDBC driver JAR your app server uses. See Database Drivers for more details.
You can configure the upgrade by answering the upgrade tool prompts or by using upgrade properties files.
Optionally, enable upgrade reporting to log the environment, changes, and more to a report.
echo "upgrade.report.enabled=\"true\"" << tools/portal-tools-db-upgrade-client/portal-upgrade-ext.properties
Running the Upgrade Tool¶
The upgrade tool is configured via its command line interface, or by using properties files.
db_upgrade.sh script in the
[Liferay Home]/tools/portal-tools-db-upgrade-client folder invokes the upgrade tool. The
--help option describes the tool’s usage.
Here’s how to upgrade your database with the upgrade tool:
Start the upgrade tool. Here’s an example command:
./db_upgrade.sh -j "-Dfile.encoding=UTF-8 -Duser.timezone=GMT -Xmx4096m"
The command above executes the upgrade tool with the same JVM options recommended for the application server. File encoding (
UTF-8), time zone (
GMT), country, language, and memory settings (
-Xmx value) should all match your application server’s settings. For databases with over 10 GB of data, allocate additional memory using the
If you haven’t configured the upgrade using the upgrade properties files, the upgrade tool prompts you for configuration values and shows default values in parentheses. Here’s an example interaction:
Please enter your application server (tomcat): tomcat Please enter your application server directory (../../tomcat-9.0.17): Please enter your extra library directories (../../tomcat-9.0.17/bin): Please enter your global library directory (../../tomcat-9.0.17/lib): Please enter your portal directory (../../tomcat-9.0.17/webapps/ROOT): [ db2 mariadb mysql oracle postgresql sqlserver sybase ] Please enter your database (mysql): mariadb Please enter your database host (localhost): (etc.)
If you want to use the default value shown in a prompt, press enter.
After configuration completes, the upgrade starts. The tool logs each upgrade process start and completion.
You have completed the database upgrade and resolved any issues.
Test the Upgraded Database¶
Now that the database upgrade is complete, test it.
If you’re upgrading to a new Liferay Docker image, point your image to the upgraded database and validate Liferay with the database. Please see Configuring Liferay Containers for more information.
Examine the Post-Upgrade Considerations.
/license/*: Activation keys. (Subscription)
/log/*: Log files.
/osgi/configs/*.config: OSGi configuration files.
portal-*.properties: Portal properties files, such as
Application server files: Modified scripts and configuration files.
web.xml: Portal web application descriptor.
Update the Portal properties in your new installation.
Start your server and validate Liferay with its upgraded database.
You’ve upgraded your Liferay database using the Database Upgrade Tool.
If this was a trial upgrade and you want to shorten the upgrade time, tune your database for upgrade (if you haven’t already) and remove unnecessary data from the database. Repeat this article’s steps as necessary.
Revisit Upgrade Basics to see what’s left to upgrade.