pack.sh & unpack.sh command – Create Tempalets and Domains in WebLogic

If you are planning to configure High Availability (Active-Active cluster) in 11g Fusion Middleware components (SOA, WebCenter) then its important that you should know pack and unpack command in WebLogic Server.

If you are new to Oracle WebLogic Server Server then first read about Domain, Administration Server and Managed Server here

.

Why you should know about pack.sh & unpack.sh in Fusion Middleware (Weblogic) clustering (High Availability) ?
As part of Active-Active cluster –
1.You would install Fusion Middleware (WebLogic & SOA/WebCenter) on Machine1 and Machine2 .
          For steps on How to install SOA Suite 11g on single node click here
2.Create a domain (with WebLogic cluster and Machine) on Machine1 using config.sh more here
3. Run pack.sh to bundle domain and templates from Machine1 (This will create jar file)
4. Copy jar file (created by using pack.sh command) from Machine1 to Machine2
5. Use unpack.sh to create domain & managed server on Machine2

You would also need pack and unpack command to run a managed server on a machine that is remote from the administration server for the domain.

.

What is pack.sh & unpack.sh command ?
pack
and unpack commands provide a simple, one-step method for creating domains and templates from the command line.
These shell scripts are available in$MW_HOME/wlserver_[ver]/common/bin

  • For more information on Directory structurein Fusion Middleware 11g click here
  • For more information on pack & unpack command check Oracle guide here

.

Syntax of the Pack Command

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

  • Default value for -managed is false

.
Syntax of the Unpack Command

unpack -template=path_of_jara_file -domain=path_of_domain_to_be_created [-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]

 

Learn Oracle Weblogic Server Administration

 

Get 100 USD OFF + 100% Money Back Guarantee

Click here to get Early Bird Discounts

About the Author Atul Kumar

Oracle ACE, Author, Speaker and Founder of K21 Technologies & K21 Academy : Specialising in Design, Implement, and Trainings.

follow me on:

Leave a Comment:

44 comments
neworacledba says March 19, 2010

nice post…looking for more posts on 1z0-108 exam from you atul

Reply
» Whole Server Migration Online Apps DBA: One Stop Shop for Apps DBA’s says July 8, 2010

[…] For more details on packing and unpacking of domain, please click here […]

Reply
rennay says July 20, 2010

Great post Atul! Your post correctly defines app_dir – but the Oracle documentation (file:///home/rennay/Documents/11g/web.1111/e14144/commands.htm) does not!

Just a quick question – if I extend my domain to have more managed servers, do I need to unpack on all existing managed servers?

Thanks again.

Reply
Atul Kumar says July 21, 2010

@ Rennay,
Case 1 : All managed server and Admin Server are in single DOMAIN_DIR : Extend domain on node running Admin Server. Create pack & unpack on all other servers part of your cluster

Case 2 : All managed server are in one DOMAIN_DIR and Admin Server is another DOMAIN_DIR (This is as per enterprise deployment guide) : Extend domain on node running Admin Server. Create pack & unpack in directory containing managed server. Repeat unpack on other servers part of your cluster.

Reply
Shelvia44 says August 1, 2010

Thank you so much for answering my question.

Reply
» WebLoigic Node Manager Associated with this machine is not reachable : “Access to domain ‘base_domain’ for user ‘XXXXX’ denied” Online Apps DBA: One Stop Shop for Apps DBA’s says February 14, 2011

[…] pack & unpack the domain jar file (for more on pack & unpack scripts please check this link) on  Machine2, We started the […]

Reply
Bikram says April 6, 2011

Atul, I’m trying to pack-unpack in such a way that I’m able to provide a new domain name and server ports when I unpack on different or same machine. Can that be done?

Reply
ranganathnangineni says May 9, 2011

Hi Atul,

After pack ( from Node A)/unpack to Node B I have figured out a strange issue on 2node UCM_cluster.

The ECM11G installation was done on Node A at

/u01/app/oracle/FMW11gR1P1/ECM11G.

and on Node B it was done under

/u01/app/oracle/product/FMW11gR1P1/ECM11G.

Because of this the UCM_server2 is not able to find the required ear/war files for UCM deployment on Node B and is going into ADMIN state.

Could you please suggest , if anything can be done to rectify this issue?

Error message:

Caused By: java.util.zip.ZipException: Error opening file – /u01/app/oracle/FMW11gR1P1/ECM11G/ucm/idc/components/ServletPlugin/idcws.war Message – error in opening zip file
at weblogic.servlet.utils.WarUtils.existsInWar(WarUtils.java:87)
at weblogic.servlet.utils.WarUtils.isWebServices(WarUtils.java:76)
at weblogic.servlet.internal.WarDeploymentFactory.findOrCreateComponentMBeans(WarDeploymentFactory.java:61)
at weblogic.application.internal.MBeanFactoryImpl.findOrCreateComponentMBeans(MBeanFactoryImpl.java:48)
at weblogic.application.internal.MBeanFactoryImpl.createComponentMBeans(MBeanFactoryImpl.java:110)
Truncated. see log file for complete stacktrace

Thanks

Reply
Atul Kumar says May 9, 2011

@ ranganathnangineni,

Did you select option -managed=true while pack ?

As best practice install MW_HOME and Domain for managed server node B to same value as node A

To workaround this issue ask Unix team to create a link so that when manged server look for /u01/app/oracle/FMW11gR1P1/ECM11G it is being redirected to to /u01/app/oracle/product/FMW11gR1P1/ECM11G (kind of soft link)

Reply
ranganathnangineni says May 9, 2011

yes I have used -managed=true while pack.

Reply
Amit says June 18, 2011

Hello Atul

I want to clone weblogic server to a new machine as part of moving FMW to a new server but as per Oracle documenatation I am unable to find copyBinary.sh script in ORACLE_COMMON_HOME, in fact I am unable to find ORACLE_COMMON_HOME in my installation.

Could you please suggest a way to clone or why these scripts are not there?.

Thanks
Amit

Reply
ranganth n says June 19, 2011

Hi Amit,

You need to install any one of the FMW components like SOA, Webtier to get this ORACLE_COMMON_HOME.

Please try installing SOA .

Thanks
Ranganath.

Reply
ayer says October 3, 2011

Hi Atul,
I noticed that if you configure a node manager in the source domain, pack.cmd does not include the credentials for nm in the template. As a result, the nm credentials are set to a default in the new (un-packed) domain. Is that by design, or is that some kind of a bug? Thanks a lot!
-Alex

Reply
Tom says December 22, 2011

Do pack and unpack need to be run as root? When I run them as oracle I get an error — very non-decscriptive.

CFGFWK-60550: Script execution aborted. The script may contain an error.
null

When I run it as root, the file is created and unpack.sh works. But later on during cluster configuraton and domain extension, one of the files, startscript-unsub.xml, causes the domain extension to end in error due to permissions on the file.

The permissions can easily be changed — now that I know what the problem is — but if pack should be able to be run as oracle… then this file (and others as well possibly) would not have permission issues later.

Reply
Atul Kumar says December 22, 2011

@ Tom,
No, pack and unpack should not be used using root user. It should be using user owning weblogic. This user should have write permission on directory on which jar file is created or extracted.

Reply
Tom says December 22, 2011

Weblogic was installed as oracle, oracle has permissions on the directory that the jar file is created and extracted, but I continue to get this error.

I reran the pack command with -log set. The logfile listed an error:

RunScriptTask – There was an error executing the script: /tmp/tmpPack7803104551374000378cws
java.lang.NullPointerException

Reply
Tom says December 22, 2011

btw… there is not file in /tmp by that name and none created in /tmp in the last hour.

Reply
Tom says December 22, 2011

The output from the pack command:

pack.sh -domain=/opt/oracle/product/fmw/user_projects/domains/IDMDomain/ -template=/opt/oraInventory/IDMDomain.jar -template_name=”OAM Domain” -managed=true

<> succeed: read domain from “/opt/oracle/product/fmw/user_projects/domains/IDMDomain”
<> succeed: set config option Managed to “true”
CFGFWK-60550: Script execution aborted. The script may contain an error.
null

Reply
Tom says December 22, 2011

For some reason the output did not copy correctly:

<> succeed: read domain from “/opt/oracle/product/fmw/user_projects/domains/IDMDomain”
<< set config option Managed to “true”
CFGFWK-60550: Script execution aborted. The script may contain an error
null

Sorry for all the posts… not meaning to monopolize your time… and thank you for your quick response.

Reply
Atul Kumar says December 23, 2011

@ Tom,
Please confirm that MW_HOME, oracle_home are same n both the servers (servers on which you are running pack and unpack command)

Reply
Tom says December 23, 2011

The setup on both servers is identical.

This is our first time clustering but we have step by step docs to install the software from many previous installations.

Actually this is our second time clustering… we are running this install based on the steps we put together from a test install. We are trying to confirm the steps.

I realize that we are not supposed to run pack as root, but that appears to be the only way to create the jar file.

Reply
Alecks says January 3, 2012

What do you do if you already have a domain on Node2. For ex:

On Node1 I have OID and OAM

On Node2 I already did unpack when I setup OID, so it contains wls_ods2. Now I want to create a 2nd node for OAM, but when I try to unpack I get:
“A domain with an identical name exists at the location you have selected. Change the domain name or location.”

How can I bring in just the OAM server to Node2, without messing up the existing OID managed server on Node2?

Thanks much!

Reply
Atul Kumar says January 3, 2012

@ Alecks,

I am assuming oam is already extended on node2 by running config.sh on node1.

1. Pack domain directory from node1 and copy to node2

2. Shutdown all services on node2

3. Remove (or move) domain & application directory on node2

4. Unpack jar file copied from node2

This will create domain directory

5. Start all managed server on node2

Reply
Alecks says January 3, 2012

Atul,

Not sure what you mean by this:
“I am assuming oam is already extended on node2 by running config.sh on node1”

Did you mean “.. is already extended on node_1_…”? I don’t see any way to extend oam on node 2 by runing config on node1. I just ran it and “OAM with DB Policy Store” is already selected and can’t click next unless I add something new…

Reply
Alecks says January 3, 2012

Also, won’t I lose my wls_ods2 server (second OID server on Node2) if I remove it, how will that get preserved?

Reply
Atul Kumar says January 3, 2012

@ Alecks,
Oh yeah as OAM is already selected from domain template, you can’ t extend it by running config.sh again.

I am assuming you have a domain where ODSM is configured on node1, node2 and OAM is configured on node1. You now would like to have OAM on node2 as well.

I have not tried this myself by this is how you should create second oam server (on node2)

1. Go to OAM console and create an instance of OAM server in node 2 (this is under oam instance section)
2. Go to weblogic admin server console and create managed server (configure it to listen on node2).
3. Target all library and jdbc on OAM managed server (created in step 2), similar to those configured for OAM managed server running on node1

4. Start OAM managed server on node2

5. Re-configure webgate (accessGates) to use oam on node2 as well.

Revert back in case of doubts/issues

—-
Second scenario:

— You already have ODSM on node1 and node2. You now wish to configure OAM on node1 and node2–

To achieve this

a) Extend domain to configure OAM (select two OAM managed server, first on node1 and second on node2)
b) Pack domain on node1 and copy to node2
c) Move domain directory and application directory on node2 (one which contains ODSM)
d) Unpack domain jar file on node2 (copied from node1)
e) Start managed servers

Reply
Atul Kumar says January 3, 2012

@ Alexks

Q: Won’t I lose my wls_ods2 server (second OID server on Node2) if I remove it, how will that get preserved?

A: You can delete managed server after stopping managed server. On restart of managed server, all required files will be created on start-up. (Admin Server has all details you can delete managed server any time after stopping them 🙂

Note: Never delete your Admin Server.

Reply
laya says April 25, 2012

Hi Atul,
I have few question to clarify with you

1) All the managed server and my admin server is in single domain and i have have nodemanager home on separate folder..Currently i have packed only the domain..What all things i need to do to make sure i have the same nm credentials on machine2.

2) I have almost 10 managed servers on machine 1. In Machine 2 i want to rename the managed server, so can i edit the config.xml and rename it?

3) Will the machine 1 managed server folders will be available in machine 2 server folder..if its there can i delete that as well.

4) Is it possible to copy the weblogic product directory from my machine 1 to machine 2?

Reply
    Atul Kumar says April 25, 2012

    1) Node Manager Password :
    Set Node Manager password from weblogic console :

    a) Click domain_name, (Security) tab, General, and then expand the Advanced options at the bottom.
    b) Enter a new username for Node Manager, or make a note of the existing one and update the Node Manager password.
    c) Click Save and Activate Changes.

    Then run nmEnroll http://docs.oracle.com/cd/E12840_01/wls/docs103/nodemgr/nodemgr_config.html

    Q2) I have almost 10 managed servers on machine 1. In Machine 2 i want to rename the managed server, so can i edit the config.xml and rename it?

    A2- No, renaming a managed server is not supported. Why do you want to change name of managed server ?

    Q3) Will the machine 1 managed server folders will be available in machine 2 server folder..if its there can i delete that as well.

    A3: Yes , you can delete directory for machine1 managed server folder available on machine2.

    Q4) Is it possible to copy the weblogic product directory from my machine 1 to machine 2?
    A4: Install of weblogic server on machine2 is better option.

    Reply
leya says April 25, 2012

Thanks for the detailed explanation.

The way our managed server is created is by prefixing the hostname. I want the prefix of the managed server to be changed to the new hostname after unpacking the domain. Is there a way to do it.

One more thing i noticed is that after unpacking the domain i could not see any managed server and while starting up the weblogic admin server it prompted me to create a new config.xml. Even i could see any datasource which i have created but when i manually checked in the config folder i could see the datasources..Am i missing any step.

Reply
    Atul Kumar says April 26, 2012

    Q: I want the prefix of the managed server to be changed to the new hostname after unpacking the domain. Is there a way to do it.

    A: My view is that you should not attached managed server to any hostname, they should be independent of hostname. I don’t think it is certified to change managed server name after configuration. Best way is to recreate domain and use new name for managed servers.

    Q: I could not see any managed server and while starting up the weblogic admin server it prompted me to create a new config.xml.
    A: Managed server directories will be created on first time start of managed server. Regarding Admin Server, you should not start Admin Server on second node as well (Admin Server can run in Active/Passive mode only). If you wish to migrate Admin Server from node1 to node2 then stop/terminate Admin Server on node1 . Migrate VirtualIP (on which Admin Server is running) from node1 to node2. Start Admin Server on Node2 (I hope domain home is shared between node1 and node2, if not copy whole directory from node1 to node2 before starting Admin Server on node1)

    Reply
laya says April 26, 2012

We have 4 qa env..I want to basically take a clone from one of our qa env use that in our other qa env..For cloning which one you prefer is it pack or using domain template builder

Reply
    Atul Kumar says April 26, 2012

    @laya,
    It depends on what type of environemnt are these. My suggestion would be to go with Template Builder If this is plain weblogic. If this is Fusion Middleware application (soa, webcenter, BPM, OBIEE…) then go for cloning.

    Good luck and share your experience.

    Reply
laya says April 27, 2012

Thanks Atul i was able complete my requirement using Template builder..BTW what is the other way to do the cloning for other FMW application..

Reply
srikanth says May 4, 2012

Hi Thanks your blog is very helpful to me.
I am using Weblogic 10.3.6 &SOA ,AIA 11.1.1.6.
I design SOA cluster now i want to install AIA on cluster.
My question is when can i do packing in Machine1 and Unpacking on Machine2. Before installing AIA or after Installing AIA. In AIA there is option for clustering while installing time.

Reply
    Atul Kumar says May 5, 2012

    @Stikanth,
    You can do pack/unpack either before or after AIA deployment. It does not matter as configurations are sent to admin server which is stored in config.xml and then sent to managed servers.

    When you deploy AIA and prompted for SOA address then give SoA cluster URL

    Reply
kart says June 14, 2012

Atul,

I have 2 node weblogic cluster for soa,
I want to add one more machine to the the cluster. Which is the best option
1.Install all the softwares on new the third node similar to other two node & Pack from first node and unpack on third node
2.Run copybinary.sh & pack.sh on first node and pastebinary.sh & unpack on third node.
3. ?

Please advise , thanks in advance

Karthik

Reply
Cody says October 18, 2012

I have a situation where my managed instances are named according to the server they are on. Would it make sense to pack a template from one set of servers to use when deploying an entirely new domain and making edits to the config.xml (and probably a number of other files, as the admin and managed server names, machine names, and addresses change)? I really like my setup and would like to stamp out other environments.

Thanks!

Cody

Reply
Cody says October 18, 2012

I think I figured it out. I took a peek at the example replicatedDomain.py and I think this is what I want.

readTemplate(“/home/orawls/middleware/fmw-t2/wlserver_10.3/common/templates/domains/wls.jar”)
addTemplate(“/home/orawls/middleware/fmw-t2/wlserver_10.3/common/templates/domains/replicateddomain.jar”)

Cody

Reply
padmanabh dubey says April 30, 2014

Exception in thread “main” java.lang.NullPointerException
at com.oracle.cie.domain.script.Unpacker.main(Unpacker.java:171)

getting this error while running unpack script

./unpack.sh -domain=/s01/app/MiddlewareR2/user_projects/domains/oim_domain/ -template=oim_domaintemplate.jar

please suggest

Reply
sri says August 4, 2014

I tried using pack/unpack wls commands to create a new domain based on existing domain by enabling managedserver option to ‘true’
It created successfully. but when i m trying start up managed server its saying –

<Server fa
iled. Reason:

There are 1 nested errors:

weblogic.management.ManagementException: [Management:141249]The configuration di
rectory C:\Oracle\Middleware\user_projects\domains\pack_domain\config is missing
the file config.xml and the admin server is not available to download it.
at weblogic.management.provider.internal.RuntimeAccessImpl.parseNewStyle
Config(RuntimeAccessImpl.java:213)
at weblogic.management.provider.internal.RuntimeAccessImpl.(Runtim
eAccessImpl.java:115)
at weblogic.management.provider.internal.RuntimeAccessService.start(Runt
imeAccessService.java:41)
at weblogic.t3.srvr.ServerServicesManager.startService(ServerServicesMan
ager.java:461)
at weblogic.t3.srvr.ServerServicesManager.startInStandbyState(ServerServ
icesManager.java:166)
at weblogic.t3.srvr.T3Srvr.initializeStandby(T3Srvr.java:881)
at weblogic.t3.srvr.T3Srvr.startup(T3Srvr.java:568)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:469)
at weblogic.Server.main(Server.java:71)

>


Reply
RMW says August 30, 2014

Hi Atul,

I did pack from one of my running domain and tried to unpack the template on other node but during the unpack process I’m getting error “cant parse template-info.xml” . Can you provide insight where actually the packing or unpacking is going wrong as the second node is having fresh WLS and OSB installations and have the same file system.

Reply
msidd says September 10, 2014

I am trying to build OAM 11.1.2.2.0 environment that has Adminserver on Node 1 and OAM managed server on Node2.

After performing pack on Adminserver Node 1 and then unpack on Managed server Node2 when I try to start managed server on Node2 I am getting following error: config is missing config.xml and the admin server is not able to download it.

How do I create config.xml It should be generated during pack/unpack. Please suggest how to resolve this missing config.xml

Reply
kalyan says October 20, 2015

Hi Sir,
from your post , i started to Create a Backup of my ENV..

……………………..
[root@NEURAAPPL Oracle]# pack.sh -domain=/root/Oracle/Middleware/user_projects/domains/base_domain -template=/root/Oracle/Bkp15.21.jar -template_name=Bkp15.21domain -log=/root/Oracle/Middleware/user_projects/domains/base_domain/servers/bkp21.log -managed=true

Error ::: -bash: pack.sh: command not found
getting this error..

At which location i have to Execute this Script?
I executed in Domain Directory
/root/Oracle/Middleware/user_projects/domains/base_domain/bin

pls tell me , whats the Error with me

Reply
Add Your Reply

Not found