views:

63

answers:

1

Well.. the question is descriptive enough I guess. What I am looking for is an exact equivalent of the below MySQL command in oracle-

mysqldump --xml --no-data -u[username] -p[pass] [db_instance] > [someXMLfile]

Where on a linux box do I have to run the oracle command? Straight inside the shell would do?

+1  A: 

You can get an XML representation of any given table using the GET_XML function in the DBMS_METADATA package. The DBMS_METADATA documentation has an example of generating the XML for all tables in a schema (this excludes the storage clauses, though you can obviously eliminate that call)

set pagesize 0
set long 90000
execute DBMS_METADATA.SET_TRANSFORM_PARAM(
  DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);
SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name)
     FROM USER_ALL_TABLES u
     WHERE u.nested='NO' 
     AND (u.iot_type is null or u.iot_type='IOT');
execute DBMS_METADATA.SET_TRANSFORM_PARAM(
   DBMS_METADATA.SESSION_TRANSFORM,'DEFAULT');
Justin Cave
Have used oracle too little to understand how packages (such as DBMS_METADATA) are used. But this looks interesting. Saving to learn more about it this weekend. Thanks for the answer!! :)
Wikidkaka