Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Move selected tables
>the problem with the 'create table newuser' concept is that none of the
>constraints (except for NOT NULL) get created. So, all primary key,
foreign
>key and indexes do not come along.
>
>Tom Mercadante
>Oracle Certified Professional
Right - but it is quite easy to use the dynamic SQL already illustrated in an earlier email reply (eg below) to capture the entirety of the DDL for a suite of tables, and transpose the whole lot into a new schema. In fact, I am doing this sort of thing repeatedly, as our users areas are regarded as 'development', with their objects (tables, triggers, constraints, the lot) being moved into our production schema more or less on demand.
peter
edinburgh
.........
-----Original Message-----
Sent: Monday, August 04, 2003 12:35 PM
To: Multiple recipients of list ORACLE-L
select 'create table newuser'||'.'||table_name||' as select * from
'||owner||'.'||table_name||';'
from dba_tables
where table_name like 'abc%';
Will give you some dynamic sql to do the creates. A similar statement would do the drops for the original tables afterwards assuming you have space for both.
Allan
-----Original Message-----
Sent: Monday, August 04, 2003 11:14 AM
To: Multiple recipients of list ORACLE-L
I need to move selected tables from one schema to another schema within the same database. The tables I need to move all start with the same prefix (abc_sometablename). Say there are 200 tables out of 1000 that I want to move. Is there an easy way to do this?
Thanks!
Ron
-- ********************************************************************* This e-mail message, and any files transmitted with it, are confidential and intended solely for the use of the addressee. If this message was not addressed to you, you have received it in error and any copying, distribution or other use of any part of it is strictly prohibited. Any views or opinions presented are solely those of the sender and do not necessarily represent those of the British Geological Survey. The security of e-mail communication cannot be guaranteed and the BGS accepts no liability for claims arising as a result of the use of this medium to transmit messages from or to the BGS. . http://www.bgs.ac.uk ********************************************************************* -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Robson, Peter INET: pgro_at_bgs.ac.uk Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Mon Aug 04 2003 - 12:29:22 CDT
![]() |
![]() |