Thursday, April 23, 2015

Oracle SOA - How to Clean / Remove contents from MDS repository

Introduction:

           As a good practice, we need to clean up and remove unnecessary and unwanted files from the  MDS repository, whenever there is a major change in the composites / wsdl / xsd's or if you decide to create a new partition or renaming the default partition to some new name.

          With every deployment / import of the metadata artifacts a new document version will be created in the MDS. This means that redeploying an updated WSDL or XSD into the MDS does not delete the previous version of the document. This will end up in ORA MDS errors.


SOA MDS Repository Structure:

             SOA MDS repository has 3 default directories.

1. apps - All your metadata files like wsdl, xsd, dvm, xquery will be stored here.
2. deployed-composites - This contains all the composites which is deployed under soa-infra.
3. soa - Don't touch this as this contains SOA default application supporting files.


Steps to connect:

Navigate to - cd ${MIDDLEWARE_HOME}/Oracle_SOA1/common/bin/
Execute - ./wlst.sh

connect('weblogic','welcome1','t3://localhost:7002') - This needs to be connect to SOA Managed server and not Admin server.

Note : Make sure that your soa-infra is up and running and you have undeployed all the composites.

Deleting all files:

           You can use asterisk(*) to specify more than one files e.g. to delete all files with names starting with Customer - docs='/apps/wsdl/Customer*.wsdl.

deleteMetadata(application='soa-infra', server='soa-server1', docs='/deployed-composites/*')
deleteMetadata(application='soa-infra', server='soa-server1', docs='/apps/*')

Deleting files under specific folder:

            Below example will delete all the files under xsd directory.

deleteMetadata(application='soa-infra',server='soa_server1', docs='/apps/xsd/*')

Delete specific file:

           Below example will delete only newCustomer.xsd file.

deleteMetadata(application='soa-infra',server='soa_server1', docs='/apps/xsd/customer/newCustomer.xsd')

Deleting directory from MDS:

           Removes a top-level shared data folder, even if there are composites deployed in the service engine. This can be executed as WLST offline.

sca_removeSharedData(serverURL, folderName, [user], [password])
sca_removeSharedData('http://soa-server-url:8002', 'Project3')


Output looks like below,  if you get response code 500 then something should be wrong with the command or no files / directory to delete.

Creating HTTP connection to host:HOSTNAME, port:8002
Received HTTP response from the server, response code=200
---->Remove shared data success.

Note: It is good to restart SOA Managed servers after MDS Clean up. Similarly after deploying the new SOA Metadata check the soa-server-diagnostics.log file for the deployed list of metadata files and status.

No comments:

Post a Comment