Tuesday, March 05, 2013

Delete Residual MDS entries

Why I write this?

Oracle FMW 11G uses MDS for storing details about deployed code. Some time even after un-deploying the composite, the composite details are not delete from the MDS.

Why I write this?
From past experience in FMW if you think there is a GUI based tool to view the MDS data and delete the details, that is the not the case in oracle FMW 11.1.1.6.0. That is a shame.

What are the options to view MDS data?
You can view the MDS data from the following locations.
1. JDeveloper SOA-MDS connection
2. Using the data tool like sqlDeveloper etc

View and Delete Options
Using JDeveloper SOA-MDS connection is well documented but there are no options to delete the composite using developer UI right click. This option is disabled in JDeveloper 11.1.1.6.0. That gets you for sure.

Using Sql Developer you can view the composite date.
For example if your composite that was undeployed and has residual data in MDS is called "ABC_State_delete" and was under the partition "ABC", you can look at the data using the query below. Yes off-course you need to the connect to the database where the MDS is configured.


select * from mds_paths
where path_fullname like '%/deployed-composites/ABC/ABC_State_delete%';

View and Delete Options


If you are thinking about deleting the data from the database directly, then that is not a good option.

What is the other option
Yes use WLST to delete data from MDS using the wlst command deleteMetadata()

Syntax to delete composite from MDS
Use this command when there is data left in MDS after un-deploying the composite. Else if you want to undeploy the composite using WLST then there is sca_undeployComposite().
Use this only when you want to delete meta data from MDS for a composite that has already been undeployed and the MDS still seems to contain details of the un-deployed composite. And is causing deployment issues.

So finally here is the real thing
Let me get the basic stuff out first

Step 1: Log into the server where SOA suite is installed

Step 2: Move to the directory where to enable WLST in SOA suite is installed
                Eg: ${INSTALL_DIR}/Middleware/${Oracle_SOA}/common/bin

Step 3: Run the wlst script to set all the environment variables
               Eg. on Linux it is wlst.sh

Step 4: Connect to the server (online mode)

connect ('weblogic user', 'password', 't3://soahostname:soaport')

Step 5: Delete the composite from MDS store using the below WLST command

deleteMetadata(application='soa-infra',server='soa_server1',docs='/deployed-composites/ABC/ABC_State_delete_rev1.0/**')

"application" name is the name of the SOA application, and default is "soa-infra"
"server" is the name of the server as you see in the console
"docs" is where the details "/deployed-composite" can be reference to delete composite details. Note this is not "/apps" shared MDS content

Build this string like "/deployed-composite" followed by partition i.e. "ABC" here and followed by composite name i.e. "ABC_State_delete"

Have you noted the "rev" and this represent the version

No more steps you just need to exit wlst script
Don't worry if the folder is still visible in JDeveloper, the data is gone