Re: copying tables from one database to another

From: Andrew <marlow.andrew_at_googlemail.com>
Date: Thu, 21 Jan 2010 14:10:23 -0800 (PST)
Message-ID: <5cc38491-5451-4cbb-bb51-ee4c018f0cd3_at_o28g2000yqh.googlegroups.com>



On Jan 20, 2:13 pm, Mark D Powell <Mark.Powe..._at_hp.com> wrote:
> > 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.

> 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.

> 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 Received on Thu Jan 21 2010 - 16:10:23 CST

Original text of this message