dbTalk Databases Forums  

Creating remote table thru a DB Link

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


Discuss Creating remote table thru a DB Link in the comp.databases.oracle.misc forum.



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

Default Creating remote table thru a DB Link - 04-28-2006 , 11:48 AM






I am trying to do a 'create table as select' to create a remote table,
but I am getting the error "ORA-02021 DDL operations are not allowed on
a remote database". Is this operation at all possible? The error
seems to say no but I've read and been told that you just need the
privs to do this on the remote database but I don't know the privs.

For example, this is what I need to do:
- have a dblink from instance 1 (local) to instance 2 (remote)
- create table XXX on the local database
- create table on the remote database using the statement:
create table XXX@remote_db as select * from XXX;

The database link is logging on to the remote db as a user that has the
privs to create tables. Is there something I need to do to make this
work or is the operation just not possible?

Thanks,
Dan


Reply With Quote
  #2  
Old   
Michel Cadot
 
Posts: n/a

Default Re: Creating remote table thru a DB Link - 04-28-2006 , 12:09 PM







"Dan" <daniel.ostertag (AT) visaer (DOT) com> a écrit dans le message de news: 1146242891.400839.84040 (AT) y43g200...oglegroups.com...
Quote:
I am trying to do a 'create table as select' to create a remote table,
but I am getting the error "ORA-02021 DDL operations are not allowed on
a remote database". Is this operation at all possible? The error
seems to say no but I've read and been told that you just need the
privs to do this on the remote database but I don't know the privs.

For example, this is what I need to do:
- have a dblink from instance 1 (local) to instance 2 (remote)
- create table XXX on the local database
- create table on the remote database using the statement:
create table XXX@remote_db as select * from XXX;

The database link is logging on to the remote db as a user that has the
privs to create tables. Is there something I need to do to make this
work or is the operation just not possible?

Thanks,
Dan

As the error message states, you can't do it.

Regards
Michel Cadot




Reply With Quote
  #3  
Old   
Brian Peasland
 
Posts: n/a

Default Re: Creating remote table thru a DB Link - 04-28-2006 , 01:51 PM



Not possible through the database link. But since you have the account
to in the remote database, why not just sign on to the remote database
with SQL*Plus? Then create your table.

HTH,
Brian




--
================================================== =================

Brian Peasland
oracle_dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown

Reply With Quote
  #4  
Old   
Vladimir M. Zakharychev
 
Posts: n/a

Default Re: Creating remote table thru a DB Link - 04-29-2006 , 07:43 AM



Dan,

you can

create table xxx as select from xxx@remote;

but you can't

create table xxx@remote as select from xxx;

The difference is obvious. You have a few ways around this, but they
require that you create a dblink on remote server back to the source
server. You can then log into the remote db and ctas * from xxx@source
or you can create a stored procedure like this:

procedure copy_table
is
begin
execute immediate 'create table xxx as select * from xxx@source';
end copy_table;

and then run it from source db:

SQL> exec copy_table@remote

Hth,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com


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.