Unix Technical Forum

How to execute queries that query different db at same time?

This is a discussion on How to execute queries that query different db at same time? within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I have two sets of queries that query two different databases. I need to batch them together and execute ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-07-2008, 09:26 AM
abjiang
 
Posts: n/a
Default How to execute queries that query different db at same time?


I have two sets of queries that query two different databases. I need to
batch them together and execute them at same time. What is the best ay
of doing this? Thanks in advance for any advice.


Abby

--
Posted via http://dbforums.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-07-2008, 09:26 AM
Brian Peasland
 
Posts: n/a
Default Re: How to execute queries that query different db at same time?

Try creating a database link from one server (first) to another
(second). Then run both queries on the first server.

HTH,
Brian

abjiang wrote:
>
> I have two sets of queries that query two different databases. I need to
> batch them together and execute them at same time. What is the best ay
> of doing this? Thanks in advance for any advice.
>
> Abby
>
> --
> Posted via http://dbforums.com


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

Brian Peasland
dba@remove_spam.peasland.com

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


"I can give it to you cheap, quick, and good. Now pick two out of
the three"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-07-2008, 09:26 AM
Daniel Morgan
 
Posts: n/a
Default Re: How to execute queries that query different db at same time?

abjiang wrote:

> I have two sets of queries that query two different databases. I need to
> batch them together and execute them at same time. What is the best ay
> of doing this? Thanks in advance for any advice.
>
> Abby
>
> --
> Posted via http://dbforums.com


Assuming you mean databases in the Oracle sense ... a database link and
UNION ALL.

If what you mean is two different schemas in a single database ... just
UNION ALL.

--
Daniel Morgan
http://www.outreach.washington.edu/e...ad/oad_crs.asp
damorgan@x.washington.edu
(replace 'x' with a 'u' to reply)


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-07-2008, 09:27 AM
abjiang
 
Posts: n/a
Default Re: How to execute queries that query different db at same time?


Thanks for the replies.



I meant two different Oracle databases running on two different servers.
So it is possible to put both query sets in a single .sql script and
query both different Databases at the same time.....? How do I do a
database link between two databases and what command should I use in the
SQL script to open a remote DB connection?



Thanks for any information you can provide with me!



Abby


--
Posted via http://dbforums.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-07-2008, 09:27 AM
Daniel Morgan
 
Posts: n/a
Default Re: How to execute queries that query different db at same time?

abjiang wrote:

> Thanks for the replies.
>
> I meant two different Oracle databases running on two different servers.
> So it is possible to put both query sets in a single .sql script and
> query both different Databases at the same time.....? How do I do a
> database link between two databases and what command should I use in the
> SQL script to open a remote DB connection?
>
> Thanks for any information you can provide with me!
>
> Abby
>
> --
> Posted via http://dbforums.com


It is not our place to do your job for you unless you are paying the rack
rate. But we certainly can point you in the correct direction.

Go to http://tahiti.oracle.com and search on "DATABASE LINK".

Links are between databases and/or database schemas ... not tables.

Then your statement looks something like this:

SELECT *
FROM local_table
UNION ALL
SELECT *
FROM table@remote;

Where remote is the name of the database link.

--
Daniel Morgan
http://www.outreach.washington.edu/e...ad/oad_crs.asp
damorgan@x.washington.edu
(replace 'x' with a 'u' to reply)


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-07-2008, 09:28 AM
Ed prochak
 
Posts: n/a
Default Re: How to execute queries that query different db at same time?

abjiang <member35506@dbforums.com> wrote in message news:<3242307.1060974897@dbforums.com>...
> Thanks for the replies.
>
>
>
> I meant two different Oracle databases running on two different servers.
> So it is possible to put both query sets in a single .sql script and
> query both different Databases at the same time.....? How do I do a
> database link between two databases and what command should I use in the
> SQL script to open a remote DB connection?
>
>
>
> Thanks for any information you can provide with me!
>
>
>
> Abby


If you are willing to accept one script (versus one SQL script), then
may I suggest programming this operation in PERL? (you can connect to
multiple databases, merge/sort/manipulate the results, and output the
answers to almost anyplace
(files/displays/printer-plotters/networks/...)

Or is the only tool you have a hammer(SQL)?

Ed
"when all you have is a hammer, everything looks like a nail"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:14 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com