Multiple Database Links
I have created a database link in Oracle 9i to access the data stored in a remote MSSQL Server machine. Can I create multiple database links in Oracle 9i to access different remote MSSQL Server machines? If yes, please advise how to accomplish this. Thanks.
SK
From A, you can query synonym on B linked to table on C. Then grant select on this synonym to user user used for the dblink connection.
Nicolas.
Similar Messages
-
Same sql query with multiple database links
Hi All,
i want to execute an sql query for a SELECT LIST Item. which should use database links in it's query.
i'm having a list of database links in the region. say :LOC which is having 10 items each linking to different databases.
i want to use following query for another item in same page.
select customer_name from working_lines@:LOC where
phone_no:phone_no
can i do this.
Thank you All.What we have done before is to create a report based on a PL/SQL procedure that returns a SQL statement.
The PL/SQL code grabs the "selected" database link from :LOC and parses the SQL QUERY you want to execute replacing some token (like [LINK]) with '@DBNAME'.
Lets say your SQL statement is coded like this:
mySQL := 'SELECT cust_name FROM working_lines[LINK] where phone_no = :Phone;'
Then all you would have to do to replace '[LINK]' with the proper DB alias would be:
mySQL := REPLACE(mySQL, '[LINK]', '@'||:LOC);
and then return the new SQL ...
if :LOC has something like 'V10GPROD' your SQL would look like :
SELECT cust_name FROM working_lines@V10GPROD where phone_no = :Phone;
The beauty of this is that you can also include a "null" option that means the select statement will be executed on THIS database...
Doug -
Insert, update and delete trigger over multiple Database Links
Hello guys,
first of all I'll explain my environment.
I've got a Master DB and n Slave Databases. Insert, update and delete is only possible on the master DB (in my opinion this was the best way to avoid Data-inconsistencies due to locking problems) and should be passed to slave databases with a trigger. All Slave Databases are attached with DBLinks. And, additional to this things, I'd like to create a job that merges the Master DB into all Slave DB's every x minutes to restore consistency if any Error (eg Network crash) occurs.
What I want to do now, is to iterate over all DB-Links in my trigger, and issue the insert/update/delete for all attached databases.
This is possible with the command "execute immediate", but requires me to create textual strings with textually coded field values for the above mentioned commands.
What I would like to know now, is, if there are any better ways to provide these functions. Important to me is, that all DB-Links are read dynamically from a table and that I don't have to do unnecessary string generations, and maybe affect the performance.
I'm thankful for every Idea.
Thank you in advance,
best regards
ChristophWell, I've been using mysql for a long time, yes, but I thought that this approach would be the best for my requirements.
Materialized View's don't work for me, because I need real-time updates of the Slaves.
So, sorry for asking that general, but what would be the best technology for the following problem:
I've got n globally spread Systems. Each of it can update records in the Database. The easies way would be to provide one central DB, but that doesn't work for me, because when the WAN Connection fails, the System isn't available any longer. So I need to provide core information locally at every System (connected via LAN).
Very important to me is, that Data remain consistent. That means, that it must not be that 2 systems update the same record on 2 different databases at the same time.
I hope you understand what I'd need.
Thank you very much for all your replies.
best regards
Christoph
PS: I forgot to mention that the Databases won't be very large, just about 20k records, and about 10 queriees per second during peak times and there's just the need to sync 1 Table.
Edited by: 907142 on 10.01.2012 23:14 -
Procedure for multiple DB Links
Hi Everybody,
Hope everyone is doing fine. I am working on oracle 11g R2. I have one scenario on which i need your help guys. We need to have one one stored procedure which has comma seprated Database Links as IN parameter. This procedure has one update statement. So whatever multiple database links we will pass, this update statement needs to run only on those databases . Can you please help for options we can do to solve this scneario?
It will something like this:
CREATE OR REPLACE PROCEDURE TEST_SP(DB_LINKS_IN VARCHAR2, E_MGR_IN VARCHAR2, E_ID_IN NUMBER)
AS
V_SQL VARCHAR2(400);
BEGIN
V_SQL: = 'UPDATE EMPLOYEE@'||DB_LINKS_IN
SET EMP_MANAGER='||''''||E_MGR_IN||''''||'
WHERE EMP_ID ='||E_ID_IN||;
EXECUTE IMMEDIATE (V_SQL);
END TEST SP;
Above update statement needs to run in loop for Database links coming as comma seprated value from IN parameter DB_LINKS_IN. Can you please help in how to modify above procedure for DB links coming as comma seprated value?
I will greatly appreciate your comments and responses.
Regards
DevYou could try the following steps:
1. Create type
CREATE OR REPLACE TYPE MYSTRTABLETYPE AS TABLE OF VARCHAR2 (255);
2. Create function to parse comma-delimited list of db links:
CREATE OR REPLACE FUNCTION IN_STRLIST( P_STRING IN VARCHAR2 ) RETURN MyStrTableType
AS
L_STRING VARCHAR2(32000) DEFAULT P_STRING || ',';
L_DATA MyStrTableType := MyStrTableType();
N NUMBER;
BEGIN
LOOP
EXIT WHEN L_STRING IS NULL;
N := INSTR( L_STRING, ',' );
L_DATA.EXTEND;
L_DATA(L_DATA.COUNT) :=
LTRIM( RTRIM( SUBSTR( L_STRING, 1, N-1 ) ) );
L_STRING := SUBSTR( L_STRING, N+1 );
END LOOP;
RETURN L_DATA;
END;
3. Modify your procedure as follows:
CREATE OR REPLACE PROCEDURE TEST_SP(DB_LINKS_IN VARCHAR2, E_MGR_IN VARCHAR2, E_ID_IN NUMBER)
AS
V_DB_LINK MYSTRTABLETYPE := MYSTRTABLETYPE ();
V_SQL VARCHAR2(400);
BEGIN
V_DB_LINK := IN_STRLIST(DB_LINKS_IN);
for i in 1..V_DB_LINK.count
loop
V_SQL: = 'UPDATE EMPLOYEE@'||V_DB_LINK(i)||
' SET EMP_MANAGER='||''''||E_MGR_IN||''''||
' WHERE EMP_ID ='||E_ID_IN||;
EXECUTE IMMEDIATE (V_SQL);
end loop;
END TEST SP;
Please note I have not tested the code. Also you might want to consider using bind variables for the EMP_ID and EMP_MANAGER values. -
Can we link one application instance with multiple databases ?
We have R12.1.1 and db is 11.1.0.7 on redhat 5.3 ( 64 bit).
Can we link one application instance ( apps / , inst / ) with multiple database ( db / ),
is this possible ?
if yes how ?>
Can we link one application instance ( apps / , inst / ) with multiple database ( db / ),
is this possible ?
No. You cant link application tier with more than one database.
Similar query already answered by Hussein in detail in the forum :Re: Multiple instances, single Apps tier Please check that for more details
-Rk -
How to create linked server to multiple database on same server?
Hi Experts
I want to create linked server to multiple databases on the same server.
I have 2 database servers (ServerA and ServerB) and want to create linked server on ServerB to link multiple databases on ServerA).
I have admin right on ServerB.
I don't have admin right on ServerA but have different accounts to access on each databases on ServerA.
After I created one linked server object to a database, I cannot create another linked server object for another database as it has already used the server name which is ServerA.
Please advise.
Thanks.EXEC sp_addlinkedserver 'ServerADB1', '', 'SQLNCLI', 'ServerA', @catalog = 'DB1'
EXEC sp_addlinkedserver 'ServerADB2', '', 'SQLNCLI', 'ServerA', @catalog = 'DB2'
etc.
Please look up the details for sp_addlinkedserver as I typed this from memory.
I can certainly see a point in having one linked server per database, as then you don't have to hardcode the database name in the queries, and the linked-server definitions can be changed if the database name changes.
Erland Sommarskog, SQL Server MVP, [email protected] -
Multiple database members in a single Grid Row
Hi All,
I have created an FR report (9.3x) and getting the below error while trying to run the report via Web Preview.
5217: Error Processing Results;hasPovDims=1;povXML=<?xml version="1.0"?><datasources><datasource name="FIN QA" dsid="-117fcde3_132fd17f2f6_-771b" allowEdit="1"><dim name="Versions" dimIndex="0" dsName="FIN QA" keyDimName="Versions" memberName="Versions" displayName="Versions: Versions"/><dim name="Scenarios" dimIndex="4" dsName="FIN QA" keyDimName="Scenarios" memberName="Scenarios" displayName="Scenarios: Scenarios"/><dim name="Components" dimIndex="5" dsName="FIN QA" keyDimName="Components" memberName="Components" displayName="Components: Components"/><dim name="Customers" dimIndex="6" dsName="FIN QA" keyDimName="Customers" memberName="Customers" displayName="Customers: Customers"/><dim name="Assets" dimIndex="7" dsName="FIN QA" keyDimName="Assets" memberName="Assets" displayName="Assets: Assets"/></datasource><datasource name="FINDEF QA" dsid="-607fb334_128b79d246e_-7d0a" allowEdit="1"><dim name="Time Periods" dimIndex="1" dsName="FINDEF QA" keyDimName="Time Periods" memberName="Time Periods" displayName="Time Periods: Time Periods"/><dim name="Scenario" dimIndex="3" dsName="FINDEF QA" keyDimName="Scenario" memberName="SC_Actual" displayName="Scenario: SC_Actual"/><dim name="Versions" dimIndex="4" dsName="FINDEF QA" keyDimName="Versions" memberName="VR_Input_Version" displayName="Versions: VR_Input_Version"/><dim name="Customers_Region" dimIndex="6" dsName="FINDEF QA" keyDimName="Customers_Region" memberName="CU_NA" displayName="Customers_Region: CU_NA"/><dim name="Assets" dimIndex="7" dsName="FINDEF QA" keyDimName="Assets" memberName="Assets_NA" displayName="Assets: Assets_NA"/></datasource></datasources>
In my report I have selected 2 rows where I have selected @descendants of ccounts from one database which is FIN QA and in the second row I have selected @children of Accounts from another database which is FINDEF QA. I am using only ONE GRID here.
Is it not possibe to run a FR report by select members from multiple databases in a single grid??
Please have your valuable inputs.Yes it possible to retrive data from multiple database using single grid.
Also there are few limitations namely:
Database connections must be of the same type (for example, both must be Essbase database connections or both must be Financial Management database connections).
Mismatched number of dimensions in the database connections may cause retrieval errors.
For more details refer to this link for details:-
http://www.oracle.com/technetwork/middleware/financial-management/tutorials/obe-multipledbs-086586.html
Cheers
Vikas Naidu -
How can you SELECT via Database Link CLOB data using Application Express?
Customer Issue:
Developer using Oracle's Application Express 3.1. The Developer is trying to SELECT a CLOB datatype column from a remote (10.2.0.3) database, via a database link on her 10.2.0.4 based client Application. The Developer wants to be able to select CLOB data from the remote database which has limitation that she can't make any changes to the remote database.
Developer's Comments:
I do a select and get the error. Getting error ORA-22992: cannot use LOB locators selected from remote tables. So she feels she can't use dbms_lob.substr in this configuration I can do a "select into" but that is for one value. I am trying to run a select statement for a report that brings back more than one row. I do not have permission to change anything on the remote database. I want to access the remote database and multiple tables.
This is not something I work with, would greatly appreciate help or ideas. Is this a limitation of the 3.1; or does she just not have this set up correctly; or should she be using a Collection (if yes, please share example)
Thanks very much,
Pam
Edited by: pmoutrie on Jun 4, 2009 12:01 PM
Hello???
Would really appreciate an answer.
Thanks,
PamThis may not be a perfect solution for you but it worked for my situation.
I wanted to grab some data from Grid Control's MGMT$JOB_STEP_HISTORY table but I couldnt' create an Interactive Report due to the existance of a CLOB column. I cheated this by creating a view on the GC DB, grabbing the first 4000 characters and turning it into a varchar2 column:
create view test_job_step_history as
select job_Name, target_name, status, start_time, end_time, to_char(substr(output,1,4000)) output
from MGMT$JOB_STEP_HISTORY where trunc(end_time) > trunc(sysdate)-90
In an APEX Interactive Report:
select * from test_job_step_history@GCDB
Granted, the output looks aweful right now but I am only looking for a very particular output (failed, denied, ORA-, RMAN-, etc) so the formatting isn't the most important thing to me right now.
If anyone can improve -- and I'm sure you can -- on this I'd love to hear about it.
Thanks,
Rich -
Multiple databases in a single query
I need to query multiple databases in a single query.
e.g.
Database d1 contains table t1 with column id
Database d2 contains table t2 with column id
I need a query like
SELECT * FROM t1, t2 WHERE t1.id = t2.id;
is this possible in jdbc? if yes can anyone help with some sample code?
thanks,
Ashish SarafIt is not possible using the JDBC API to query tables in two or more databases using a single query. The reason is that a JDBC Connection is made to a single data source.
However, some databases support the idea of federations or linked tables. What you do is inside the database manager link or federate a table that is present in another DBMS. Then, pose a single JDBC query to the one DBMS which will have its own table and links to the external tables.
Another approach is to use a special JDBC driver with a built-in integration engine that will perform a query across multiple databases. In effect, the system poses separate queries to the different databases and integrates and joins the data together for you automatically on the client-side. That is much easier than doing it yourself in code, but that is also possible for simple queries.
As part of my research program, we have released a shareware version of the UnityJDBC driver that can query multiple databases using a single SQL query. For more information, see:
http://www.unityjdbc.com
http://www.cs.uiowa.edu/~rlawrenc/research/projects.html
Sincerely,
Dr. Ramon Lawrence
Assistant Professor
Department of Computer Science
University of Iowa
[email protected] -
Multiple file links in a single page: A better way to/efficient way to handle ?
Aloha Everyone!
I would like to ask the community how they have handled multiple file links in a single page. Sort of a pseudo database of files.
Here is the webpage I have been working on:http://huichawaii.org/
Here is what I have done to show files so far:
old version:http://huichawaii.org/proceedings---2012-education%2c-math---engineering-technology.html
new version: http://huichawaii.org/ahs2013-proceedings.html
The website works best in Chrom or Firefox, still have to convert the flash header to an edge animate .
Mahalo in advance for everyone's input!Depending on what other text you might have, you could use the data list component.
To get the text to have underlines, you will need to edit the repeated item. You can also adjust colors and fonts as well. The default rollover and selected states will probably not be the UI that want, so make sure you change those as well.
Now for the interactivity, select the datalist, and use the interactions panel, choose "On Select", then "Go To Url", the trick is to make sure the "When a specific item is selected" is also set. Here are the basic settings to get your links working:
Add new interactions for each item you want to be functional. -
Need to get data from multiple database instances in a single query
Hi,
I need a small favour from you guys. The prob is as follows:
I need to get name, row_id from table A from schema 1 and gbu_name, name from table B from schema 2 where a.name = b.name. I wrote the query in the following manner:
SELECT a.name, a.row_id, b.gbu_name
FROM Schema1.A as a, Schema2.B as b
Where a.name = b.name
But this query is not working and the error is like " The table does not exists".
Please update me how to avoid the error and get the right sort of result.
Thanks & Regards,
DebabrataAh, youre actually asking different things.
In your topic title, you say youre running separate instances
In your body text, you say you are under different user/schema
So tell me, do you have more than one database or not? How many entries in your TNS file?
I would say, for "multiple database instances"
SELECT
a.id, b.id
FROM
tableA a
INNER JOIN
tableB@OTHER_DATABASE_LINK_NAME b <--NOTE!
USING(id)And of course you will have to look up CREATE PUBLIC DATABASE LINK sql..
Message was edited by:
charred -
Can join queries in Oracle 8i and above span multiple databases
Hi,
In Oracle 8i and above, can join queries span multiple databases??
For eg., I have two databases A and B, and say database A has table A_T and
database B has table B_T. Assume that both the databases are on the same
server.
Can I run a join query from my application using OCI calls that spans across
tables from multiple databases, namely, A_T and B_T?
My query probably looks like this - Select * from A.A_T, B.B_T;
Thank you,
SashiIn Oracle 8i and above, can join queries span multiple databases??
For eg., I have two databases A and B, and say database A has table A_T and
database B has table B_T. Assume that both the databases are on the same
server.
Can I run a join query from my application using OCI calls that spans across
tables from multiple databases, namely, A_T and B_T?
My query probably looks like this - Select * from A.A_T, B.B_T;If you create a database link from database A to B your SQL would look something like this:
select * from A.A_T, B.B_T@dbB where A.A_T.PK = B.B_T.PK@dbB
The Oracle manuals should have the information you need on creating a database link. -
ORACLE EXPRESS: build a page with multiple forms linked to one table
hi,
im using oravle application express. APEX
i would like to build a page with multiple forms linked to one table (orders) , the page has 4 from each one with different order_id number (depending on filtering), and if the order is prepared click yes for each order and this 'YES' should be UPDATED AND SAVED to each order number in the same table with the press of one button.
i created all the form as (sql query)
and create one update process
(UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_1
WHERE ORDER_ID =:P10_ORDER_ID_1;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_2
WHERE ORDER_ID =:P10_ORDER_ID_2;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_3
WHERE ORDER_ID =:P10_ORDER_ID_3;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_4
WHERE ORDER_ID =:P10_ORDER_ID_4;
i dont know really if i can do that, but it appear hat it actually saving according to order_id number , but not all the time some time it saved the value as "null".
please guide me what is the correct way to do this.
I READ THIS ONE
http://stackoverflow.com/questions/7877396/apex-creating-a-page-with-multiple-forms-linked-to-multiple-related-tables
BUT IT WAS FOR MULTIPLE INSERT
thanks.Sans,
I am no Apex expert, but with a situation as "complex" as yours, have you thought about creating a VIEW that joins these 7/8 tables, placing an INSTEAD OF trigger on that view to do all the business logic in the database, and base your application on the view?
This is the "thick-database" approach that has been gaining momentum of late. The idea is to put your business logic in the database wherever possible, and let the application (Form, Apex, J2EE, whatever) concentrate on UI issues, -
Ora-02020 too many database links in use
Hi All,
While trying to update Table through datalink in my program I am getting the above error. Without modifying the v$parameter value ( 'open_links' ) in database how to use this feature to close Inactive sessions in BPEL ?Yes, I set the init.ora parameters on all servers and then restarted them. I still get the error.
Note that, for convenience, all my servers have public database links to all other servers in my private network.
This procedure (described at the start) works for one run of copying 50 tables from one server to one other server:
server1 runs the procedure and copies data from server2 to server3 (total of 3 servers in the process)But I get the error when I run the procedure to copy 40 tables from multiple servers to one other server:
server1 runs the procedure and copies data from server2, server3, and server4 to server5The error occurs when only four (or five) servers are involved in the process.
Any suggestions are greatly appreciated.
Edited by: user652257 on Nov 1, 2009 12:40 PM -
Trying to develop a functionality wherein we can view data of a remote database (not the database instance where APEX is installed) using the Report.
As APEX doesnot support multiple database instance access from a single workspace/applciation.. any workarounds .. I'v used dblinks previously.. but was on a lookout for a more roboust solution..Dont find db links a reliable opiton.Hi,
how about delving into the wonderful world of Web Services and XML?
APEX is quite powerful in that realm.
Of course WS adds a little overhead to communication and is a bit slower than a database link, but there are lots of benefits on the other hand. In my opinion it's the perfect option if you plan on loosely coupling your applications (not only APEX - ask the Java folks :-)
It always depends on what your expectations are concerning "Quality of Service". A typical APEX page wouldn't load like a million of rows and therefore Web Services might be the right way.
Maybe you are looking for
-
How to create business partner temblet
Dear friends, how to create business partner temblet . please send the following mail address [email protected] Thangs in advance Regards, S.Siva
-
Hi Can anybody explain me how to do bulk upload in SAP DMS. I want to prepare the metadata (with original file path) in Excel sheet and it has to be uploaded in SAP DMS along with original file. Thanks & Regards Harrshini Edited by: Harshini.A on Sep
-
Help Desk question ...
Hi... Am planning on taking the "mac os x help desk essentials" exam in a few weeks and would like some help in answering this question. Q. 'You work as a support technician at ITworld.com. A IT world user complains that her Mac is exhibiting system
-
Hi All, I have to assign default values to selection screen parameters based on tcode, How can i do that.
-
I think we casual users misunderstand ....
After 5 years of using Nero, I decided I had had enough with bloatware and switched to Premier Elements. After a *very* frustrating start, I think I have the basics down, and I know why so many casual users are so frustrated with the program. I won't