Sam,
When you use the technique(s) mentioned above, you need to be aware that if there are any constraints on the original tables, you need to re-build them by hand (except for NOT NULL). This means that any PRIMARY KEY, FOREIGN KEY, CHECK, and UNIQUE constraints don't come across to the new table with "CREATE TABLE...AS SELECT..." syntax.
A method that does include cloning of all constraints, storage parameters, et cetera, and allows you to even edit the table-creation code before running is to use the following procedure:
1) Log into the source schema.
2) select dbms_metadata.get_ddl('<obj. type>','<name>','<schema>') from dual;
Example: select dbms_metadata.get_ddl('TABLE','S_EMP','DHUNT') from dual;
3) Copy the result to a file that becomes a SQL script.
4) Edit the script to change the schema name from its original to the new, target schema. Notice that if there are any foreign keys, you must either create the parent tables first or disable the constraints and re-enable them after you create the parent tables. If there are other schema references such as indexes, modify the schema names as needed, as well.
5) Execute the script.
6) Once the new table is in place, you can to an
"insert into <new_table_name> select * from <original_schema>.<original_table_name>;"
Thanks go to Tek-Tipster, Carp, for refreshing my memory on the syntax for "select dbms_metadata.get_ddl('<obj. type>','<name>','<schema>') from dual;"
Let us know if this method works for you,
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA @ 18:17 (15Dec03) GMT, 11:17 (15Dec03) Mountain Time)