Data Base Migration is critical task when we are doing the Liferay
Upgradation project. Database comes first everywhere which you must require to
migrate to make it compatible with the new version.
This blog will help you details about the Data Base Upgradation.
Note: Liferay 6.2 and Liferay 7.1 database version should be same , if
it is not the same then first upgrade the database version then do the Liferay
Database upgradation process.
Steps for Data Migration :-
- Once
the database backup is done (Better Liferay Server is not up while taking
a backup), we need to upgrade the database with respect to Liferay DXP.
(We will use same backup if we face any issues while migrating database).
- Disable
indexing so that indexer doesn’t try to run during the upgrade.
Add below .cfg file in following server path - [Liferay Home]/osgi/configs
com.liferay.portal.search.configuration.IndexStatusManagerConfiguration.cfg
with following content:- indexReadOnly=true.
Note: By adding the above file you will avoid indexing and save time
during the upgrade process. Once you have upgraded your portal, remove
that property or set it to false so that you can index all objects from
control panel.
- Check
the Liferay 7.1 server is down while doing the database migration.
- Open
the directory:- liferay-dxp-7.1.10-ga1/tools/portal-tools-db-upgrade-client/
- Open
the app-server.properties file.
- Edit
the following properties under the Tomcat section to uncomment them
1.
dir=../../tomcat-9.0.6
2.
extra.lib.dirs=/bin
3.
global.lib.dir=/lib
4.
portal.dir=/webapps/ROOT
5.
server.detector.server.id=tomcat
- Open
the portal-upgrade-database.properties in the same directory as portal-tools-db-upgrade-client
- Edit
the following properties under the MySQL section to point to the
"inthiyaz7.1"database (I have created database schema as
"inthiyaz7.1" ).
1. jdbc.default.driverClassName=com.mysql.jdbc.Driver
2. jdbc.default.url=jdbc:mysql://localhost/lportal?characterEncoding=UTF-8&dontTrackOpenResources=true&holdResultsOpenOverStatementClose=true&useFastDateParsing=false&useUnicode=true
3. jdbc.default.username=root
4. jdbc.default.password=password
·
Make sure added username
and password is right.
- Open the portal-upgrade-ext.properties
in same directory.
·
Edit the below property
to uncomment
·
liferay.home=../../
·
Run the following
command to start the database upgrade client.
·
./db_upgrade.sh
The database upgrade client will first bootstrap the OSGi container. You
will see something like the following in the logs:
```
${TIMESTAMP}
INFO [Start Level: Equinox Container:
${CONTAINER.ID}][BundleStartStopLogger:35] STARTED ${OSGI.BUNDLE.NAME} [${OSGI.BUNDLE.ID}]
```
- After
the OSGi container successfully started, the database upgrade client
detects the previous Liferay version info in the database in the Release_
table. If a previous version of Liferay is detected, then the database
upgrade client automatically runs the core data upgrade process. You
should see something like the following in the log:
·
${TIMESTAMP} INFO [main][UpgradeProcess:86] Upgrading
com.liferay.portal.upgrade.UpgradeProcess_7_0_0
·
${TIMESTAMP} INFO [main][UpgradeProcess:86] Upgrading
com.liferay.portal.upgrade.v7_0_0.UpgradeSchema
- After
the core data upgrade process is finished, the verification process will
kick off.
·
...
·
${TIMESTAMP} INFO [main][UpgradeProcess:103] Completed upgrade
process com.liferay.portal.upgrade.PortalUpgradeProcess in xxxms]
·
...
·
${TIMESTAMP} INFO [main][VerifyProcess:66] Verifying
com.liferay.portal.verify.VerifyProcessSuite
·
...
·
${TIMESTAMP} INFO [main][VerifyProcess:81] Completed
verification process com.liferay.portal.verify.VerifyProcessSuite in xxxms
- If the
upgrade tool’s autoUpgrade property is set to “true” (which is the default
setting), the upgrade process automatically runs the upgrade process for
all the modules. You will see something like the following in the log (use
the com.liferay.calendar.web module as an example):
·
${TIMESTAMP} INFO [main][UpgradeProcess:86] Upgrading
com.liferay.calendar.web.internal.upgrade.v1_0_0.UpgradePortletId
- If no
exception occurred, the update progress is completed with the following message:
·
Completed
Liferay core upgrade and verify processes in 178 seconds
·
Checking to
see if all upgrades have completed... done.
Note :- However, the message above does not
guarantee you have a successful upgrade. Always check the entire upgrade log to
see if there are any exceptions that came up during the upgrade. If there are
no exceptions, then the upgrade process is successfully finished. For this
exercise, there should not be any exceptions.