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)
·
purgeMetaData
·
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”:
1.
C:\Oracle\Middleware\wlserver_10.3\common\bin
2.
C:\Oracle\jdev-mw\wlserver_10.3\common\bin
3.
C:\Oracle\jdev-mw\oracle_common\common\bin
4.
C:\Oracle\Middleware\Oracle_OSB1\common\bin
5.
C:\Oracle\Middleware\oracle_common\common\bin
6.
C:\Oracle\Middleware\Oracle_SOA1\common\bin
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
cd c:\Oracle\jdev-mw\oracle_common\common\bin
connect(‘weblogic’, ‘welcome1’, 't3://localhost:7001')
To export data
exportMetadata(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 data
importMetadata(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 Data
deleteMetadata(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 Directories
sca_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.
Hello Yuan,
ReplyDeleteA long time has passed since you wrote this blog, but it was still helpful to me. Without your warnings and listed options, I would have thought that things did not work on my environment.
But now I got it working. Thanks.