How To Migrate Weblogic Domain

Oracle Weblogic Server

There are easy ways to migrate your weblogic domain from one physical machine to another physical machine like physical box to some virtual box.

same approach for a physical-to-physical migration should be used for the physical-to-virtual too.

– You can use pack/unpack commands provided by Oracle.
– You can also manually create a domain template if you prefer using the Domain Template Builder.

Here we will discuss pack and unpack way which is largely used.

pack Command –

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

Below describes the files and directories that are included in the templates that you create by using the pack command

Template Type:
Domain

Files and Diretories:

All files and directories in the source 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 domain, such as DefaultAuthenticatorInit.ldift and XACMLRoleMapperInit.ldift

Note:If you configured additional security data, such as for users, groups, or roles, through the 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 domain.

Template Type:
Managed server

Files and Diretories:

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 domain
•bin directory
•lib directory
•All files and subdirectories in the config directory
The following files and directories are not included in a managed server template by default:
•Applications and certain application initialization files
•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 domain, such as DefaultAuthenticatorInit.ldift and XACMLRoleMapperInit.ldift.

Note:The config.xml file of the domain from which you are creating your template must contain managed server definitions that specify the IP address and port for the target remote machine. The managed server template that you create from that domain can only be used, with the unpack command, on the specified remote machines to create managed server domain directories for the managed servers defined in the config.xml file.

Syntax

pack -domain=domain -template=template -template_name=“template_name” [-template_author=“author”][-template_desc=“description”] [-managed={true|false}][-log=log_file] [-log_priority=log_priority]

PARAMETERS:

-domain=domain                                     Required The full or relative path for the domain from which the template is to be created.
-template=template                                 Required The full or relative path and filename of the template to be created. The template filename must include the .jar extension.
-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, config.xml, 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.
-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/docs/api/org/apache/log4j/Level.html.

Example
To create a template based on an existing domain named mydomain that is located in the C:\bea\user_projects\domains directory, run the following command:

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

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

unpack Command

Using the pack and unpack Commands

– 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 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.

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 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 designates the node manager installation directory for the product installation on the remote machine. By default, this directory is located in WL_HOME/common/nodemanager.

Note:By default, application files are not included in a managed server template created by using the pack command. If an application in the 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 will not contain any of the externally staged applications. Before you start the managed server, you will need to make sure that it has access to the externally staged application files.

Syntax

unpack -template=template -domain=domain [-user_name=username] [-password=password] [-app_dir=application_directory] [-java_home=java_home_directory] [-server_start_mode={dev|prod}] [-log=log_file] [-log_priority=log_priority]

Parameters

-template=template       Required The full or relative path and filename of the template being used to create the domain.
-domain=domain           Required The full or relative path of the domain to be created.
-user_name=username
-password=password       Optional The username and password for the default administrator as currently defined in the template. This username-password combination is used to boot the administration server and connect to it. If you specify a new password for the default administrator, the password will be reset to the value specified.

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

If no administrative users are defined in the template, you can create a new default administrator 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 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:These parameters are not applicable if you are creating a domain using a managed server template.
More Parameters:

-app_dir=application_directory   Optional  The full path to the directory used to store the applications defined in the template.

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

-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 domain.

Note:This parameter is not applicable if you are creating a domain based on a managed server template.

-server_start_mode={dev|prod}    Optional  The start mode for the administration server: development or production.

Note:This parameter is not applicable if you are creating a domain by using a managed server template.

-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.

Example

To create a domain named mydomain.jar in the C:\bea\user_templates directory, by using the my_new_domain template in the C:\bea\user_projects\domains directory, run the following command:

unpack -template=C:\bea\user_templates\mydomain.jar -domain=C:\bea\user_projects\domains\my_new_domain

Once you are familiar with pack and unpak command now you can create a template using pack command and migrate the domain to the new server and use unpack command to recreate the same on the new machine.

Follow below steps to migrate:

How Do I Create a Managed Server Template?

You create a managed server template by executing the pack command on an existing domain that includes the definition of one or more managed servers and contains managed server definitions in the config.xml file.
1.From the command line on the local machine (that is, the machine that contains the administration server and the definition of managed servers), navigate to the BEA_HOME\wlserver_10.0\common\bin directory.
2.Run the following command:

pack -managed=true -domain=domain -template=template.jar -template_name="template_name"

In this command:
–domain is the full or relative path of the domain from which the template is to be created.
–template.jar is tthe full or relative path of the template, and the filename of the template to be created.
–template_name is a descriptive name for the template, enclosed in quotes.

For example, the following command creates a managed server template named mydomain_managed.jar from a domain named mydomain.

pack -managed=true -domain=C:\bea\user_projects\domains\mydomain -template=C:\bea\user_templates\mydomain_managed.jar -template_name="My Managed Server Domain"

How Do I Create a Managed Server on a Remote Machine ?

1.Install WebLogic Server on the machines on which you want to host managed servers for the domain.
Note:All WebLogic Server instances within a domain must run the same version of the WebLogic Server software. For more information about installing WebLogic Server, see the Installation Guide.

2.Establish a session with the remote machine. You may use any valid method, such as telnet, to do so.
Note:The IP address and port number of the remote machine must match the definition of the managed servers specified in the managed server template.

3.Copy the managed server template to the remote machine.

4.On the remote machine, navigate to the WL_HOME\common\bin directory (WL_HOME is the product directory in which installed WebLogic Server is installed).

5.Run the following command:

unpack -domain=domain -template=template.jar

In this command:

–domain is the full or relative path of the domain to be created.

–template.jar is the full or relative path of the managed server template that you copied to the machine in step 3.

For example, the following command creates a domain named myManagedDomain.

unpack -domain=C:\bea\user_projects\domains\myManagedDomain -template=C:\bea\user_templates\mydomain_managed.jar

How Do I Start Managed Servers on a Remote Machine?

When you create a domain directory for managed servers by using the unpack command, it contains a customized start script for each managed server targeted to the current remote machine.

For example, if you create a domain that contains two managed servers, my_managed_server1 and my_managed_server2, and you target the servers to machine m1, when you create the managed server domain directory on machine m1, four custom start scripts are created: startmy_managed_server1.cmd, startmy_managed_server1.sh, startmy_managed_server2.cmd, and startmy_managed_server2.sh. You can use these scripts to start the corresponding managed servers. Alternatively, you can use the startManagedWebLogic script with the required parameters.

1.Start the administration server for the domain as described in Starting and Stopping Servers.

2.On the remote machine, navigate to the directory for the domain that you created.

3.Start the managed server on the remote machine.

–On a Windows system, run one of the following commands at the DOS prompt:

startmy_managed_server
startManagedWebLogic my_managed_server admin-url

–On a UNIX system, run one of the following commands:

./startmy_managed_server.sh
./startManagedWebLogic.sh my_managed_server admin-url

In these commands, my_managed_server is the name of the managed server to be started and admin-url is the listen address (host name or IP address) and port number of the machine hosting the administration server. For your convenience, the startManagedWebLogic_Readme.txt file provides a list of all the managed servers and the admin-url for the domain.

Note:You can also start managed servers by using the node manager. For more information, see Node Manager Administrator’s Guide.

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

4 Responses

  1. Francis says:

    great information; thanks a bunch

Leave a Reply