Thursday, January 18, 2018

How to delete Files and folders from MDS using WLST Commands

There are many times when will deploy unwanted files/folders into MDS and later we need to remove the same.
Below are few WLST commands which will be really helpful in this place.

To use those custom commands, you must invoke the WLST script from the appropriate Oracle home. Do not use the WLST script in the WebLogic Server home.
  • For MDS custom WLST commands, you must invoke the WLST script from the Oracle Common.
  • For other components, such as Oracle HTTP Server, Oracle SOA Suite, or Oracle WebCenter Portal, invoke WLST from the Oracle home in which the component has been installed. 
1. To delete files from MDS

To use these MDS custom WLST commands, you must invoke the WLST script from the Oracle Common. The path will look something like below,
Run Oracle/Middleware/oracle_common/common/bin/wlst.sh

Its a online function so do connect() and execute it.
Enter connect()
Give Username / password / URL (Port number belongs to Admin server)



After login, execute below command to delete the file from MDS,

deleteMetadata(application='soa-infra',server='soa_server1',docs='/apps/Sample/abc.wsdl')


2. To delete Folders from MDS

For components such as Oracle HTTP Server, Oracle SOA Suite, or Oracle WebCenter Portal, invoke WLST from the Oracle home in which the component has been installed. The path will be similar to below,

Run Oracle/Middleware/Oracle_SOA1/common/bin/wlst.sh
It's an Offline function. 

sca_removeSharedData('http://hostname:portno<SOAServerport>', 'AIAMetaData/AIAComponents/ApplicationObjectLibrary/Test','weblogic','weblogicpassword') 
It will remove the folder "Test" from apps/AIAMetaData/AIAComponents/ApplicationObjectLibrary/Test



Note: to delete the folder, the folder should atleast contain one file. If the folder doesn't contain any files, there is a work around to remove dummy folders from MDS. You can delete the folders directly from MDS schema, with the help of below URL.

select * from mds_paths where path_fullname like '%/apps/AIAMetaData/Custom%';
It will delete all the folders(subfolders) under AIAMetadata/Custom
But please be very careful about executing this statement.

References:
http://docs.oracle.com/cd/E28271_01/web.1111/e13813/custom_mds.htm
https://docs.oracle.com/cd/E23943_01/web.1111/e13813/custom_soa.htm#WLSTC2689
https://docs.oracle.com/cd/E23943_01/core.1111/e10105/getstart.htm#ASADM109

No comments:

Post a Comment