2 Pack and Unpack Command Reference

This chapter describes the purpose, syntax, and parameters of the pack and unpack commands.

The commands are located in the ORACLE_HOME/oracle_common/common/bin directory.

This chapter includes the following sections:

2.1 The Pack Command

The pack command creates a template (a .jar archive file) that contains a snapshot of either an entire WebLogic domain or a subset of a WebLogic domain. You can use a template that contains a subset of a WebLogic domain to create a Managed Server domain directory hierarchy on a remote machine.

The following sections describe the files and directories that are included in the domain and Managed Server templates that you create by using the pack command.

2.1.1 Files and Directories Included in Domain Templates

All files and directories in the source WebLogic domain are included, with the following exceptions:

  • Temporary files that are created when you start a server

  • The servers directory

  • Files in the security directory that are created automatically when you create the WebLogic domain, such as DefaultAuthenticatorInit.ldift and XACMLRoleMapperInit.ldift

  • Persistent file stores, even if they are located with the domain. File stores are excluded whether they are defined for JMS or other file systems. If the file store is located within the domain, an empty file store directory will be created on the target system.

In addition to files within the domain directory, deployment plans located in external directories will be included in the template that is created by pack. These will be copied by unpack to the following standard location in the domain:

domain_home/config/deployments/deployment_name/plan

Note:

Plans already within the domain will not be relocated.

External directories include locations outside of the Oracle home directory, the domain home, and any location defined in the ORACLE_HOME/oracle_common/common/lib/internalpaths.txt file.

If you configured additional security data, such as for users, groups, or roles, through the Oracle WebLogic Server Administration Console or other online tools, the security data is stored in the LDAP server and is not included in the template. You must first export the data and then import it into the target WebLogic domain.

2.1.2 Porting Security Provider Data to a New Domain

Because it is an offline command, the pack command does not export security provider data, such as embedded LDAP data, into a domain template. After using unpack to create the new domain, you must manually port the security provider data to the new domain. To do so:

  1. If necessary, start the Administration Server for the original domain and log in to the original domain's Administration Console.
  2. Export the data from the original domain as described in Export data from a security provider in the Oracle WebLogic Server Administration Console Online Help.
  3. If necessary, start the Administration Server for the new domain and log in to the new domain's Administration Console.
  4. Import the data into the new domain as described in Import data into a security provider in the Oracle WebLogic Server Administration Console Online Help.

2.1.3 Files and Directories Included in Managed Server Templates

The following files and directories are included by default:

  • All files in the root directory with the following extensions: .cmd, .sh, .xml, .properties, and .ini.

  • Any files with the .pem extension defined in the SSL configuration for your WebLogic domain

  • All files and subdirectories in the config directory, with the exception of config.xml

  • bin directory

  • lib directory

The following files and directories are not included in a Managed Server template by default:

  • Applications and certain application initialization files

  • config.xml

  • Temporary files that are created when you start a server

  • The servers directory

  • Files in the security directory that are created automatically when you create the WebLogic domain, such as DefaultAuthenticatorInit.ldift and XACMLRoleMapperInit.ldift.

You can pack any domain, whether or not it specifies specific names or ports for the servers in the domain. You can then unpack the domain on any machine, but servers that are defined in the config.xml file to use specific machines and ports will not work on other machines. You must therefore unpack the same template on each remote node for all servers to start successfully on their appropriate nodes and machines.

2.1.4 Node Manager Configuration

Node Manager configuration is not preserved by pack and unpack for both managed and non-managed modes. The Node Manager type is always set to PerDomainNodeManager by default in the unpacked domain.

If the Node Manager type in the original domain was CustomLocationNodeManager, when unpacking the domain, you must include the -nodeManagerType and -nodeManagerHome parameters in the unpack command to preserve the configuration.

If the Node Manager type in the original domain was ManualNodeManagerSetup, you must manually reconfigure Node Manager after unpacking the domain on each remote machine.

If a ManualNodeManagerSetup configuration was used for the original domain, the Node Manager configuration information is discarded from the template that is created by pack. When unpacking the domain, specify ManualNodeManagerSetup using the -nodeManagerType parameter. After unpacking the domain, you must manually configure Node Manager.

For information about Node Manager types, see Default Node Manager Configuration in Administering Node Manager for Oracle WebLogic Server.

Node Manager credentials, which are stored in config.xml, are copied from the packed domain to the unpacked domain.

2.1.5 Syntax of the Pack Command

pack -domain=domain -template=template -template_name="template_name" 
[-template_author="author"] [-template_desc="description"] [-managed=true|false]
[-log=log_file] [-log=log_file] [-log_priority=log_priority]

2.1.6 Parameters of the Pack Command

Table 2-1 lists the parameters of the pack command.

Table 2-1 Parameters of the Pack Command

Parameter Required or Optional Description

-domain=domain

Required

The full or relative path for the WebLogic domain from which the template is to be created.

-template=template

Required

The full or relative path and file name of the template to be created. The template filename must include the .jar extension.

Note: The pack command does not overwrite existing files. If the file name that you specify matches the name of an existing file in the specified folder, the pack command fails.

-template_name="template name"

Required

Descriptive name for the template. Quotes are required only if the value contains spaces.

-template_author="author"

Optional

The name of the author of the template. Quotes are required only if the value contains spaces.

-template_desc="description"

Optional

Description of the template. Quotes are required only if the value contains spaces.

-managed=true|false

Optional

Specifies whether the template is to be used to create Managed Servers on remote machines. The default is false.When this parameter is set to true, a Managed Server template is created that contains a minimal set of files, including SerializedSystemIni.dat and nm_password.properties. It also includes a domain.properties file that is unique to the Managed Server template. Applications and certain application initialization files are not included. The resulting template can be used to create Managed Servers on remote machines.

Note: As of WebLogic Server 12.1.2, you can use the WLST writeTemplate command in online mode. This makes it easier to create or update remote Managed Server domains. For more information, see writeTemplate in WLST Command Reference for WebLogic Server.

-log=log_file

Optional

Name of the log file.

-log_priority=log_priority

Optional

The priority setting for the log file. Use a log4j priority string.

Valid log4j priority strings are debug, info, warn, error, and fatal. The priority string values correspond to the levels defined in the Level class. For more information, see http://logging.apache.org/log4j/.

2.1.7 Example of the Pack Command

To create a template JAR file based on an existing WebLogic domain named mydomain that is located in the C:/oracle/user_projects/domains directory, run the following command:

pack -domain=C:/oracle/user_projects/domains/mydomain 
-template=C:/oracle/user_templates/mydomain.jar -template_name="My WebLogic Domain"

A template file named mydomain.jar is created in the C:/oracle/user_templates directory. The name of the template is My WebLogic Domain.

2.2 The Unpack Command

The unpack command creates a full WebLogic domain or a subset of a domain that is used for a Managed Server domain directory on a remote machine.

You should use unpack only with a template that is compatible with your current installation. The current installation binaries must exist on the machine on which you are running the unpack command. The template can be any of the following:

  • A domain template that is packaged with your current installation

  • A domain template created by using the Domain Template Builder or WLST

  • A domain template created by using the pack command

  • A Managed Server template created by using the pack command

When you use the unpack command with a domain template, it creates a WebLogic domain containing all of the application and resource files defined in the template. It also creates necessary start scripts, and certain security and configuration files.

Note:

The source domain must have both an administrator user and administrator password defined for the domain. Otherwise, an error is displayed when running the unpack command. The administrator password comes from the wallet that is specified by the walletDir option when the unpack command is run on a template that is created by the pack command in which the managed parameter is set to false.

When you use the unpack command with a Managed Server template, it creates a Managed Server domain directory that includes the following:

  • A customized start script for each Managed Server in the WebLogic domain

  • config_bootstrap.xml file (based on the config.xml in the template)

  • nm_password.properties file

  • SerializedSystemIni.dat file

An entry for the Managed Server domain directory is also created in the NM_HOME /nodemanager.domains file, where NM_HOME is the node manager home directory for the product installation on the remote machine. The location of this directory depends on the Node Manager type. For more information on Node Manager type and Node Manager home, see Table 2-2.

Note:

By default, application files are not included in a Managed Server template created by using the pack command. If an application in the WebLogic domain from which you created a Managed Server template was deployed by using the external_stage mode, the Managed Server domain directory that you create with the unpack command does not contain any of the externally staged applications. Before you start the Managed Server, you must ensure that it has access to the externally staged application files.

For more information, see the Controlling Deployment File Copying with Staging Modes section in the Deploying Applications to Oracle WebLogic Server guide.

2.2.1 Syntax of the Unpack Command

unpack [-initialize] -template=template -domain=domain [-walletDir=directory] 
[-user_name=username] [-password=password] [-app_dir=application_directory] 
[-nodemanager_type=type] [-nodemanager_home=nodemanager_home_directory] 
[-java_home=java_home_directory] [-server_start_mode=dev|prod] 
[-overwrite_domain] [-log=log_file] [-log_priority=log_priority]

2.2.2 Parameters of the Unpack Command

Table 2-2 lists the parameters that you can use with the unpack command.

Table 2-2 Parameters of the Unpack Command

Parameter Required or Optional Description

-initialize

Optional

This parameter applies only to WebLogic domains in which Fusion Middleware products are installed.

Note: When setting this parameter to true, ensure that the source database is running. If it is not running, the unpack command will fail.

When this parameter is true and the managed parameter for pack was set to false when the domain was packed, it initializes all config-mapping.xml values in the Service Table and the Oracle Web Services Manager (OWSM) data store regardless of the reprocess attribute setting for the entry in config-mapping.xml.

When this parameter is true and the managed parameter for pack was set to true when the domain was packed, it initializes only those config-mapping.xml values in the Service Table and the Oracle Web Services Manager (OWSM) data store for which the reprocess attribute setting for the entry in config-mapping.xml is set to true.

When this parameter is false, no config-mapping.xml values are initialized.

For information about Service Tables, see Understanding Service Tables in Administering Oracle Fusion Middleware.

-template=template

Required

The full or relative path and filename of the template from which the WebLogic domain is to be created.

-domain=domain

Required

The full or relative path of the WebLogic domain to be created.

-walletDir

Optional

The directory in which the wallet file that contains the password for unpack to use for the administration user. This is the same directory as was specified when you created the wallet file using the configWallet.sh command. For example:

-walletDir $HOME/wallet

If you want to create a different administrator user for the domain you are unpacking:

  1. In the createWallet.sh command, include the -create admin_name parameter to define the administrator user name.

  2. In the unpack command, include the -user_name=admin_name parameter, using the same admin_name as you used in the createWallet command.

Note:

The walletDir option must be used even when the managed parameter is set to false, whether or not you want to use a different administrator user.

-user_name=username

Optional

The username for the default administrator as currently defined in the template or via the WalletDir. This username is used to boot the Administration Server and connect to it. If you specify a new password for the default administrator, the password is reset to the value specified.

If no administrative users are defined in the template, you can create a new default administrator by using createWallet.sh and the -user_name parameter or by specifying the -user_name and password parameters.

If a default administrator and password are currently defined in the template, you can add a new administrative user by createWallet.sh and the -user_name parameter or by specifying the -user_name and password parameters

The value must not include commas, tabs, or any characters in the following list: < > # | & ? ( ) { }. Usernames are case sensitive.

A valid password consists of a string of at least eight case-sensitive characters. The unpack command encrypts the password value.

Note: This parameter is not applicable if you are creating a WebLogic domain using a Managed Server template.

-password=password

Optional

This parameter has been deprecated. For better security, use the walletDir parameter instead to specify the password for the administrator user. If you use this parameter:

  • If you specify a new password for the default administrator, the password is reset to the value specified.

  • If a password for the default administrator is not defined in the template, you must specify one.

A valid password consists of a string of at least eight case-sensitive characters. The unpack command encrypts the password value.

Note: This parameter is not applicable if you are creating a WebLogic domain using a Managed Server template.

-app_dir=application_directory

Optional

The full path to the directory used to store the applications defined in the template.

This parameter is applicable only if the template supports a separate applications directory.

-nodemanager_type=type

Optional

Sets the Node Manager type for the domain you are creating. Specify one of the following types:

  • PerDomainNodeManager - If you specify this type, the Node Manager home is defined within the domain as <domain_name>/nodemanager. The Node Manager for each domain can have a different configuration, as determined by the files in this directory.

  • CustomLocationNodeManager - Specify this type if you want the Node Manager configuration files to be created in a specific location. If you specify this type, you must include the nodemanager_home argument to specify the Node Manager home directory. The specified directory must be empty.

  • ManualNodeManagerSetup - Specify this type if you want to use an existing Node Manager configuration. If specified, the Node Manager configuration for the domain is ignored, and you must manually configure the Node Manager configuration.

The default value is PerDomainNodeManager.

-nodemanager_home=home

Conditional

If the specified Node Manager type is CustomLocationNodeManager, this argument is required. Enter the full path to the Node Manager location you want to use.

If the specified Node Manager type is not CustomLocationNodeManager, this argument is not required. If included, it is ignored.

-java_home=java_home_directory

Optional

The full path to the Java home directory. When set, this parameter identifies the default JVM used by the Administration Server for the WebLogic domain.

This parameter is not applicable if you are creating a WebLogic domain based on a Managed Server template.

-server_start_mode=dev|prod

Optional

The start mode for the Administration Server: dev or prod. The default value is dev.

Note: If you want the unpacked domain to run in production mode, you must include this parameter in the unpack command and specify prod. Otherwise the unpacked command will be created in development mode.

This parameter is not applicable if you are creating a WebLogic domain by using a Managed Server template.

If dev mode is specified or if this parameter is omitted, a boot.properties file is created for the domain. If prod mode is specified, a boot.properties file is not created for the domain.

overwrite_domain

Optional

If the specified domain directory already exists and is not empty, no warnings to that effect are displayed, and the files in the directory are automatically overwritten. No attempt is made to merge or preserve local customizations.

Note: If a system error occurs after domain generation starts, the domain directory will be in an unknown state.

-log=log_file

Optional

Name of the log file.

-log_priority=log_priority

Optional

The priority setting for the log file. Use a log4j priority string.

Valid log4j priority strings are debug, info, warn, error, and fatal. The priority string values correspond to the levels defined in the Level class. For more information, see http://logging.apache.org/log4j/.

2.2.3 Example for the Unpack Command

To create a WebLogic domain named mynewdomain in the C:/oracle/user_projects/domains directory, by using the mydomain.jar template in the C:/oracle/user_templates directory, run the following command:

unpack -template=C:/oracle/user_templates/mydomain.jar 
-domain=C:/oracle/user_projects/domains/mynewdomain