dbTalk Databases Forums  

Copying from one schema to another in Oracle

comp.databases comp.databases


Discuss Copying from one schema to another in Oracle in the comp.databases forum.



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

Default Copying from one schema to another in Oracle - 08-14-2010 , 10:05 AM






Hello!

I have an application, an ecommerce website in fact, which sits on top of
an Oracle database and uses two schemas, one for the live data, and one
for content preparation. Both schemas are in the same database.

I need to move data from the preparation schema to the live schema.
Essentially, i want to do a perfectly straightforward "insert into
livetable (a, b, c) select a, b, c from preptable where ...", but where
livetable and preptable are in different schemas.

How do i do this? Is it as simple as prefixing the table names with the
schema names? Do i need to set up database links? Will this all work from
a transactional point of view?

Thanks,
tom

--
taxidermy, high tide marks, sabotage, markets, folklore, subverting, .

Reply With Quote
  #2  
Old   
Thomas Kellerer
 
Posts: n/a

Default Re: Copying from one schema to another in Oracle - 08-14-2010 , 11:22 AM






Quote:
I need to move data from the preparation schema to the live schema.
Essentially, i want to do a perfectly straightforward "insert into
livetable (a, b, c) select a, b, c from preptable where ...", but where
livetable and preptable are in different schemas.

How do i do this? Is it as simple as prefixing the table names with the
schema names?
Yes.


Quote:
Do i need to set up database links?
Only if those two schemas are located on two different physical servers


Quote:
Will this all work from a transactional point of view?
If those schemas are on the same server, yes.

Another option would be to use exp/imp (or expdb/impdb) to move a consistent snapshot of the data from one schema (or server) to another.

Thomas

Reply With Quote
  #3  
Old   
Tom Anderson
 
Posts: n/a

Default Re: Copying from one schema to another in Oracle - 08-15-2010 , 06:47 PM



On Sat, 14 Aug 2010, Thomas Kellerer wrote:

Quote:
I need to move data from the preparation schema to the live schema.
Essentially, i want to do a perfectly straightforward "insert into
livetable (a, b, c) select a, b, c from preptable where ...", but where
livetable and preptable are in different schemas.

How do i do this? Is it as simple as prefixing the table names with the
schema names?

Yes.
Excellent. For some reason, i'd been thinking this would be very
complicated.

The application logs into the two schemas with different usenames and
passwords. Presumably, i can somehow give one of the usernames access to
both schemas, right? Or rather, i can ask my DBA to do that.

Quote:
Another option would be to use exp/imp (or expdb/impdb) to move a
consistent snapshot of the data from one schema (or server) to another.
Good point. And i can do an expdp with a query, although i don't know if
it'll do arbitrary ones, so that covers that angle.

tom

--
One horse laugh is worth a thousand syllogisms. -- H. L. Mencken

Reply With Quote
  #4  
Old   
John B. Matthews
 
Posts: n/a

Default Re: Copying from one schema to another in Oracle - 08-15-2010 , 10:08 PM



In article <alpine.DEB.1.10.1008160045140.16335 (AT) urchin (DOT) earth.li>,
Tom Anderson <twic (AT) urchin (DOT) earth.li> wrote:

Quote:
The application logs into the two schemas with different usenames and
passwords. Presumably, i can somehow give one of the usernames access
to both schemas, right? Or rather, i can ask my DBA to do that.
Yes, a suitable database link includes the username and password:

<http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/ds_concepts002.htm#ADMIN12083>

"Using Synonyms to Create Location Transparency" is handy, too.

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

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 - 2012, Jelsoft Enterprises Ltd.