If you are working on migration environment where often you need to rename the domain name, then this guide will help you.

Changing WebLogic domain name is possible with modifying certain files under your domain.

This, I tested in a development environment and worked well for me. 

In this exercise – I have renamed from base_domain to new_domain

  • Take complete backup of your domain
  • Copy old domain name folder to new domain name
cp –rp base_domain new_domain
  • Search all files which contain base_domain in newly copied folder
chandan$ grep -r * base_domain --exclude-dir={tmp,logs,data,domain_bak}  
base_domain/bin/setDomainEnv.sh:DOMAIN_HOME="/Users/chandan/weblogic/base_domain"  
base_domain/bin/setDomainEnv.sh:LONG_DOMAIN_HOME="/Users/chandan/weblogic/base_domain"  
base_domain/bin/startManagedWebLogic.sh:DOMAIN_NAME="base_domain"  
base_domain/bin/startManagedWebLogic.sh:DOMAIN_HOME="/Users/chandan/weblogic/base_domain"  
base_domain/bin/startWebLogic.sh:DOMAIN_HOME="/Users/chandan/weblogic/base_domain"  
base_domain/bin/stopManagedWebLogic.sh:DOMAIN_HOME="/Users/chandan/weblogic/base_domain"  
base_domain/bin/stopWebLogic.sh:DOMAIN_HOME="/Users/chandan/weblogic/base_domain"  
base_domain/config/config.xml:  <name>base_domain</name>
base_domain/config/config.xml:    <name>base_domain</name>
base_domain/config/config.xml:    <name>base_domain</name>
base_domain/init-info/startscript.xml:<value>/Users/chandan/weblogic/base_domain</value>
base_domain/init-info/startscript.xml:<value>/Users/chandan/weblogic/base_domain</value>
base_domain/init-info/startscript.xml: <value>/Users/chandan/weblogic/base_domain</value>
base_domain/init-info/startscript.xml:<value>base_domain</value>  
base_domain/init-info/startscript.xml:<value>/Users/chandan/weblogic/base_domain</value>
base_domain/init-info/startscript.xml:<value>/Users/chandan/weblogic/base_domain</value>
base_domain/init-info/startscript.xml:<value>/Users/chandan/weblogic/base_domain</value>
base_domain/init-info/startscript.xml:<value>/Users/chandan/weblogic/base_domain</value>
base_domain/init-info/tokenValue.properties:@DOMAIN_HOME=/Users/chandan/weblogic/base_domain  
base_domain/init-info/tokenValue.properties:@DOMAIN_NAME=base_domain
base_domain/init-info/tokenValue.properties:@USERDOMAIN_HOME=/Users/chandan/weblogic/base_domain  
base_domain/startWebLogic.sh:DOMAIN_HOME="/Users/chandan/weblogic/base_domain"
chandans-imac:weblogic chandan$
  • Modify base_domain to new_domain in all above files. You can use sed to modify or manually you can do one by one. The choice is yours.
grep -r base_domain * --exclude-dir={tmp,logs,data,domain_bak} | xargs sed –I ‘s/base_domain/new_domain/g’
  • Ensure none of the files are having base_domain
bash-3.2$ grep -r base_domain * --exclude-dir={tmp,logs,data,domain_bak}
  • Go to AdminServer folder and delete cache, data, tmp folder
bash-3.2$ pwd 
/Users/chandan/weblogic/new_domain/servers/AdminServer
bash-3.2$ rm -rf cache/ data/ tmp/
  • Go to your New Domain and start Weblogic
chandans-imac:bin chandan$ pwd  
/Users/chandan/weblogic/new_domain/bin
chandans-imac:bin chandan$
bash-3.2$ ./startWebLogic.sh
<Jan 8, 2013 11:32:53 PM SGT> <Notice> <WebLogicServer> <BEA-000329> <Started WebLogic Admin Server "AdminServer" for  domain "new_domain" running in Production Mode>
<Jan 8, 2013 11:32:53 PM SGT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Jan 8, 2013 11:32:53 PM SGT> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>

That’s all! I started WebLogic managed server as well with no issues.

Learn more about Oracle Weblogic Administration here.