Re: Copy table
Posted in 1997
Topics: Migration, Import/Export & Data Conversion
Stephane Magnan wrote:
>
> Hi all,
>
> I'd like to know how do I do to copy one table from one database to
> another database (database has a different name, but not the table).
>
> I cannot drop the target database, because it already has some tables.
>
> Thanks in advance
>
> Stephane
on your source database
1.using dbschema to get the SQL statement for creating this table
-> dbschema -d source_db_name -t table_name tabname.sql
2.run this SQL statement
-> unload to tabname.out
select * from table_name
on your target database
3.run the SQL statement you just get from source database by dbschema.
4.run this SQL statement
-> load from tabname.out
insert into tabname
then things will be o.k.
Note: If this table is huge, (lots of records) please use "dbload"
utility instead of step 4. (or turned off your log). Otherwise you could
have long transaction problem.