SantaMufasa
Technical User
I invite the Great Oracle Minds of Tek-Tips to collaborate here to come up with the most efficient method of producing the SQL DDL code to reproduce all of the object structures of a schema. (We don't need to worry about rows of data, just the object structures' DDL.)
Amongst the restrictions are we cannot use export/import or Oracle data pump to produce the schema contents. The objective, again, is to produce DDL code that recreates all of the objects in a schema including:[ul][li]types[/li][li]sequences[/li][li]tables[/li][li]indexes[/li][li]triggers[/li][li]materialized views[/li][li]procedures[/li][li]functions[/li][li]packages and package bodies[/li][li]synonyms[/li][li]et cetera[/li][/ul]I highly recommend use of Oracle-supplied packages such as DBMS_METADATA and others. (I just wish there was a "DBMS_METADATA.CLONE_SCHEMA('<schema_name>')" procedure to do what I'm proposing in a single, clean invocation. Remember, this challenge must produce objects in such an order that reference objects upon which an object depends pre-exist: Example: our code must produce Parent Tables prior to Child Tables so that creation of child-table foreign keys will not fail due to the parent-table primary keys not yet existing.
I expect that this challenge/endeavor will end up being rather collaborative amongst contributors. But once we're done with this effort, I believe we will have an extremely valuable Oracle tool for each of our toolboxes.
Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”
Amongst the restrictions are we cannot use export/import or Oracle data pump to produce the schema contents. The objective, again, is to produce DDL code that recreates all of the objects in a schema including:[ul][li]types[/li][li]sequences[/li][li]tables[/li][li]indexes[/li][li]triggers[/li][li]materialized views[/li][li]procedures[/li][li]functions[/li][li]packages and package bodies[/li][li]synonyms[/li][li]et cetera[/li][/ul]I highly recommend use of Oracle-supplied packages such as DBMS_METADATA and others. (I just wish there was a "DBMS_METADATA.CLONE_SCHEMA('<schema_name>')" procedure to do what I'm proposing in a single, clean invocation. Remember, this challenge must produce objects in such an order that reference objects upon which an object depends pre-exist: Example: our code must produce Parent Tables prior to Child Tables so that creation of child-table foreign keys will not fail due to the parent-table primary keys not yet existing.
I expect that this challenge/endeavor will end up being rather collaborative amongst contributors. But once we're done with this effort, I believe we will have an extremely valuable Oracle tool for each of our toolboxes.
Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”