Showing posts with label Template. Show all posts
Showing posts with label Template. Show all posts

Thursday, 16 January 2014

Pack and Unpack Command in Oracle Weblogic Server with Example

If you want to make use of an existing domain configuration while creating a new domain you can make use of pack and unpack commands.  The pack command creates a template .jar archive file that contains entire WebLogic domain or a subset of a WebLogic domain.
In the sense 'Pack' command will create a template on top of the existing domain.

pack command will be located in the generic path


 'C:\Oracle\Middleware\Oracle_Home\wlserver\common\bin' 
pack.cmd (windows)
pack.sh (unix)
Syntax:
pack -domain=domain -template=template -template_name="template_name"
The below parameters are optional: 
[-template_author="author"][-template_desc="description"] [-managed=true|false] [-log=log_file] [-log_priority=log_priority]

It is suggested to keep the log parameter, such that you can find the if any errors in creating the template

Example:

pack -domain=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp -template=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar  -template_name="TempDom" -template_author="King" -template_desc="Temp Domain Template" -managed=true -log=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\tempdom.log
Remember the while giving the template name it should be added with 'jar' extension. This will create the 'Temp.jar' in the location C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp

The unpack command will create a full WebLogic domain or a subset of a domain that is used for a Managed Server domain directory on the target machine.

unpack -template=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar -domain=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\mynewdomain

Sntax:
unpack -template=template -domain=domain
The below parameters are optional:

[-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] [-overwrite_domain]

Example:

unpack -template=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar -domain=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\unpackedDomain
This command will create a new domain called 'unpackedDomain' in the path C:\Oracle\Middleware\Oracle_Home\user_projects\domains\
 
Sample log of the pack command:

2014-01-16 22:45:36,266 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - read domain from "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp"
2014-01-16 22:45:45,600 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - succeed: read domain from "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp"
2014-01-16 22:45:45,602 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - set config option Managed to "true"
2014-01-16 22:45:45,698 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - succeed: set config option Managed to "true"
2014-01-16 22:45:45,699 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - write template to "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar"
2014-01-16 22:45:47,589 INFO  [Thread-2] com.oracle.cie.domain.TemplateGenerator - Template Generation Successfull!
2014-01-16 22:45:47,604 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - succeed: write template to "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar"
2014-01-16 22:45:47,604 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - close template
2014-01-16 22:45:47,605 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - succeed: close template