If you‘ve ever gone through the tedious process of renaming a WebLogic domain, you know it can be painful. References to the old domain name are sprinkled throughout configuration files, scripts, and variables. Miss one, and your renamed domain won‘t start.
In this comprehensive guide, I‘ll walk you through how to flawlessly rename your WebLogic domain. I‘ve done this process dozens of times over my career as a WebLogic admin and data analyst. I‘ll share all the tips and tricks I‘ve learned so you can update your domain name smoothly and painlessly.
Here‘s what I‘ll cover:
- When and why you might need to rename a domain
- Step-by-step instructions for the renaming process
- Best practices for backups, validation, and start up testing
- Advanced techniques for finding tricky name references
- Automation options to simplify domain renames
- Common mistakes and troubleshooting tips
I‘ll provide plenty of examples, scripts, and hard-won advice along the way. If you follow this guide, you‘ll gain the confidence to rename domains quickly without errors or downtime. Let‘s get started!
Why Rename a WebLogic Domain?
Before we dig into the how-to, let‘s discuss a few scenarios where you might need to rename a domain:
-
Consolidating domains – If you‘re consolidating multiple domains onto a new shared infrastructure, you‘ll likely need to rename for uniqueness.
-
Migrating to new environments – When migrating a domain to new servers, you may want to rename to indicate the new environment.
-
Mergers and acquisitions – During corporate changes like mergers, renamed domains can help separate development/test vs production environments.
-
Rebranding – Updates to corporate branding guidelines may require renaming domains to align with new standards.
-
Resolve naming conflicts – If you end up with naming collisions after moving or merging domains, renaming is the solution.
The time and risk associated with renaming varies based on the size and complexity of your domain. For small single-server domains, it may only take an hour or two with minimal downtime.
But for large multi-server production domains, you need to plan very carefully to minimize downtime. The steps are the same, but the scale is vastly different.
Bottom line – plan your changes carefully and use the techniques in this guide to rename your domains smoothly. Let‘s get to it!
Prerequisites Before You Rename
Before you kick off the renaming process, make sure you have the following ready:
-
Backup plan – Have a way to take full backups of the existing domain. You‘ll want a backup before making any changes.
-
Maintenance window – Schedule a maintenance window for the actual rename. This depends on domain size, but plan on a few hours of downtime.
-
Access – Confirm you have file system access to the domain home, plus access to run the domain start/stop scripts.
-
Knowledge – Review basic Linux commands like grep, sed, cp, and rm which you‘ll need during the steps.
-
Validation plan – Have a plan to test and validate domain functioning after the rename. Both manual and automated validation should be considered.
-
Roll back plan – If issues come up during validation, have a way to roll back to the pre-rename backup so you can start over.
Taking the time to line up these prerequisites will make the overall process smooth and headache-free.
Step 1: Take a Full Backup
I can‘t stress enough how important it is to take a full backup before renaming your domain. I always take backups even for simple dev domain renames.
Production domains absolutely require a backup in case any issues arise. As part of your backup plan, be sure to:
-
Backup the full
DOMAIN_HOMEdirectory, not just the config folder. -
Store the backup in a different location than the domain home folder.
-
Take backups when the domain is fully shut down and inactive.
-
Validate the integrity and completeness of the backup.
-
Allow time to re-run the backup if any issues are found.
Here is a sample backup command on Linux:
$ tar zcvf /backup/base_domain_backup.tgz /domains/base_domain
This creates a compressed tarball of the full domain home folder that you can roll back to if needed.
I also recommend doing a quick sanity check by grepping for the domain name:
$ tar tzvf /backup/base_domain_backup.tgz | grep base_domain
This scans the tarball contents and looks for the expected domain name references.
Once your backup is completed and validated, you‘re ready to move onto the next steps!
Step 2: Create Copy with New Domain Name
The next task is to create a copy of the domain folder with the new name you want.
For example, to rename base_domain to new_domain:
$ cp -r /domains/base_domain /domains/new_domain
This gives us a complete identical copy of the domain contents that we can begin modifying.
Pro tip – if your DOMAIN_HOME has a very large size, this copy step can take a while. You can speed it up by doing a hard link copy:
$ cp -al /domains/base_domain /domains/new_domain
The -a flag preserves permissions and owners, while -l creates hard links instead of copying files. This makes the copy much faster for large domain homes.
Okay, now we have our backup in place and a copied domain folder. Time to tackle the fun part – renaming!
Step 3: Find and Replace the Domain Name
Here comes the most critical and tedious step – finding and replacing every reference to the old domain name.
Over the years, I‘ve seen admins try to take shortcuts and manually update the few config files they know about. Don‘t give in to that temptation! It will come back to bite you.
You need to methodically find and replace across the entire domain folder. Here is my battle-tested process:
-
Use
grepto recursively search and output every instance of the old name:$ grep -R base_domain /domains/new_domain -
Pipe the
grepresults intosedto replace the name globally:$ grep -R base_domain /domains/new_domain | sed -i ‘s/base_domain/new_domain/g‘ -
Re-run
grepto confirm no more matches are found:$ grep -R base_domain /domains/new_domain
Let‘s break this down – the first grep casts a wide net to find any file with the old domain name.
The second step feeds those results into sed to efficiently replace the name in every file grep found.
And the final grep double checks that all references were updated correctly.
As a data analyst, I love that this process allows analysis of the scope (via grep) before transforming the data (with sed).
Using the output of one command to drive the next is a great example of Unix philosophy.
Anyway, that three-step process has never failed me across dozens of complex domain renames over the years.
Handling Tricky Name References
Occasionally, you may run into situations where the grep | sed combo misses some references to the old name.
Here are some tips on handling tricky name updates:
-
Binary files – Use
stringsandsedto update domain names embedded in binary files. -
Database entries – Queries and scripts may need to update rows containing the domain name.
-
Kubernetes resources – Update domain name references in Kubernetes YAML/JSON resource manifests.
-
Encrypted files – Domain names in encrypted files will not be found by
grep. Handle these carefully. -
Java code – If your own custom Java code references the domain, add extra logic to find and replace.
The key is realizing that grep has limitations – special cases like the above require custom handling. Know your environment and plan accordingly!
Step 4: Clear Admin Server Caches
Before starting the renamed Admin Server, you should clear out its cached data and tmp files.
This data likely contains old domain name references that can cause startup issues.
On Linux, delete the contents of the cache, data, and tmp folders:
$ rm -rf /domains/new_domain/servers/AdminServer/cache/*
$ rm -rf /domains/new_domain/servers/AdminServer/data/*
$ rm -rf /domains/new_domain/servers/AdminServer/tmp/*
On Windows, use rmdir or del instead of rm.
This cleanup gives your renamed AdminServer a fresh start.
Step 5: Start Up Admin Server
Here comes the moment of truth! Start up the renamed AdminServer to validate your changes.
Navigate to the new domain‘s bin folder:
$ cd /domains/new_domain/bin
And run startWebLogic.sh (or startWebLogic.cmd on Windows):
$ ./startWebLogic.sh
If all went well, you should see console output like this:
<Notice> <WebLogicServer> <BEA-000329> <Started WebLogic Admin Server "AdminServer" for domain "new_domain">
<Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
Note the key areas – a clean startup with the new domain name logged.
You can also double check the Admin Console at http://<admin_host>:7001/console. Log in and validate normal functioning.
Any errors starting the Admin Server indicate leftover references to the old name. Review the logs closely and re-check the config files.
Don‘t proceed until the Admin Server starts and functions properly. This validation is critical to avoid downstream issues.
Additional Validation
For maximum validation, you should consider:
- Starting up managed servers to verify integration.
- Running functional/smoke tests against the domain.
- Executing load and performance tests at scale.
- Checking monitoring and alerting for abnormalities.
The more validation, the better! For large production domains, I would recommend all of the above.
Step 6: Update Any External Integrations
The last piece of the puzzle is updating external systems that integrate with the domain.
For example:
- Scripts that invoke
wlstorweblogic.WLST - CI/CD pipelines with hardcoded domain names
- Kubernetes namespaces configured for the old domain name
You get the idea – look for any external code, config, or tools that reference the old domain name.
These types of changes take more effort, but are necessary to complete the rename.
Automating Domain Renames
Manually renaming domains works fine, but can become tedious after enough repetitions.
For frequent domain renaming needs, I recommend automating the entire process.
Here are some examples of automation tools I‘ve used successfully for this task:
-
Python scripts – Script the steps in Python, wrapping the shell commands.
-
Ansible playbooks – Define the rename process as repeatable Ansible plays.
-
Docker images – Build Docker images that take the old/new names as parameters.
-
Jenkins pipelines – Create Jenkins jobs/pipelines to orchestrate the rename.
-
WebLogic Kubernetes Tooling – Use the WDT to script domain renames.
No matter which tool you use, the goal is to codify your unique rename steps into an automated, repeatable process.
This saves immense time and effort when you need to rename domains frequently!
Common Errors and Troubleshooting
Despite best efforts, you may still encounter issues during or after a domain rename.
Here are some common errors I‘ve run into, along with troubleshooting tips:
-
Admin Server won‘t start – Check logs closely for old name references. Likely a config file or cache wasn‘t updated.
-
Managed Servers down – Validate Admin/Managed communications. Often a networking misconfiguration.
-
Cluster instability – Look for quorum and multicast problems. Renames can disrupt clustering.
-
Node Manager exceptions – Verify NM domain registration and configs. Easy to miss NM changes.
-
JMS destination problems – Queues/topics can sometimes reference old names. Recreate if needed.
-
Performance degradation – Check for cache misses or lock contention. Generally configuration-related.
Don‘t panic if you run into problems – just roll back to your pre-rename backup, and methodically retrace your steps.
Slow down, validate each piece, and you‘ll uncover the issue.
Final Thoughts
Renaming WebLogic domains is one of those tasks that seems simple at first glance. But do it a few times, and you quickly realize the complexities involved.
My hope is that this guide provides a definitive reference to smoothly renaming domains. I‘ve captured years of experience into what I consider best practices and proven techniques.
But if you have other tips or tricks you think I missed, I‘d love to hear them! Domain renames are one of those tasks where there is always more to learn.
So let me know if you have any suggestions for improving or simplifying the process.
And good luck with your next domain rename – I hope it goes smoothly thanks to the guidance here. Feel free to reach out if you have any other questions!