Thursday, March 20

How to compact the weblogic JMS Store?


The persistent file store that WebLogic uses never gets shrunk. It only grows. Sometimes these files would grow to hundreds of Megabytes and up to 2GB. 
The file store for HDM is usually in the following place on the filesystem: 
$DOMAIN_HOME/servers/JVMNAME_jmsstore/FS_JVMNAME000000.DAT

Compacting the file store
1. Bring the corresponding JVM down.
2. Make sure you are the app user
3. cd to the directory where the file store is located (e.g. $DOMAIN_HOME /servers/pbt74_7024_jmsstore)
4. Source the environment setting files:
. $WL_HOME/common/bin/commEnv.sh
. $WL_HOME /server/bin/setWLSEnv.sh
5. Run the weblogic store admin tool
java weblogic.store.Admin
6. The command line will look like below when you type in the "help" command:
storeadmin->help
Available Commands:
close : closes a previously opened store
compact : compacts the space occupied by a filestore
dump : dumps store or connection contents in human-readable format
help : displays available commands and usage
list : lists store names, open stores, or connections in a store
openfile : opens or creates a filestore for further operations
openjdbc : opens a jdbc store for further operations
opts : lists invocation options for this tool
quit : ends the admin session
verbose : controls display of additional information such as stack traces
7. Now compact the file store using the compact command:
storeadmin-> compact -dir ./

This will compact the .DAT files in the current directory. The way the tool does it by copying the file to a temp file and then only copying the relevant records back. It is much like re-indexing the file.
This command will copy all the messages in the old message store over to the newly created & compacted message store. No messages will be lost.
Please do not try this while the corresponding JVM is up and running. It will not work.
There seems to be a problem running "compact" command if java was run from the same directory where JMS filestore is located.
It is recommended to run java under the same ID as JMS filestore owner and one directory above the location of the file. "compact" command in this case would look like:
storeadmin-> compact -dir ./_jmsstore/

2 comments:

  1. I am tried to compact weblogic jms store but not succeed now with help of your post I am going try again in my weblogic server 12c training.Thank You.

    ReplyDelete
  2. could you please let me is there any other way to shrink the jmsfilestore with out stopping the corresponding JVM

    ReplyDelete