Monday, June 27, 2011

Delete Data from MDS - Single Files

In case an artefact is wrongly published into MDS, it can be deleted from the MDS using 2 ways.
  1. Deleting the entire folder
  2. Deleting the Selective Files
This post details about the latter.
A file can be deleted from the MDS using Weblogic Scripting Tool. However, in upgraded versions of AIA, this may be available through UpdateMetaDataDP.xml also, very much the same way as we update the artefacts in MDS. To delete a file from MDS follow the following steps.

1. Run WLST command from <MW_HOME>/oracle_common/bin or <SOA_HOME/common/bin>. Note there is same command available in Weblogic Server home directory too but MDS related commands can be accessed through residing in above locations only 
    $ cd $MW_HOME/oracle_common/common/bin

2. Type the connect command to connect to Admin Server 
   $ connect('weblogic', 'welcome1', 't3://localhost:7001')

3. Once it is connected, delete the undesired file by typing the following command (Note the path starting from /apps)
  $ deleteMetadata(application='soa-infra',server='soa_server1',docs='/apps/AIAMetaData/AIAComponents/ApplicationConnectorServiceLibrary/Generic.wsdl')

You can use asterisk(*) to specify more than one files e.g. to delete all files with names starting with Gen use 
You may get the following exception
MDS-91002: MDS Application runtime MBean for "soa-infra" is not available. "deleteMetadata" operation failure.
- Verify that your soa-infra is up and running and is on the correct server (Admin, soa_server1) as specified in the deleteMetadata() command 
- Verify that you've not fired the command to connect to other managed server during the steps to delete the file. If you connected firstly to SOA server, then to Admin Server and now you try to fire deleteMetadata(), it will give above error. Hence start again.

Happy Learning...