dbTalk Databases Forums  

copying tables from one database to another

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss copying tables from one database to another in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew
 
Posts: n/a

Default copying tables from one database to another - 01-20-2010 , 05:35 AM






How do people copy tables from one database to another? The docs say
that imp/exp are deprecated. I tried the copy command in sqlplus but
it destroys the indexes and default attributes! Arrgghh.

I have a feeling sql loader can be used to do the import but how do I
do the export first? Obviously any export will have to produce a file
that is suitable for use to sql loader.

Excuse my ignorance: I am more used to sybase where you can use bcp to
bcp-out followed by bcp-in.

Regards,

Andrew Marlow

Reply With Quote
  #2  
Old   
gazzag
 
Posts: n/a

Default Re: copying tables from one database to another - 01-20-2010 , 06:41 AM






On 20 Jan, 11:35, Andrew <marlow.and... (AT) googlemail (DOT) com> wrote:
Quote:
How do people copy tables from one database to another? The docs say
that imp/exp are deprecated. I tried the copy command in sqlplus but
it destroys the indexes and default attributes! Arrgghh.

I have a feeling sql loader can be used to do the import but how do I
do the export first? Obviously any export will have to produce a file
that is suitable for use to sql loader.

Excuse my ignorance: I am more used to sybase where you can use bcp to
bcp-out followed by bcp-in.

Regards,

Andrew Marlow
What version of Oracle? A couple of suggestions:

1. As you say, imp and exp are deprecated but have been superceded by
DataPump:

http://download.oracle.com/docs/cd/B...dp.htm#i436481

2. Create a database link and CREATE TABLE AS SELECT or INSERT
INTO ...over the link.

Some more ideas here:
http://groups.google.co.uk/group/com...aea9b2c161a1b8

HTH

-g

Reply With Quote
  #3  
Old   
Mark D Powell
 
Posts: n/a

Default Re: copying tables from one database to another - 01-20-2010 , 08:13 AM



On Jan 20, 7:41*am, gazzag <gar... (AT) jamms (DOT) org> wrote:
Quote:
On 20 Jan, 11:35, Andrew <marlow.and... (AT) googlemail (DOT) com> wrote:

How do people copy tables from one database to another? The docs say
that imp/exp are deprecated. I tried the copy command in sqlplus but
it destroys the indexes and default attributes! Arrgghh.

I have a feeling sql loader can be used to do the import but how do I
do the export first? Obviously any export will have to produce a file
that is suitable for use to sql loader.

Excuse my ignorance: I am more used to sybase where you can use bcp to
bcp-out followed by bcp-in.

Regards,

Andrew Marlow

What version of Oracle? *A couple of suggestions:

1. *As you say, imp and exp are deprecated but have been superceded by
DataPump:

http://download.oracle.com/docs/cd/B.../b14215/part_d...

2. *Create a database link and CREATE TABLE AS SELECT or INSERT
INTO ...over the link.

Some more ideas here:http://groups.google.co.uk/group/com...server/browse_...

HTH

-g
"deprecated" [sic] is not the same thing as obsoleted. Both exp and
imp still exist on 10g and 11g. If you are migrating the data fom 9i
to 10g you would likely stil use these utilities, namely the 9i exp
followed by the 10g imp.

The closest tool in Oracle to BCP is sqlldr which is used to load
delimited or fixed position data into existing Oracle tables. To
extract data in delimited format you could just spool the output of a
query via SQLPlus. Just set the pagesize to zero, turn off feedback,
and trim the trailing white space via set pagesize 0, set feedback
off, set trimspool on, etc.... See the SQLPlus manual on the set
command options.

HTH -- Mark D Powell --

Reply With Quote
  #4  
Old   
joel garry
 
Posts: n/a

Default Re: copying tables from one database to another - 01-20-2010 , 10:45 AM



On Jan 20, 3:35*am, Andrew <marlow.and... (AT) googlemail (DOT) com> wrote:
Quote:
How do people copy tables from one database to another? The docs say
that imp/exp are deprecated. I tried the copy command in sqlplus but
it destroys the indexes and default attributes! Arrgghh.

I have a feeling sql loader can be used to do the import but how do I
do the export first? Obviously any export will have to produce a file
that is suitable for use to sql loader.

Excuse my ignorance: I am more used to sybase where you can use bcp to
bcp-out followed by bcp-in.

Regards,

Andrew Marlow
impdb/expdp is the basic tool you should become adept with, in
addition to what the others noted there are some older ways:
http://tkyte.blogspot.com/2009/10/ht...tkyteflat.html

jg
--
@home.com is bogus.
The getting an immigrant visa the old fashioned way; money!
http://www.eb5greencard.com/eb5visa.php

Reply With Quote
  #5  
Old   
Andrew
 
Posts: n/a

Default Re: copying tables from one database to another - 01-21-2010 , 04:10 PM



On Jan 20, 2:13*pm, Mark D Powell <Mark.Powe... (AT) hp (DOT) com> wrote:
Quote:
What version of Oracle? *A couple of suggestions:
2. *Create a database link and CREATE TABLE AS SELECT or INSERT
INTO ...over the link.
Can't do that - it requires you to be the DBA.

Quote:
The closest tool in Oracle to BCP is sqlldr which is used to load
delimited or fixed position data into existing Oracle tables. *
Indeed. So it is the equivalent of bcp-in. I need bcp-out as well.

Quote:
To extract data in delimited format you could just spool the output of a
query via SQLPlus. *Just set the pagesize to zero, turn off feedback,
and trim the trailing white space via set pagesize 0, set feedback
off, set trimspool on, etc.... *See the SQLPlus manual on the set
command options.
I wrote a python script to do it. Was a bit of a fag but, hey, it
works now. It uses the data dictionary to get the column descriptions
for tables you name, and after the export from the target database it
uses sql-loader to import them. The dd is also used to create the
control files required by sql-loader.

-Andrew Marlow

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.