Thursday, September 19, 2013

Weblogic : Migrating Web logic Domains from One Physical machine to another

The Most Simple way of Migrating a Web logic Domain from One Machine to another is using the pack command provided by Web logic.

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.

By using the pack Command we can create a template file for the existing domain like,

[root@vx111a bin]# ./pack.sh -domain=/root/Oracle/Middleware/user_projects/domains/base_domain -template=/root/Oracle/Middleware/user_projects/domains/base_domain.jar -template_name="my base Domain Template" -log=/root/Oracle/Middleware/user_projects/domains/domain-pack.log

<< read domain from "/root/Oracle/Middleware/user_projects/domains/base_domain"
>> succeed: read domain from "/root/Oracle/Middleware/user_projects/domains/base_domain"
<< write template to "/root/Oracle/Middleware/user_projects/domains/base_domain.jar"
....................................................................................................
>> succeed: write template to "/root/Oracle/Middleware/user_projects/domains/base_domain.jar"
<< close template
>> succeed: close template

These are the details that I used in the above pack command
Domain = base_domain
Template Nmae = base_domain.jar

The pack and unpack commands are available are /root/Oracle/Middleware/wlserver_10.3/common/bin

Now Once the template is created , just copy the template file to the new physical machine which already contains the same version of weblogic software running, go to “/root/Oracle/Middleware/wlserver_10.3/common/bin” and run the unpack command sa,

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.

[root@vx111a bin]# ./unpack.sh -template=/root/Oracle/Middleware/user_projects/domains/base_domain.jar -domain=/root/Oracle/Middleware/user_projects/domains/admin_domain -user_name="weblogic" -password="weblogic1" -java_home="%JAVA_HOME%" -server_start_mode="dev" -log=/root/Oracle/Middleware/user_projects/domains/domain-pack1.log
Error: Full path required for "-java_home". Use "-help" to see details.
[root@vx111a bin]# ./unpack.sh -template=/root/Oracle/Middleware/user_projects/domains/base_domain.jar -domain=/root/Oracle/Middleware/user_projects/domains/admin_domain
-user_name="weblogic" -password="weblogic1" -server_start_mode="dev" -log=/root/Oracle/Middleware/user_projects/domains/domain-pack1.log
<< read template from "/root/Oracle/Middleware/user_projects/domains/base_domain.jar"
>> succeed: read template from "/root/Oracle/Middleware/user_projects/domains/base_domain.jar"
<< set config option ServerStartMode to "dev"
>> succeed: set config option ServerStartMode to "dev"
<< find User "weblogic" as u1_CREATE_IF_NOT_EXIST
>> succeed: find User "weblogic" as u1_CREATE_IF_NOT_EXIST
<< set u1_CREATE_IF_NOT_EXIST attribute Password to "********"
>> succeed: set u1_CREATE_IF_NOT_EXIST attribute Password to "********"
<< write Domain to "/root/Oracle/Middleware/user_projects/domains/admin_domain"
...............................................................................................
>> succeed: write Domain to "/root/Oracle/Middleware/user_projects/domains/admin_domain"
<< close template
>> succeed: close template

In the above command , iam going to create
Domain = admin_domain

During the unpack command , I also passed 'username' , 'password' , 'server start mode' e.t.c
Once the unpack command is done , you can see a new domain with the name admin_domain


Happy Learning , More To Come.