dbTalk Databases Forums  

querying over multiple database links

comp.databases.oracle.server comp.databases.oracle.server


Discuss querying over multiple database links in the comp.databases.oracle.server forum.



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

Default querying over multiple database links - 07-05-2011 , 10:01 AM






on database remote1 is a table I want to access => table1
I have a very limited schema/user created on remote2.

remote2 has public database link to remote1, so I can access
table1@dblink_to_remote1

I have another local database db1 with database link to remote2 =>
@dblink_to_remote2

I would like to create a table from remote1 on my local db1.
I can achieve that with export/import (giving remote2 credentials).

Is there a better solution for that task?

thanks,
chris

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

Default Re: querying over multiple database links - 07-05-2011 , 11:01 AM






On Jul 5, 4:01*pm, Krzysztof Cierpisz <ciape... (AT) gmail (DOT) com> wrote:
Quote:
on database remote1 is a table I want to access => table1
I have a very limited schema/user created on remote2.

remote2 has public database link to remote1, so I can access
table1@dblink_to_remote1

I have another local database db1 with database link to remote2 =
@dblink_to_remote2

I would like to create a table from remote1 on my local db1.
I can achieve that with export/import *(giving remote2 credentials).

Is there a better solution for that task?

thanks,
chris
CREATE TABLE <table_name>
AS SELECT * FROM <table_name>@<remote_database>;

HTH
-g

Reply With Quote
  #3  
Old   
Krzysztof Cierpisz
 
Posts: n/a

Default Re: querying over multiple database links - 07-05-2011 , 11:20 AM



On Jul 5, 6:01*pm, gazzag <justif... (AT) jamms (DOT) org> wrote:
Quote:
On Jul 5, 4:01*pm, Krzysztof Cierpisz <ciape... (AT) gmail (DOT) com> wrote:









on database remote1 is a table I want to access => table1
I have a very limited schema/user created on remote2.

remote2 has public database link to remote1, so I can access
table1@dblink_to_remote1

I have another local database db1 with database link to remote2 =
@dblink_to_remote2

I would like to create a table from remote1 on my local db1.
I can achieve that with export/import *(giving remote2 credentials).

Is there a better solution for that task?

thanks,
chris

CREATE TABLE <table_name
AS SELECT * FROM <table_name>@<remote_database>;

HTH
-g
the table is not on <remote_database> -> I have no direct access to
<remote_database>
I have only indirect access over a db_link from "another" database to
<remote_database>. I have a very limited access on this "another"
database so I cannot create any objects there.

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

Default Re: querying over multiple database links - 07-06-2011 , 04:54 AM



On Jul 5, 5:20*pm, Krzysztof Cierpisz <ciape... (AT) gmail (DOT) com> wrote:
Quote:
the table is not on <remote_database> -> I have no direct access to
remote_database
I have only indirect access over a db_link from "another" database to
remote_database>. I have a very limited access on this "another"
database so I cannot create any objects there.- Hide quoted text -

- Show quoted text -
Apologies Krzysztof, I should have read your post more carefully!

Can you not create a database link direct to remote1 from your local
db using the same credentials as the database link from remote2 to
remote1?

HTH
-g

Reply With Quote
  #5  
Old   
Krzysztof Cierpisz
 
Posts: n/a

Default Re: querying over multiple database links - 07-06-2011 , 02:48 PM



On Jul 6, 11:54*am, gazzag <justif... (AT) jamms (DOT) org> wrote:

Quote:
Can you not create a database link direct to remote1 from your local
db using the same credentials as the database link from remote2 to
remote1?
Unfortunately I don't know credentials that were used for creating
that public link. I can use it and know the username with which it
connects but cannot replicate that db link on my local database.

--
chris

Reply With Quote
  #6  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: querying over multiple database links - 07-06-2011 , 06:45 PM



On Wed, 06 Jul 2011 12:48:15 -0700, Krzysztof Cierpisz wrote:

Quote:
Unfortunately I don't know credentials that were used for creating that
public link. I can use it and know the username with which it connects
but cannot replicate that db link on my local database.
Actually, you can. If you retrieve DDL statement for the link by using
DBMS_METADATA, you will get "CONNECT TO <user> IDENTIFIED BY VALUES <...>
statement, which will enable you to re-create the link. Catch is that you
still need "select any catalog" privilege, in order to do that.



--
http://mgogala.byethost5.com

Reply With Quote
  #7  
Old   
Krzysztof Cierpisz
 
Posts: n/a

Default Re: querying over multiple database links - 07-07-2011 , 03:07 AM



On Jul 7, 1:45*am, Mladen Gogala <gogala.mla... (AT) gmail (DOT) com> wrote:
Quote:
On Wed, 06 Jul 2011 12:48:15 -0700, Krzysztof Cierpisz wrote:
Unfortunately I don't know credentials that were used for creating that
public link. I can use it and know the username with which it connects
but cannot replicate that db link on my local database.

Actually, you can. If you retrieve DDL statement for the link by using
DBMS_METADATA, you will get "CONNECT TO <user> IDENTIFIED BY VALUES <...
statement, which will enable you to re-create the link. Catch is that you
still need "select any catalog" privilege, in order to do that.

--http://mgogala.byethost5.com
yes, tried that already, but I don't have that priv.

--
chris

Reply With Quote
  #8  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: querying over multiple database links - 07-07-2011 , 08:07 AM



On Thu, 07 Jul 2011 01:07:03 -0700, Krzysztof Cierpisz wrote:

Quote:
yes, tried that already, but I don't have that priv.
Well then, you should pay a visit to your friendly neighbourhood DBA, who
has all the privileges needed to do the job.



--
http://mgogala.byethost5.com

Reply With Quote
  #9  
Old   
Krzysztof Cierpisz
 
Posts: n/a

Default Re: querying over multiple database links - 07-08-2011 , 03:29 AM



On Jul 7, 3:07*pm, Mladen Gogala <mgog... (AT) no (DOT) address.invalid> wrote:
Quote:
On Thu, 07 Jul 2011 01:07:03 -0700, Krzysztof Cierpisz wrote:
yes, tried that already, but I don't have that priv.

Well then, you should pay a visit to your friendly neighbourhood DBA, who
has all the privileges needed to do the job.
Yeah, that's what I did. I got access to the target database so no
issues for now.
I was just wondering what joel mentioned
'table_name@<remote_database>'@<remote_database2> if that is
supported.

thanks,
chris

Reply With Quote
  #10  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: querying over multiple database links - 07-08-2011 , 10:26 AM



On Fri, 08 Jul 2011 01:29:37 -0700, Krzysztof Cierpisz wrote:

Quote:
Yeah, that's what I did. I got access to the target database so no
issues for now.
That is what the DBA personnel is for, after all.

--
http://mgogala.byethost5.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.