Developers commonly use JDeveloper to create deployment project to upload files to MDS.To remove files from MDS, you need to use WLST tool. In fact, you can use WLST tools to import, export, delete, purge and remove MDS directories.
The following are the commonly used WLST “commands” to manipulate the MDS:
· importMetaData – import directories and documents
· exportMetaData – export MDS trees and documents
· deleteMetaData – delete MDS documents (not directories)
· sca_removeSharedData – remove directories and documents
These “commands” appear to be straight forward, but you can easily be tripped over if you don’t pay attention to some details.
Not All wlst.cmd Files Are Created Equal
Depends on how WLST is started, and where it’s started, you may have different “commands” available to you. Which WLST “commands” are available to you, depends on what .jar files you load into the classpath when you start WLST tool.With my locally installed SOA suite, I found 6 different versions of “wlst.cmd”:
Not all wslt.cmd files in this list support MDS commands. I know #2 doesn’t work.I was able to import and export MDS data using wslt.cmd under #3, C:\Oracle\jdev-mw\oracle_common\common\bin. But I have to use #6 (C:\Oracle\Middleware\Oracle_SOA1\common\bin) for sca_removeSharedData command to work.
Examples Using WSLT to Work with MDS
connect(‘weblogic’, ‘welcome1’, 't3://localhost:7001')
To export dataexportMetadata(application='soa-infra', server='soa_server1', toLocation='c:/junk/mdsout', docs='/apps/test/**')
Assuming I have some files in MDS under “/apps/test” tree, this command will create the “c:\junk\mdsout\apps\test” directory, this directory will contains all non-empty directories and files in MDS under ‘/apps/test’ tree.
Notes:1. You may need to do: exportMetadata(application='soa-infra', server='soa_server1', toLocation='c:/junk/mdsout', docs='/apps/test/**', remote=’true’) if your server is remote (not localhost).
2. You may need to do: exportMetadata(application='soa-infra', server='soa_server1', toLocation='c:/junk/mdsout/test.jar', docs='/apps/test/**') if your server is remote (not localhost) depends on which version of wlst.cmd you use.
3. This commands only dumps out non-empty tree structures in MDS
To import dataimportMetadata(application='soa-infra',server='soa_server1',fromLocation='C:/junk/mdsout', docs='/apps/test/**')
This will import data files under c:\mdsout\apps\test into MDS tree “apps/test”.
This command will not import empty directories. Like export command, you may need to import .jar file instead of directories.
To Delete DatadeleteMetadata(application='soa-infra',server='soa_server1',docs='/apps/test/**')
This will only delete all files under MDS /apps/test tree, it will not delete the directories.
To Remove the Directoriessca_removeSharedData('http://localhost:8001', ‘test’) - will remove MDS tree “/apps/test”
sca_removeSharedData('http://localhost:8001', 'test/dvm') - will remove MDS tree “/apps/test/dvm”
Be careful, do not add / in ‘test’ or ‘test/dvm’, otherwise WLST complains cannot find documents to remove.