Sunteți pe pagina 1din 10

WebLogic 11g Cloning

To perform this task, follow sections


I. Source environment cloning,
II. Target environment deployment

(a) Source environment to prepare and copy it to the target environment.

a.1. Set Environment variables

Connect to the source environment host.


Set up the following environment variables:
TGT_HOST – a fully qualified target host name, e.g. ajithpathiyil2.lab.com
SRC_CLONE_DIR – a directory of the source environment for preparation of clone files
TGT_CLONE_DIR – a directory of the target environment for copying of clone files

You may also need to update:


· Mount point directory u01 to an actual value (note that u01 in TGT_CLONE_DIR is
for the target environment)
· Middleware home directory mw_1, if you clone another home, e.g. mw_2

[ajithpathiyil1::oracle]> TGT_HOST=ajithpathiyil2.lab.com

[ajithpathiyil1::oracle]>.
/u01/app/oracle/fusion/mw_1/wlserver_10.3/server/bin/setWLSEnv.sh

[ajithpathiyil1::oracle]>SRC_CLONE_DIR=${MW_HOME%/*}/clone/${TGT_HOST}
[ajithpathiyil1::oracle]>TGT_CLONE_DIR=/u01/app/oracle/fusion/clone/${TGT_HO
ST}

Check values of environment variables


[ajithpathiyil1::oracle]> for var in MW_HOME SRC_CLONE_DIR TGT_CLONE_DIR
TGT_HOST
> do
> echo $var" = "`eval echo '$'$var`
> done
MW_HOME =/u01/app/oracle/fusion/mw_1
SRC_CLONE_DIR = /u01/app/oracle/fusion/clone/ajithpathiyil2.lab.com
TGT_CLONE_DIR = /u01/app/oracle/fusion/clone/ajithpathiyil2.lab.com
TGT_HOST = ajithpathiyil2.lab.com
[ajithpathiyil1::oracle]>
a.2. Clone directories creation

Create directory for clone files on the source environment


[ajithpathiyil1::oracle]>mkdir -p $SRC_CLONE_DIR
[ajithpathiyil1::oracle]>ls -ltr $SRC_CLONE_DIR

If this directory existed, there may be some files there left from previous cloning. You
need to delete them.
Create directory for clone files on the target environment (you are doing it from the
source environment console, enter password if needed)
[ajithpathiyil1::oracle]> ssh $TGT_HOST mkdir -p $TGT_CLONE_DIR

a.3. Software preparation

You must perform these actions once per WebLogic software home.

Prepare WebLogic software for cloning


[ajithpathiyil1::oracle]> MW_CLONE_FILE=$SRC_CLONE_DIR/mwhome.jar
[ajithpathiyil1::oracle]> [ -f $MW_CLONE_FILE ] && rm $MW_CLONE_FILE
[ajithpathiyil1::oracle]> cd $MW_HOME/utils/clone
[ajithpathiyil1::oracle]>./clone.sh $JAVA_HOME $MW_CLONE_FILE

Prepare JDK for cloning (you may skip this step if you want to install JDK on the target
environment from installation package)
[ajithpathiyil1::oracle]> JAVA_CLONE_FILE=$SRC_CLONE_DIR/java.tgz
[ajithpathiyil1::oracle]> [ -f $JAVA_CLONE_FILE ] && rm $JAVA_CLONE_FILE
[ajithpathiyil1::oracle]> cd $JAVA_HOME/..
[ajithpathiyil1::oracle]> tar czf - ${JAVA_HOME##*/} > $JAVA_CLONE_FILE

a.4. Domains preparation

You must perform these actions once per WebLogic software home. All domains you
need to clone from this WebLogic home will be prepared at once.

Set the environment variable for the file containing a domain list
[ajithpathiyil1::oracle]> DOMAIN_LIST_FILE=$SRC_CLONE_DIR/domain_list.txt
Prepare list of WebLogic domain directories in the source environment
[ajithpathiyil1::oracle]> cat /dev/null > $DOMAIN_LIST_FILE
> grep "domain location" $MW_HOME/domain-registry.xml | while read line
> do
> line=${line#*
> line=${line%\"/>}
> echo $line >> $DOMAIN_LIST_FILE
> done
[ajithpathiyil1::oracle]>
Observe your source domain directories in the prepared file; remove those you do not
want to clone.
[ajithpathiyil1::oracle]> vi $DOMAIN_LIST_FILE
Prepare the domains from the created list for cloning
[ajithpathiyil1::oracle]> cat $DOMAIN_LIST_FILE | while read DOMAIN_HOME
> do
> DOMAIN_NAME=${DOMAIN_HOME##*/}
> . $DOMAIN_HOME/bin/setDomainEnv.sh
> DOMAIN_CLONE_FILE=$SRC_CLONE_DIR/${DOMAIN_NAME}.jar
> [ -f $DOMAIN_CLONE_FILE ] && rm $DOMAIN_CLONE_FILE
> $WL_HOME/common/bin/pack.sh -domain=$DOMAIN_HOME -
template=$DOMAIN_CLONE_FILE
> -template_name=$DOMAIN_NAME
> done
[ajithpathiyil1::oracle]>

[ajithpathiyil1::oracle]> cat $DOMAIN_LIST_FILE | while read DOMAIN_HOME

a.5. Copying from source to target

Review the prepared archives (you may need to parallelize copy process if archives size
is too large).
[ajithpathiyil1::oracle]> ll $SRC_CLONE_DIR

Copy clone files to the target environment (enter password if needed)


[ajithpathiyil1::oracle]> cd $SRC_CLONE_DIR
[ajithpathiyil1::oracle]> scp * ${TGT_HOST}:${TGT_CLONE_DIR}

(b) Target environment deployment


You perform the following actions on the target environment to roll out a WebLogic
clone from the archives copied from the source environment.

b.1. Environment variables


Connect to the target environment host.
Set up the following environment variables:
FUSION_BASE – a base directory for Oracle Fusion Middleware software of the target
environment
MW_HOME – Middleware home directory
WL_HOME – WebLogic Server home directory
TGT_CLONE_DIR – a directory of the target environment with clone files copied from
the source environment

You may also need to update:


· mount point directory u01 to an actual value
· Middleware home directory mw_1, if you clone to another target home, e.g. mw_2
[ajithpathiyil2::oracle]> FUSION_BASE=/u01/app/oracle/fusion
[ajithpathiyil2::oracle]> MW_HOME=$FUSION_BASE/mw_1
[ajithpathiyil2::oracle]> WL_HOME=$MW_HOME/wlserver_10.3
[ajithpathiyil2::oracle]> TGT_CLONE_DIR=$FUSION_BASE/clone/`hostname -f`
[ajithpathiyil2::oracle]> export MW_HOME WL_HOME

Check values of environment variables


[ajithpathiyil2::oracle]> for var in FUSION_BASE MW_HOME WL_HOME
TGT_CLONE_DIR
> do
> echo $var" = "`eval echo '$'$var`
> done

b.2. Software deployment

You must perform these actions once per WebLogic software home.
b.2.1 Environment variables
Set up the following environment variables:
JAVA_HOME – JDK home directory
[ajithpathiyil2::oracle]> JAVA_HOME=$MW_HOME/java/jdk
[ajithpathiyil2::oracle]> PATH=$JAVA_HOME/bin:$PATH
[ajithpathiyil2::oracle]> export JAVA_HOME PATH

Check values of environment variables


[ajithpathiyil2::oracle]> for var in JAVA_HOME PATH
> do
> echo $var" = "`eval echo '$'$var`
> done
b.2.2 Restore weblogic software
Unpack JDK from the archive (you may skip this step if you have installed JDK on the
target environment from installation package)
mkdir -p ${JAVA_HOME%/*}
cd ${JAVA_HOME%/*}
tar xzf $TGT_CLONE_DIR/java.tgz

Unpack WebLogic software from the archive


[ajithpathiyil2::oracle]> mkdir -p $MW_HOME
[ajithpathiyil2::oracle]> cd $MW_HOME
[ajithpathiyil2::oracle]> jar xf $TGT_CLONE_DIR/mwhome.jar

Preserve nodemanager.properties, otherwise it will be deleted during execution of


restore.sh script
[ajithpathiyil2::oracle]> cp
$WL_HOME/common/nodemanager/nodemanager.properties
[ajithpathiyil2::oracle]>
$WL_HOME/common/nodemanager/nodemanager.properties.bak

Run restore.sh
[ajithpathiyil2::oracle]> cd $MW_HOME/utils/clone
[ajithpathiyil2::oracle]> chmod u+x ./restore.sh
[ajithpathiyil2::oracle]>./restore.sh $JAVA_HOME

Set server environment


[ajithpathiyil2::oracle]>. $WL_HOME/server/bin/setWLSEnv.sh

b.2.3. Delete domains registration from Node Manager


Clear the list of domains previously enrolled to the Node Manager
[ajithpathiyil2::oracle]> cat /dev/null >
$WL_HOME/common/nodemanager/nodemanager.domains

b.2.4. Start Node Manager


Start Node Manager
[ajithpathiyil2::oracle]> cd $WL_HOME/common/nodemanager
[ajithpathiyil2::oracle]> nohup $WL_HOME/server/bin/startNodeManager.sh &

Check the output of the Node Manager process


[ajithpathiyil2::oracle]> tail -50f $WL_HOME/common/nodemanager/nohup.out
b.3. Domains Deployment

You must perform these actions once per WebLogic software home except item 3.3.4
with sub-items which must be repeated for each domain.
b.3.1. Environment variables
Set server environment
[ajithpathiyil2::oracle]>. $WL_HOME/server/bin/setWLSEnv.sh
Check values of environment variables
[ajithpathiyil2::oracle]> for var in MW_HOME WL_HOME JAVA_HOME
TGT_CLONE_DIR
> do
> echo $var" = "`eval echo '$'$var`
> done

b.3.2. Specify new names for domains


New domain names must NOT match the domain names existing on the target
environment.

You can check the domain names existing on the target environment by
[ajithpathiyil2::oracle]> ll $MW_HOME/../user_projects/domains
Open the domain list for editing
[ajithpathiyil2::oracle]> vi $TGT_CLONE_DIR/domain_list.txt
Enter new domain names next to the domain directories listed in the file. Use space as a
delimiter.
For example
[ajithpathiyil2::oracle]>
/u01/app/oracle/otc1d_cl/wlserver/user_projects/domains/ajith_domain ajithclone
Save the domain list.
b.3.3. Restore domains
If directory $HOME/dbs does not exist, create it
[ajithpathiyil2::oracle]> mkdir $HOME/dbs
Restore all domains specified in the domain list in cycle at once.
Links to the domain environment files will also be created.
[ajithpathiyil2::oracle]> cat $TGT_CLONE_DIR/domain_list.txt | while read
DOMAIN_LINE
> do
> SRC_DOMAIN_HOME=`echo $DOMAIN_LINE | cut -d' ' -f 1`
> SRC_DOMAIN_NAME=${SRC_DOMAIN_HOME##*/}
> TGT_DOMAIN_NAME=`echo $DOMAIN_LINE | cut -d' ' -s -f 2`
> TGT_DOMAIN_NAME=${TGT_DOMAIN_NAME:-$SRC_DOMAIN_NAME}
>
TGT_DOMAIN_HOME=${MW_HOME%/*}/user_projects/domains/$TGT_DOMAIN
_NAME.
> echo "Unpacking domain "$SRC_DOMAIN_NAME" as "$TGT_DOMAIN_NAME" to
"$TGT_DOMAIN_HOME
> $WL_HOME/common/bin/unpack.sh -domain=$TGT_DOMAIN_HOME
> -template=$TGT_CLONE_DIR/${SRC_DOMAIN_NAME}.jar
> ln -s $TGT_DOMAIN_HOME/bin/setDomainEnv.sh ~/dbs/init_`echo
${TGT_DOMAIN_NAME}
> | tr [:lower:][:upper:]`_wl.sh
> done
Sample output
Unpacking domain ajith_domain1 as ajithclone to
/u01/app/oracle/fusion/user_projects/domains/ajithclone
<< read template from "/u01/app/oracle/fusion/clone/ajith_domain_apps.jar"
>> succeed: read template from
"/u01/app/oracle/fusion/clone/ajith_domain_apps.jar"
<< write Domain to "/u01/app/oracle/fusion/user_projects/domains/ajithclone"
...............................................................................................
>> succeed: write Domain to
"/u01/app/oracle/fusion/user_projects/domains/ajithclone"
<< close template
>> succeed: close template

b.3.4. Configure domains


You must perform these actions for each domain you are cloning.
You can always obtain the list of domains being cloned by the following script
[ajithpathiyil2::oracle]> cat $TGT_CLONE_DIR/domain_list.txt | while read
DOMAIN_LINE
> do
> SRC_DOMAIN_HOME=`echo $DOMAIN_LINE | cut -d' ' -f 1`
> SRC_DOMAIN_NAME=${SRC_DOMAIN_HOME##*/}
> TGT_DOMAIN_NAME=`echo $DOMAIN_LINE | cut -d' ' -s -f 2`
> TGT_DOMAIN_NAME=${TGT_DOMAIN_NAME:-$SRC_DOMAIN_NAME}
>
TGT_DOMAIN_HOME=${MW_HOME%/*}/user_projects/domains/$TGT_DOMAIN
_NAME
> echo
"===============================================================
========"
> echo "Domain name: $TGT_DOMAIN_NAME"
> echo "Domain home: $TGT_DOMAIN_HOME"
> echo "Domain environment: . ~/dbs/init_`echo ${TGT_DOMAIN_NAME} | tr
[:lower:] [:upper:]`_wl.sh"
> done
[ajithpathiyil2::oracle]>
b.3.4.1. Environment variables
Set the domain environment
Note: You can simply copy the corresponding environment command from the output
of previous script
[ajithpathiyil2::oracle]> . ~/dbs/init__wl.sh

b.3.4.2. Edit config.xml


Edit the domain configuration file
[ajithpathiyil2::oracle]> vi $DOMAIN_HOME/config/config.xml

Note: You can correct hostname at once by using vi command, e.g.


:%s:old_hostname:new_hostname:g
When choosing ports check that the chosen port is not in use by
[ajithpathiyil2::oracle]> netstat -anp | grep
Save the domain configuration file config.xml.
b.3.4.3. Start the domain Administration Server
Start WLST utility
[ajithpathiyil2::oracle]> java weblogic.WLST
Start the domain Administration Server via Node Manager. Specify your Node
Manager username, password and the domain name.
[ajithpathiyil2::oracle]>
nmConnect(username='weblogic',password=’*********’,domainName='')
> nmStart('AdminServer')
> exit()

Connect to the Administration console and start the Management Servers as


appropriate.
To connect to the Administration console the URL should be formed as follows using
values for Administration server.
https://:/console

(c) Change passwords


Change the domain administrator (user weblogic) password:

1. Connect to the Administration Console

2. Click 'Security Realms' in the Domain Structure

3. Click 'myrealm'

4. Select 'Users and Groups' tab


5. Select 'Users' sub-tab

6. Click user 'weblogic'

7. Select 'Passwords' tab

8. Enter a new password into 2 fields

9. Click 'Save'

Change the Node Manager password for current domain:

1. Connect to the Administration Console

2. Click on the domain name in the Domain Structure

3. Select 'Security' tab

4. Select 'General' sub-tab

5. Click 'Advanced' link

6. Enter the new Node Manager password into the fields 'NodeManager Password' and
'Confirm NodeManager Password'

7. Click 'Save'

(d) Set up data sources


Set up connection strings and passwords in the data sources:

1. Connect to the Administration Console

2. Click 'Services / Data Sources' in the Domain Structure

3. Click on the data source name

4. Select 'Configuration' tab

5. Select 'Connection Pool' sub-tab

6. Correct the connection descriptor in the 'URL' field

7. Locate the user name in the 'Properties' field


8. Enter the new password for this user into the fields 'Password' and 'Confirm
Password'

9. Click 'Save'

10. Repeat for each data source

(e) Start managed servers


Configuration of the WebLogic domain is completed. The Managed servers of this
domain can be started:

1. Connect to the Administration Console

2. Click 'Environment / Servers' in the Domain Structure

3. Select 'Control' tab

4. Mark checkboxes for all Managed servers that need to be started

5. Click 'Start' button

6. You may click on button to periodically refresh the table and observe the status of the
starting servers.

S-ar putea să vă placă și