This chapter includes the following sections:
Using WLST (online or offline), a Representational State Transfer (REST) API (online only), or the WebLogic Server Administration Console (online only), system administrators can export a domain partition and then import a previously exported partition into a different domain.
Exporting and importing partitions lets you easily move partitions from one domain to another, including the applications that are deployed to the partition. This feature is useful for replicating partitions across domains and for moving domains from a development to a production environment.
When a partition is exported from the source domain, it is packaged in a partition archive file that includes:
The partition configuration
Any resource groups contained in the partition
Any resource group templates referred to by those resource groups
The contents of the partition's file system, <
partition-file-system
>/config
directory
Optionally, application binary files and configurations for applications deployed to the partition
No application runtime state, nor application-specific runtime configuration is included in the partition archive file. Other examples of what would not be exported are JMS messages in queues and users in an embedded LDAP realm.
You can use the WLST exportPartition
command to create a partition archive file, <
PartitionName
>.zip
. It copies a partition's configuration into the archive file as well as (optionally) the partition's applications and libraries. This command also creates the attributes.json
file that you can use to modify the partition's configuration on import.
The command syntax is:
exportPartition(partitionName, expArchPath, [includeAppsNLibs], [keyFile])
partitionName
is the name of the partition to export, expArchPath
is the full path to the directory in which to save the partition archive file, includeAppsNLibs
(optionally), specifies whether to include application and library binary files in the partition archive file, and keyFile
(optionally), provides the full path to a file containing a string to use as the encryption key to encrypt attributes in the partition archive file. See Exporting Domain Partitions: WLST Example.
A partition archive is a .zip
file containing these specific partition-related files:
Files and Directories | Description |
---|---|
|
Contains the partition configuration and resource group templates configuration from |
|
Includes a time stamp and domain information for the archive file. |
|
Contains the MBean attributes and properties which can be changed by the administrator while importing the partition. In addition to being contained in the archive file, a copy of this file is also located with the archive file in the file system to make it easier to update. |
|
Contains the encrypted secret key used for encrypting and decrypting encrypted attributes. |
|
Contains files related to any resource group template associated with this partition. |
|
Specifies the configuration files under |
|
Contains the |
|
Contains resource group template-level binary files. |
|
Contains resource group-level application binary files. |
A prerequisite to importing a partition is that the server instance must already have a domain configured. When a partition is imported into a new domain, some external systems may need to be configured to be aware of the newly imported partition. While importing a partition archive file, the system administrator may need to update the dependencies on the domain (like virtual targets, security realms, and resource group templates) and also optionally update other attributes in the partition configuration to make it valid, such as partition properties, JDBC, JMS, and other resources in resource groups. In addition, applications and system resources need to be deployed for the new partition.
During the import operation, the system administrator can override specific portions of the partition configuration by supplying a <
PartitionName
>-attributes.json
file with modified attributes suitable for the target domain. However, changing the value of the name
attribute is not supported; for example, "name
" : "P1
" in the following sample <
PartitionName
>-attributes.json
cannot be changed.
{ "partition" : { "name" : "P1", "jdbc-system-resource-override" : { "URL" : "url.com", "Id" : "0", "name" : "test123", "CachingDisabled" : "false", "Registered" : "false", "User" : "test123", "DynamicallyCreated" : "false", "DataSourceName" : "test-source" }, "resource-group-template" : { "name" : "RGT1", "jdbc-system-resource" : { "name" : "jdbc1", "descriptor-file-name" : "jdbc/P1DB1-8882-jdbc.xml" } "jms-server-resource" : { "name" : "jms1", "PagingDirectory" : "" } } }
In the prior example, all the JDBCSystemResourceOverrideMBean
attributes are copied to the <
PartitionName
>-attributes.json
file along with their current values.
If a resource group template already exists in the target domain, then you must use the createNew
option to overwrite the existing resource group template and create a new one using a new name. (See Step 2 in Importing Domain Partitions: Main Steps.)
When a partition is exported, whether or not application binary files are included in the partition archive file is determined by the value of the includeApps
option on the export operation. If includeApps
is true
, then the binary files are included. If false
, then they are excluded. The <
PartitionName
>-attributes.json
file contains attributes for the application or library source path, deployment plan path, and staging mode. You can change these attributes in the <
PartitionName
>-attributes.json
file.
The includeApps
option also affects how the application is deployed upon being imported:
If true
(default), then the deployment files are copied to <domain-dir>/<server>/upload
or <partition-dir>/<server>/upload
, depending on whether it is a resource group template-level application or resource group-level application, and deployed using the original staging mode. If the staging mode is NOSTAGE
or EXTERNAL
(on the targeted server), then the system administrator is responsible for making the application available from the correct location in the target domain.
If false
, then the system administrator is responsible for making the application available from the correct location in the target domain.
During the export operation, a new secret key is generated and stored in the expPartSecret
file in the exported <
PartitionName
>.zip
file. All the encrypted attributes in the partition-config.xml
file and any system resource descriptors that are part of <
PartitionName
>.zip
will be encrypted using the new secret key in the expPartSecret
file. Alternatively, you can provide your own secret key by using the keyFile
option.
During the import operation, after the entire partition is read and the attributes changed in accordance with the <
PartitionName
>-attributes.json
file, the following steps are used to process encrypted attributes:
The secret key in the expPartSecret
file in the exported .zip
is read.
The secret key is decrypted using a second key that is either the default key in the WebLogic Server source, or the key provided using the keyFile
option to import. The user-provided key must match the key used on import.
All the encrypted attributes in the partition MBean (read and modified in the export operation) are decrypted using the key read from the expPartSecret
file.
All the encrypted attributes in the partition MBean are encrypted with the domain-specific key (SerializedSystemIni.dat
) for the imported domain.
You can export a domain partition (the source domain) with its entire configuration and data, as a partition archive file. With few configuration changes, you can then import the partition archive file into another instance of WebLogic Server MT (the target domain). You might need to update domain dependencies, such as virtual targets and security realms, and optionally update other attributes in the partition configuration to make it valid.
Prior to exporting a domain partition, you must first have created or imported one.
The main steps for exporting domain partitions are as follows:
The following WLST command exports partition-1
to the /var/tmp
directory. Application and library binary files are not included. /home/foo/mykeyfile
is the path to the mykeyfile
encryption key.
wls:/mydomain/serverConfig> exportPartition("partition-1", "/var/tmp/", false, "/home/foo/mykeyfile")
Prior to importing a domain partition:
You must have previously exported a domain partition (the source domain) to a partition archive file.
The server instance must already have a domain configured (the target domain).
The main steps for importing domain partitions are as follows:
The following WLST command imports the partition-1
archive file located in the /var/tmp
directory. Application and library binary files are not included. The file /home/foo/mykeyfile
is used as the encryption key.
wls:/mydomain/serverConfig> importPartition("/var/tmp/partition-1.zip", keyFile="/home/foo/mykeyfile")
See the following for additional information:
"Export domain partitions" and "Import domain partitions" in Administering Oracle WebLogic Server with Fusion Middleware Control
"Export partitions" and "Import partitions" in Oracle WebLogic Server Administration Console Online Help