Maintaining a Liferay Installation

Migrating Liferay Instances

Liferay DXP 2026.Q4+

You can migrate virtual instances across different Liferay installations by exporting and importing database partitions. Additionally, you can copy virtual instances within the same installation. Export works on any installation that uses MySQL or PostgreSQL. However, importing and copying virtual instances require database partitioning.

Note

These actions require an omniadmin. By default, this includes any user with the Administrator role in the default virtual instance, though you can set the omniadmin.users portal property to restrict this to specific users. Administrators of other virtual instances can’t perform these actions. To export or import a virtual instance in Liferay SaaS, contact Liferay Cloud Support.

During export, Liferay creates a standalone partition with copies of tables from the current installation’s virtual instance database. This creates a new database schema called lexported_[companyId]. In the import step, Liferay integrates the standalone partition in the current installation’s database as a new virtual instance. Export, import, and copy move only database tables. They don’t include the instance’s stored Document Library files or its search indexes, so copy the files and reindex separately. See Operational Limits for details.

To move an instance to an installation without database partitioning, such as from Liferay SaaS to Liferay PaaS or Liferay Self-Hosted, use the exported schema as the new installation’s database instead of importing it. The schema contains every table the instance uses, so the new installation runs that instance on its own. The new installation must run the same Liferay version as the source.

Important

Export, import, and copy start only from the Virtual Instances page or the headless API. A configuration file deployed to start one does nothing and reports no error. On Liferay DXP 2025.Q2 through 2026.Q3, configuration files and System Settings start these actions. See Exporting, Importing, and Copying on Earlier Releases.

Validating a Database Partition

Liferay contains a tool to validate database partitions before performing a migration. It analyzes the source and target databases and indicates whether they are compatible.

Important

The source and target environments must use MySQL or PostgreSQL and must be on the same Liferay version.

The Database Partition Migration Validator Tool’s .sh script requires a Java runtime on your PATH. On Windows, the .bat script requires a Java runtime on your PATH or in JAVA_HOME. The tool operates in two modes: export and validation.

  1. Go to the [Liferay Home]/tools/portal-tools-db-partition-migration-validator folder. The folder contains the tool’s .jar file and the .sh and .bat scripts that run it. On Windows, use the .bat script wherever these steps use the .sh script.

  2. Export the source database’s information by executing db_partition_migration_validator.sh export with these parameters:

    • --company-id [arg]: Company ID of the virtual instance to export.
    • --jdbc-url [arg]: JDBC URL.
    • --output-dir [arg] (Optional): Directory where the tool writes the generated JSON file. By default, the tool writes to the exports folder.
    • --password [arg]: Password of the database user.
    • --schema-name [arg] (Optional): Database schema name of the source partition. By default, the tool uses the schema in the --jdbc-url parameter.
    • --user [arg]: Name of the database user.
    • --help (Optional): Display parameter information.
  3. Execute the same command for the target database. Set --jdbc-url or --schema-name to the target installation’s default schema, and set --company-id to a company ID that exists there, such as the default company ID.

    The two commands create JSON files with information on the source and target databases.

  4. Validate the two files by executing db_partition_migration_validator.sh validate with these parameters:

    • --source-file [arg]: File with the information of the source partition generated by the tool in export mode.
    • --target-file [arg]: File with the information of the target partition generated by the tool in export mode.
    • --help (Optional): Display parameter information.

The tool prints each problem on its own line, starting with [ERROR] or [WARN]:

  • An error means the databases aren’t compatible. For example, the source instance’s company ID already exists in the target database.
  • A warning names a value that already exists in the target database: the source instance’s name, virtual host, or Web ID. Set a different value for it when you import the instance.

The tool exits with 0 when it finds no problems, with 1 when it finds a problem or can’t run, and with 2 when its arguments aren’t valid.

Exporting a Database Partition

After validating the databases, you can export your virtual instance into a new schema that you can then import into another installation. When your installation uses MySQL or PostgreSQL, the Export action is available for every instance except the default one. Database partitioning is not required. Liferay doesn’t overwrite earlier exports. So, before attempting to export an instance again, drop its existing lexported_[companyId] schema to avoid conflicts.

  1. Navigate to Global Menu (Global Menu) → Control Panel → Virtual Instances.

  2. In the row for the instance to export, click Actions (Actions) → Export.

  3. In the Export Instance dialog, click Export to confirm.

The export runs in the background, and you receive a notification when it finishes. The notification names the new schema. See Asynchronous Virtual Instance Operations for more information on these background operations.

Important

During export, the source instance stays in use. Changes made during the export can leave the exported data inconsistent, so export the instance during a period of low traffic.

Importing a Database Partition

Importing a virtual instance requires database partitioning. When database.partition.enabled is false, the Import option doesn’t appear.

Note

The schema must be in the target installation’s database. If the source and target use different database servers, dump the lexported_[companyId] schema from the source’s server and restore it on the target’s server after the export’s success notification arrives.

  1. Navigate to Global Menu (Global Menu) → Control Panel → Virtual Instances.

  2. In the page header, click New (New) → Import.

  3. Complete these fields in the Import Instance dialog:

    • Schema Name: Enter the lexported_[companyId] schema the export created.
    • Name: Enter a name for the imported instance.
    • Virtual Host: Enter a virtual host for the imported instance.
    • Web ID: Enter a Web ID for the imported instance.

    Schema Name is required. Name, Virtual Host, and Web ID are optional, and leaving one blank keeps the exported instance’s value. Liferay checks a value for conflicts only when you supply one. Set Virtual Host and Web ID explicitly when the target installation already uses the exported instance’s values. Choose the Web ID carefully. You can’t change it after the import, and client extensions target an instance by its Web ID.

  4. Click Import.

The import runs in the background, and you receive a notification when it finishes. Reload the page to see the imported instance. Then run a full reindex and copy the file store, as described in Operational Limits.

Copying a Database Partition

Copying a virtual instance within the same Liferay installation requires database partitioning. The action is available for every instance except the default one.

  1. Navigate to Global Menu (Global Menu) → Control Panel → Virtual Instances.

  2. In the row for the instance to copy, click Actions (Actions) → Copy.

  3. Complete these fields in the Copy Instance dialog:

    • Name: Enter a name for the copy.
    • Virtual Host: Enter a virtual host for the copy.
    • Web ID: Enter a Web ID for the copy.
    • Destination Company ID: Enter a company ID for the copy, or leave it blank for Liferay to assign one.

    Name, Virtual Host, and Web ID are required. Destination Company ID is optional. You can’t change the copy’s Web ID afterward.

  4. Click Copy.

The copy runs in the background, and you receive a notification when it finishes. Reload the page to see the new instance.

Tip

To refresh a test instance with production data and keep its company ID, Web ID, and virtual host, delete the test instance first and wait for its delete notification. Then copy the production instance and enter the deleted instance’s values.

Troubleshooting

These messages appear if an export, import, or copy fails. Messages about invalid values appear right away in the dialog or on the Virtual Instances page. Messages about a failure after the operation starts appear in the failure notification.

MessageWhat It Means and What to Do
“Database partitioning must be enabled.”Copy and import require database.partition.enabled to be true.
“The default instance cannot be copied.”Copy is available only on an instance that is not the default instance.
“The default instance cannot be exported.”Export is available only on an instance that is not the default instance.
“The exported schema [Schema Name] already exists.”An earlier export of the same instance is still present. Drop the existing lexported_[companyId] schema before you export the instance again.
“An instance for this schema already exists.”The company ID in the schema name already belongs to an instance in this installation. An import keeps the exported instance’s company ID, so delete that instance before you import the schema, or import the schema into another installation.
“The exported schema does not exist.”No schema matches the schema name given for the import. Confirm the schema is present in the target installation’s database.
“Please enter a valid schema name.”The Schema Name value is missing or not valid. A valid value starts with lexported_. This message also appears when the company ID in the schema name is the installation’s default company ID.
“Please enter a valid destination company ID.”The Destination Company ID value is not a valid company ID. This message also appears when the ID already belongs to an instance in this installation. Leave the field blank for Liferay to assign one.
“Please enter a valid name.”The Name value is missing or not valid.
“Please enter a valid virtual host.”The Virtual Host value is missing, not valid, or already in use.
“Please enter a valid web ID.”The Web ID value is missing, not valid, or already in use.
“An unexpected error occurred.”The operation failed for a reason the application doesn’t map to a message. Check the Liferay log for the cause. In a failure notification, such a failure shows the underlying error message instead, and this message appears only when the error has no message.
“Copying an instance is already in progress.”A copy is already running on this node. Wait for it to finish.
“Importing an instance is already in progress.”An import is already running on this node. Wait for it to finish.

Operational Limits

  • One copy and one import run at a time on a node. On the Virtual Instances page, a second copy or import on that node fails, and the failure arrives as a notification. Through a /batch call, the server accepts the second request with a 202 response, and its task fails afterward. Liferay doesn’t serialize these operations across nodes, so in a cluster start one copy or import at a time.

  • You can export more than one instance at a time, but not the same instance twice while its earlier schema exists.

  • These operations copy the Document Library’s database rows but not its stored files. Copy the file store separately. With the default file system store, an instance’s files are in [Liferay Home]/data/document_library/[companyId].

  • Liferay doesn’t automatically reindex the new instance. Run a full reindex before you put the instance into use. See Reindexing All Content.

  • A failed copy deletes the schema it was copying into. A failed import moves the data back into the lexported_[companyId] schema, so you can import it again.

  • You can’t cancel an operation after you submit it.

Exporting, Importing, and Copying on Earlier Releases

Liferay DXP 2025.Q2 - 2026.Q3

First, validate the databases. On these releases, the validator’s folder has only the db_partition_migration_validator.sh script.

On Liferay DXP 2025.Q2 through 2026.Q3, these operations are behind the feature.flag.LPD-11342 beta feature flag. Each operation has its own entry under Global Menu (Global Menu) → Control Panel → System Settings → Platform → Virtual Instances: Instance Export, Instance Import, and Instance Copy. Liferay DXP 2026.Q3 also provides headless API endpoints behind the same flag. On 2026.Q3, the export call is POST /o/headless-portal-instances/v1.0/portal-instances/[webId]/export with no request body, and the copy call is POST /o/headless-portal-instances/v1.0/portal-instances/[webId]/copy with the source instance’s Web ID in the path. These two paths don’t exist on 2026.Q4, so change a script that calls them to the 2026.Q4 endpoints when you upgrade.

You can also trigger an operation by deploying a configuration file to [Liferay Home]/osgi/configs. Liferay deletes the file after the operation runs, so the operation isn’t repeated.

  • Export: com.liferay.portal.instances.internal.configuration.ExportPortalInstanceConfiguration.config, with the exportCompanyId key.

  • Import: com.liferay.portal.instances.internal.configuration.ImportPortalInstanceConfiguration.config, with the importCompanyId, newName, newVirtualHostname, and newWebId keys.

  • Copy: com.liferay.portal.instances.internal.configuration.CopyPortalInstanceConfiguration.config, with the sourceCompanyId, destinationCompanyId, name, virtualHostname, and webId keys.

On releases before 2025.Q3, these operations use the earlier extract and insert names. The schema prefix is lextracted_, the configuration keys are extractCompanyId and insertCompanyId, and the configuration files are named ExtractPortalInstanceConfiguration.config and InsertPortalInstanceConfiguration.config. The System Settings entries carry the matching earlier names.

To move a script off these configuration files, see Converting Configuration File Scripts.