Tuesday, April 19, 2011

JDeveloper, WebCenter and MDS: Uploading/Downloading from an MDS database store

The previous posts on this topic tell you how to avoid using the MDS database store.
In a production system, you still need to be able to get at your MDS data in the database.

There are standard WLST commands to upload/download MDS data but there is also a built-in utility "mdstransfer", which also allows you to manage this data. 

This utility can be found under your JDeveloper install directory. Typically under:  jdeveloper/mds/bin/mdstransfer

The tool is fairly straightforward and takes a parameter file as input to define the source & target of the transfer operation along with the namespace to retrieve the data.

eg: To transfer all data from the MDS repository to a file to /tmp/end_data, create the following files:

tofile.sh
#!/bin/sh
$ORACLE_HOME/jdeveloper/mds/bin/mdstransfer "/**" --paramfile tofile.xml

tofile.xml - Replace the bold entries

<!--
Transfer documents from a directory to DB MetadataStore
-->
<parameters xmlns="http://xmlns.oracle.com/mds/config_10_1_3_001">

<source-store>
 <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
   <property name="jdbc-userid" value="<username>"/>
   <property name="jdbc-password" value="<password>"/>
   <property name="jdbc-url" value="jdbc:oracle:thin:@<server>:<port>/<sid>"/>
   <property name="partition-name" value="<MDS partition name used on deploy>"/>
 </metadata-store></source-store>
 <target-dir value="/tmp/end_data"/>
 <associated-docs>
   <customizations>
     <include-all-customizations value="true" />
   </customizations>
   <translations>
     <include-all-translations value="false"/>
   </translations>
   <extended-metadata exclude="true"/>
 </associated-docs>
</parameters>

Make sure the destination directory exists and run the script:

>mkdir /tmp/end_data
>./tofile.sh


To upload to the Database store from the filesystem create the following files.  This is just the same as the previous entry but with the switched to source-store/target-dir parameters changed to source-dir/target-store:

todb.sh
#!/bin/sh
$ORACLE_HOME/jdeveloper/mds/bin/mdstransfer "/**" --paramfile todb.xml

todb.xml - replace the bold entries

<parameters xmlns="http://xmlns.oracle.com/mds/config_10_1_3_001">
<source-dir value="/tmp/end_data"/>
<target-store>
 <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
   <property name="jdbc-userid" value="<username>"/>
   <property name="jdbc-password" value="<password>"/>
   <property name="jdbc-url" value="jdbc:oracle:thin:@<server>:<port>/<sid>"/>
   <property name="partition-name" value="<MDS partition name to deploy to>"/>
 </metadata-store>
</target-store>
<associated-docs>
  <customizations>
    <include-all-customizations value="true" />
  </customizations>
  <translations>
    <include-all-translations value="false"/>
  </translations>
  <extended-metadata exclude="true"/>
</associated-docs>
</parameters>

 Run the script
>./todb.sh

1 comment:

  1. The right namespace in 11g is http://xmlns.oracle.com/mds/config

    ReplyDelete