Wednesday, July 27, 2011

How to Remove Contents from MDS Repository

In 11g we can publish artifacts and commonly used schema, wsdl's in a meta data store to acccess across processes.

Often we realize that sometime we need to clean up and remove unnecessary and unwanted files from the repostiory.

There are two ways you can remove contents from MDS offline mode and online mode. I will explain both the options below

Option 1: Offline Mode


Step 1: Execute wlst.sh
Goto YOUR_MIDDLEWARE_HOME/Oracle_SOA1/common/bin and execute wlst.sh
Step 2: Run Command
At wlst command prompt (wls:/offline>) execute the following

sca_removeSharedData('http://yourhost:yourport', 'directory', 'adminuser', 'adminpassword')

To remove a folder named "common" folder and all it's sub-directories and files.

sca_removeSharedData('http://localhost:8001', 'common', 'weblogic', 'weblogic1')


Option 2: Online Mode


Step 1: Execute wlst.sh
Goto YOUR_MIDDLEWARE_HOME/Oracle_SOA1/common/bin and execute wlst.sh

Step 2: Connect to SOA server
At wlst command prompt (wls:/offline>) execute the following

connect('adminuser', 'adminpassword', 't3://hostname:port')

ex:
connect('weblogic', 'weblogic1', 't3://localhost:8001')

Step 2: Remove Content from MDS

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

2 comments:

mrPom said...

I'm new at MDS so i want to remove some data which I inserted in the wrong structure....sounds quite easy. After some looking around I should be able to do this using a deployment plan and WLST. I chose the last one as I am not realy familiar yet with deployment plans. I connect with my server and started WLST did the following:

wls:/offline> connect ('weblogic', 'mypassword' , 't3://localhost:8001')
Connecting to t3://localhost:8001 with userid weblogic ...
Successfully connected to managed Server 'soa_server1' that belongs to domain 'MY_DOMAIN'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

wls:/MY_DOMAIN/serverConfig> deleteMetadata(application='soa-infra', server='soa-server1', docs='/apps/deploy/*')



The outcome was:

Location changed to custom tree. This is a writable tree with No root.
For more help, use help(custom)

and after a while it closed the WLST connection. Can anyone tell me how I can remove data from my repository or what is going wrong here?

Thanks in advance

Kalyan Bitra said...

*Did you verify from Jdeveloper whether those have gone or not ?
*Change from '/apps/deploy/*' to '/apps/deploy' if you are planning on removing specific file give the entire path..
I'm will try and let you know once I'm near a system.