SyntaxHighlighter

Friday, December 14, 2012

Top 10 Useful Weblogic Commands

Overview:
Many times we run into situation when we
  1. forget weblogic admin password and don't know how to reset that. OR
  2. unable to login to weblogic admin console and want to know the status of server or Cluster OR
  3. perform JDBC pool operations like test or reset pool etc...
In this post, we will cover few important weblogic commands which one may use on daily basis.

Don't forget to set environment using "setDomainEnv.cmd".
1. Reset/Create Weblogic Password
  1. Shutdown the weblogic server instance (if running):
  2. Set the environment "setDomainEnv.cmd"
  3. Go to %DOMAIN_HOME%/security directory and take backup of "DefaultAuthenticatorInit.idift" file. e.g. DefaultAuthenticatorInit.idift.bkup.
  4. Change directory "cd %DOMAIN_HOME%/security".
  5. Run the following command:                                                                                                        java weblogic.security.utils.AdminAccount NEW_USER_NAME NEW_PWD .                        (Pay attention to the period (.) at the end of command. It is must and you need it).
  6. Start the Admin Server. 

2. Check Weblogic Server Version

java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic123 VERSION
OR
java weblogic.version
OR
Go to %BEA_HOME%/registry.xml (where BEA_HOME is the location where Weblogic is installed NOT your DOMAIN_HOME) and look for "<component name="WebLogic Server".

3. Take Thread Dump
Apart from other universal ways to take thread dump, weblogic also provides a hook to take dump as below:
java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic123 THREAD_DUMP

4. PING Server
java weblogic.Admin -url t3://localhost:7001 -username weblogic-password weblogic123 PING -timeout 30

5. Check Server Status
java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic123 GETSTATE GIVE_UR_SERVER_NAME (e.g. AdminServer)

6. Check CLUSTER STATE
java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic123 CLUSTERSTATE -clusterName GIVE_UR_CLUSTER_NAME (e.g. MyCluster)

7. Validate CLUSTER CONFIG
java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic123  VALIDATECLUSTERCONFIG -configPath config.xml (Supply FULL path to config.xml)

8. TEST JDBC POOL
java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic123 TEST_POOL JDBC_POOL_NAME (e.g. TestPool)

9. Check If JDBC POOL EXISTS
java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic123 EXISTS_POOL JDBC_POOL_NAME (e.g. TestPool)

10. RESET/REFRESH JDBC POOL
java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic123 RESET_POOL JBDC_POOL_NAME (e.g. TestPool)

Enjoy ! Hope it helps.



No comments:

Post a Comment