🔧 Essential WLST Scripts for WebLogic Admins

WebLogic Scripting Tool (WLST) is a powerful command-line scripting tool that allows WebLogic administrators to automate management and monitoring tasks. Below are some essential WLST scripts that can help streamline WebLogic administration.

📊 Monitor JVM Heap Usage

This script connects to the WebLogic Admin Server and retrieves JVM heap memory statistics.

connect('weblogic','weblogic123','t3://localhost:7001')
serverRuntime()
cd('/JVMRuntime/'+AdminServer)
jvmStat =  AdminServer + ':' + str(get('HeapSizeMax')) + ':' + str(get('HeapSizeCurrent')) + ':' + str(get('HeapFreeCurrent')) + ':' + str(get('HeapFreePercent'))
print '# ' + jvmStat

Use this script to track heap memory utilization and prevent memory leaks.

📊 Monitor JVM Usage


🚀 Deploying an Application

This script deploys an application to WebLogic.

connect('weblogic','weblogic123','t3://localhost:7001')
deploy('MyApp', '/path/to/MyApp.war', targets='AdminServer')

Use this script to deploy applications to WebLogic effortlessly.

🚀 Deploy Your App



🔄 Starting and Stopping Managed Servers

This script starts and stops WebLogic Managed Servers.

Start Managed Server:

connect('weblogic','weblogic123','t3://localhost:7001')
start('ManagedServer1', 'Server')

Stop Managed Server:

connect('weblogic','weblogic123','t3://localhost:7001')
shutdown('ManagedServer1', 'Server', force='true')

Use these scripts to start and stop Managed Servers on demand.

🔄 Control Managed Servers


📡 Enable/Disable Data Sources

This script enables or disables a JDBC data source.

Enable Data Source:

connect('weblogic','weblogic123','t3://localhost:7001')
cd('/JDBCSystemResources/MyDataSource')
cmo.setEnabled(true)

Disable Data Source:

connect('weblogic','weblogic123','t3://localhost:7001')
cd('/JDBCSystemResources/MyDataSource')
cmo.setEnabled(false)

Use these scripts to manage data source availability dynamically.

🛢️ Manage Data Sources


🔧 Modify Connection Pool Settings

This script modifies the connection pool settings for a JDBC data source.

connect('weblogic','weblogic123','t3://localhost:7001')
edit()
startEdit()
cd('/JDBCSystemResources/MyDataSource/JDBCResource/MyDataSource/JDBCConnectionPoolParams/MyDataSource')
cmo.setMaxCapacity(50)
save()
activate()

Use this script to adjust connection pool capacity as needed.

🔧 Tune Connection Pool


🩺 Monitor Server Health and Status

This script monitors server health.

connect('weblogic','weblogic123','t3://localhost:7001')
serverRuntime()
cd('/ServerRuntimes/AdminServer')
print('Server Health: ' + cmo.getHealthState().getState())

Use this script to monitor WebLogic server health.

🩺 Check Server Health


🔄 Restart Servers on Failure Detection

This script checks the server state and restarts it if necessary.

connect('weblogic','weblogic123','t3://localhost:7001')
serverRuntime()
if cmo.getState() != 'RUNNING':
    shutdown('AdminServer', 'Server', force='true')
    start('AdminServer', 'Server')

Use this script to automatically restart servers on failure.

🔄 Auto-Restart Servers


🚀 Automate Your WebLogic Administration

With these WLST scripts, WebLogic administrators can efficiently manage and monitor their environment. Automating repetitive tasks improves reliability, reduces human error, and saves time.

💡 Need help with WebLogic automation? Contact us for expert assistance!

🤝 Connect With Us

Are you looking for certified WebLogic professionals or need expert guidance on your project? We are here to help!

🔹 Get Certified Candidates: Hire skilled professionals with WebLogic expertise.

🔹 Project Consultation: Get best practices and hands-on support for seamless implementation.

📞 Contact Us Now

💼 Discuss Your Project

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top