WebLogic‎ > ‎Domain Creation‎ > ‎

Creating Domain by pack and unpack

The WebLogic provides two compressing and uncompressing the domain for reusing to another remote machine or it can be used as backup for the existing domain.
Which requires the PATH need to set to <WL_HOME>/common/bin
export PATH=/export/home/wlsuser/bea/weblogic92/common/bin:$PATH

Pack Process

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

bash-3.00$ pack.sh -domain="/export/home/wlsuser/domains/wlscldom"
-template="/export/home/wlsuser/templates/wlscltemp.jar" -template_name="WLS
CLUSTER DOMAIN" -log=/export/home/wlsuser/logs/wlscldompack.log -log_priority=INFO
<< read domain from "/export/home/wlsuser/domains/wlscldom"
>>  succeed: read domain from "/export/home/wlsuser/domains/wlscldom"
<< write template to "/export/home/wlsuser/templates/wlscltemp.jar"
>>  succeed: write template to "/export/home/wlsuser/templates/wlscltemp.jar"
<< close template
>>  succeed: close template
To confirm that domain created in the current directory check with ls command.
bash-3.00$ ls -l
total 30
drwxr-xr-x   8 wlsuser   wlproj512 Dec 19 07:58 bea
drwxr-xr-x   3 wlsuser   wlproj512 Dec 24 10:48 domains
bash-3.00$ cd logs
bash-3.00$ ls -l
total 130
-rw-r--r--   1 wlsuser   wlproj948 Dec 24 12:06 wlscldompack.log
To View the logged info related to pack process.
bash-3.00$ tail -100 wlscldompack.log
2008-12-24 12:06:43,569 INFO  [runScript]
com.bea.plateng.domain.script.ScriptExecutor - read domain from
2008-12-24 12:06:52,643 INFO  [runScript]
com.bea.plateng.domain.script.ScriptExecutor - succeed: read domain from
2008-12-24 12:06:52,648 INFO  [runScript]
com.bea.plateng.domain.script.ScriptExecutor - write template to
2008-12-24 12:06:56,785 INFO  [Thread-1] com.bea.plateng.domain.TemplateGenerator
- Template Generation Successfull!
2008-12-24 12:06:56,847 INFO  [runScript]
com.bea.plateng.domain.script.ScriptExecutor - succeed: write template to
2008-12-24 12:06:56,852 INFO  [runScript]
com.bea.plateng.domain.script.ScriptExecutor - close template
2008-12-24 12:06:56,856 INFO  [runScript]
com.bea.plateng.domain.script.ScriptExecutor - succeed: close template

bash-3.00$ cd templates
bash-3.00$ ls -l
total 46
-rw-r--r--   1 wlsuser   wlproj   23188 Dec 24 12:06 wlscltemp.jar
To pack the managed servers only then we need to use the option '-managed=true'. by default it is set to false.
bash-3.00$ pack.sh -managed=true -domain="/export/home/wlsuser/domains/wlscldom"
-template="/export/home/wlsuser/templates/wlscltemp.jar" -template_name="WLS
CLUSTER DOMAIN" -log=/export/home/wlsuser/logs/wlscldompack.log -log_priority=INFO

UNPACK Process

To run this we must already run the pack command on a domain which is already existing. The domain template jar must be copied to the destination machine.
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]
bash-3.00$ unpack.sh -template=wlscltemp.jar -domain=domains/wlscldom
-log=wlscldomunpack.log -log_priority=INFO

<< read template from "/appdata/wkst/wlsuser/wlscltemp.jar"
>>  succeed: read template from "/appdata/wkst/wlsuser/wlscltemp.jar"
<< write Domain to "/appdata/wkst/wlsuser/domains/wlscldom"
>>  succeed: write Domain to "/appdata/wkst/wlsuser/domains/wlscldom"
<< close template
>>  succeed: close template
bash-3.00$ ls -l
total 1188090
drwxr-xr-x   7 wlsuser   wlproj    1024 Dec 24 09:13 bea
drwxr-xr-x   3 wlsuser   wlproj 96 Dec 24 12:20 domains 
To unpack managed server also it will work in the same manner.



To create a WebLogic domain template we can use pack command line utility.

Issue: unable to execute the pack command to create a domain template

[ ~/Oracle/Middleware/wlserver_10.3/common/bin]$ pack -domain=/sunil/domains/nmdomain -template=/sunil/domains/templates/nmdomain_tmplt.jar -template_name="nodemgrdomain_template" -template_autho="Sunil" -log=/sunil/domains/templates/nodemgrdomain_template.log -log_priority=info
pack: illegal option -- d
pack: illegal option -- o
pack: illegal option -- m
pack: illegal option -- a
pack: illegal option -- i
pack: illegal option -- n
pack: illegal option -- =
pack: illegal option -- /
pack: illegal option -- a
pack: illegal option -- p



issue is same with the case of unpack.sh while using 'unpack' instead of 'unpack.sh'



First: I checked is there any UNIX command already exist with the same?

$ pack

usage: pack [-f] [-] file...

Yes it is true there is a command exists that makes ambibuty between our WebLogic command. So it is looking for its options whatever I passed arguments that doesn't matches to it.

Secondly: As there is a conflict with unix pack command and weblogic's pack command, to know the file type of the weblogic's pack command, I have listed the files in WL_HOME/common/bin and found that the command is pack.sh which is a shell script and it needs to be executed as a regular shell script.

Solution: Use pack.sh to resolve the above issue

Explantion: as per the oracle documentation pack and unpack were mentioned as commands, but in the unix environment when give pack and rest of the parameters it throws error as shown in the screen shot. The reason is unix is unable to recognize the command as it is a shell script.

Creating WL Domain Using WLST | Cluster domain |==> Secure Cluster domain