Linking two database  based on DB link

i have a table emp in ORCL database
I have a table dept in ABCD database
Please help me how to create a db link and i have to create a new table in ORCL database with the following columns
Ename, Deptname
taking data from both the databases.

for example, on orcl database
CREATE DATABASE LINK abcd_link
CONNECT TO scott IDENTIFIED BY tiger
USING 'abcd_link';
create table new_table as select ename,deptname from emp e,dept@abcd_link d
where e.deptno = d.dept.no ;
doc about db link
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#SQLRF01205

Similar Messages

  • How do we connect two databases in Oracle other than Database Link?

    Good Morning,
    How do we connect two databases in Oracle other than Database Link?
    I am using Oracle 10g, I heard that we can connect two database in Oracle through ODBC. Is it possible? How?
    Thanks
    Nihar

    See if this helps.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4406709207206#18830681837358

  • Need help in merging two database

    Dear All,
    Can any one please let me know the methodology/Best practices for merging two databases.
    We are having two oracle Database A and B, the data from
    Database A has to be migrated to Database B using PL/SQL scripting.
    it will be a great help,Thanks in advance!

    Hi,
    Use the DB Links and try to use the "MERGE" that is better.
    you can clone it right, almost you are getting the same data from A to B and then you are going to Update is I am correct. Does the "B" consist the data, If yes then you can't clone on exiting DB, As i said above go for DB links and write custom scripts as per your requirement.
    Refer for DB links
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#sthref4108
    - Pavan Kumar N

  • I want to connect two database in Oracle

    Dear All
    I want to connect two database in Oracle ver-10.2.0.1.0 ,And fetch data from 2nd table.
    OS - XP Pro.
    Regards,
    Parwez

    Configure remote DB in TNS first.
    Create DB link.
    CREATE {PUBLIC} DATABASE LINK "DBLINKNAME"  CONNECT TO "remoteuser" IDENTIFIED BY "remotepwd" USING 'REMOTEDBTNSALIAS';Query remote tables using
    select * from remotetable@DBLINKNAME;

  • Split records into two files based on lookup table

    Hi,
    I'm new to ODI and want to know on how I could split records into two files based on a value in one of the columns in the table.
    Example:
    Table:
    my columns are
    account name country
    100 USA
    200 USA
    300 UK
    200 AUS
    So from the 4 records I maintain list of countries in a lookup file and split the records into 2 different files based on values in the file...
    Say I have records AUS and UK in my lookup file...
    So my ODI routine should send all records with country into file1 and rest to file2.
    So from above records
    File1:
    300 UK
    200 AUS
    File2:
    100 USA
    200 USA
    Can you help me how to achieve this?
    Thanks,
    Sam

    1. where and how do i create filter to restrict countries? In source or target? Should I include some kind of filter operator in interface.
    You need to have the Filter on the Source side so that we can filter records accordingly the capture the same in the File. To have a Filter . In the source data store click and drag the column outside the data store and you will have Cone shaped icon and now you can click and type the Filter.
    Please look into this link for ODI Documentation -http://www.oracle.com/technetwork/middleware/data-integrator/documentation/index.html
    Also look into this Getting started guide - http://download.oracle.com/docs/cd/E15985_01/doc.10136/getstart/GSETL.pdf . You can find information as how to create Filter in this guide.
    2. If I have include multipe countries like (USA,CANADA,UK) to go to one file and rest to another file; Can I use some kind of lookup file...? Instead of modifying filter inside interface...Can i Update entries in the file?
    there are two ways of handling your situation.
    Solution 1.
    1. Create Variable Country_Variable
    2. Create a Filter in the Source datastore in the First Interface ( SOURCE.COLUMN = #Country_Variable)
    3. Create a new Package Country File Unload
    4. Call the Variable in Country_Variable in Set Mode and provide the Country (USA )
    5. Next call the First Interface
    6. Next call the Second Interface where the Filter condition will be ( SOURCE.COLUMN ! = #Country_Variable )
    7. Now run the package .
    Solution 2.
    If you need a solution to handle through Filer.
    1. Use this Method (http://odiexperts.com/how-to-refresh-odi-variables-from-file-%E2%80%93-part-1-%E2%80%93-just-one-value ) to call the File where you wish to create store the country name into the variable Country_Variable
    2. Pretty much the same Create a Filter in the Source datastore in the First Interface ( SOURCE.COLUMN = #Country_Variable)
    3.Create a new Package Country File Unload
    4.Next call the Second Interface where the Filter condition will be ( SOURCE.COLUMN ! = #Country_Variable )
    5. Now run the package .
    Now through this way using File you can control the File.
    Please try and let us know , if you need any other help.

  • Do I need Distributed Transaction Scope when I have Two Database in Single SQL Server Instance

    Dear Sirs.
    I have Two Database in SQL Server Express 2008 R2, I Move Row From Database 1 Table 1 to Database 2 Table 1
    Do I need Distributed Transaction or just regular Transaction.
    Thank you in Advance. 
    Irakli Lomidze

    Dear Sirs.
    I have Two Database in SQL Server Express 2008 R2, I Move Row From Database 1 Table 1 to Database 2 Table 1
    Do I need Distributed Transaction or just regular Transaction.
    Thank you in Advance. 
    Irakli Lomidze
    Whats you are doing does not qualify under distributed transaction. Please read about distributed transaction from below link
    http://technet.microsoft.com/en-us/library/ms188721%28v=sql.105%29.aspx
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • How to compare two database on different servers

    hi,
    I want to compare two database on different servers in oracle.first i want to ckechk thier structures and then data.i m using oracle 10.2.0.plz help me out
    Thanks in advance

    In terms of structures, there are various tools out there that can do this, such as TOAD which can do a database compare.
    In terms of data comparisons, that will depend on what sort of results you are expecting to see. I'm sure some tools will do it for you, but it can be just as easy to write your own comparison using a database link from one database to the other.

  • Synchronisation between two databases tables

    Hello,
    In my case DATABASE A is always updating table TABLE XYZ of DATABASE B through MQ Series using online messages. Due to some reasons that link is down, could any one suggest how we keep continue synchronisation of these two databases, we can not modify any thing on DATABASE A we can only read it as it is master database while DATABSE B is updated by A.
    Table of DATABASE A is containing 2 Million records same with B. Can any one let me know how to compare the rows of the tables of each database and if some rows are missing in DATABASE B it should be updated by DATABASE A.
    Please suggest any solution so that both databases should be kepy synchroinised at table rows level.
    Thanks

    Read my suggestion in your other thread : Re: Two Different Databases Tables Synchronisation
    Nicolas.

  • Connection Between Two Databases

    Hi,
    I have two databases called DBS1 and DBS2. Both are in one system. I need link between these two databases. I want a query as follows.
    select * from cust@DBS2; # from DBS1
    select * from temp_cust@DBS1; # from DBS2
    Is possible link between DBS1 and DBS2.
    Can any one tell me how to link these two databases each other.
    Best Regards,
    Nilopher.
    null

    Nilopher,
    You can connect to two different Oracle databases by creating a database link. When you say that both databases are in one system I assume you mean two databases on the same server. To create a database link you can do the following:
    While logged onto DBS1:
    create database link dbs2
    connect to username identified by password
    using 'dbs2.world'
    Username and password are the user and password you want to connect as in dbs2.
    If you want everyone to be able to access the database link you can say create public database link... otherwise only the user that created the database link can use it.
    This should work assuming the database server tnsnames.ora file looks like this:
    dbs2.world =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL= TCP)(Host= hostname)(Port= 1521))
    (CONNECT_DATA = (SERVICE_NAME = dbs2))
    If your databases are on two different servers you'd have to look at each one's tnsnames.ora file and make sure each one had an entry for the other's database.
    I believe the database link name must be the same as the SERVICE_NAME if the parameter GLOBAL_NAMES=TRUE, if it's FALSE you can name it something else. By default this parameter is set to TRUE so I called the database link in the example dbs2.
    You can then access data from dbs2 while logged into dbs1 exactly how you said:
    select * from cust@DBS2;
    You can then repeat the process to do the same thing on dbs2 to connect to dbs1.
    Hope this helps.

  • Rollback does not work between two databases

    I have two databases, A and B and a database link.
    I have a procedure in database A that has calls to procedures of database B. When commit in A then gives error (ora-06512), then I make rollback, but only does for database A, in database B has recorded the data. It's normally? What's happens?
    Thanks

    I'm afraid you'll need to give as more information; ORA-06512 is a very generic message and is used to indicate which line another error occured. Can you tell us what that error was, and exactly what you're trying to do?
    Thanks,
    Colin

  • Two databases

    Hi All,
    I am have an issue to grab data from two databases using select query, Could any one can help me in this regard with example
    Thanks,
    RED

    Suppose you have two database A and B.
    You are in database A and want to run query which will relate table from both the databases. I think, That is want you need.
    For that after creating DB link from the syntax shown in link it will be
    SELECT a.*, bb.*
    FROM A, B@DB_LINK bb
    WHERE a.a1 = bb.a1;
    Hope it clears.
    One more link:
    http://www.psoug.org/reference/db_link.html
    http://www.lazydba.com/oracle/0__97467.html
    http://www.mydigitallife.info/2006/01/14/oracle-database-link/

  • Fetch Data from two Database

    I want to fetch data from two tables which are in two separate database. Is it possible to fetch similar from two schemas of same database.
    Pls help with query.

    Hi,
    Say you have two schema S1 and S2 in the same database 'xyz' then you can create two database links to these two schemas from any third schema as ::
    CREATE database link s1link connect to S1 identified by <password of S1> using 'xyz' ;
    CREATE database link s2link connect to S2 identified by <password of S2> using 'xyz' ;
    Now say if there is a table called tab1 in schema S1, then you can get data from it as ::
    SELECT T1.*
    FROM tab1@s1link T1
    WHERE < you can put conditions here> ;
    Similarly for the columns of a table of schema S2.
    - Thanks
    Sandipan

  • SQL referencing Two database instances

    I have searched through most of the posts regarding this subject so please bear with me.
    I have created two views in two database instances. Dev and prd.
    I am attempting to execute a simple query from Dev within TOAD.
    select * from [view_Name]
    minus
    select * from [view_Name]@PRD
    When I execute this I receive an error that the remote connection cannot be found.
    Do I have to create a database link using the TNS connection string, or is there another way to reference another database instance within the SQL?
    Any help is appreciated.

    You need to create a database link (see [url http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#i2061505]Oracle® Database SQL Reference).
    But I would not refer to other database objects directly like that. Should the link name change, or the remote object name's change, then each and every reference to those needs to be updated in all SQL and PL/SQL code.
    When dealing with foreign databases (like Informix for example), objects are case sensitive. Which means ample use of quotes to enforce case on the Oracle side.
    All this gets to be quite messy - especially during the maintenance of the code.
    Thus, instead of "hard references", use "soft references". Create local views on remote objects. Use those local views in all SQL and PL/SQL code. Any change to database link or remote object now only requires the applicable view to be updated - no hunting for code that needs to be changed.

  • How to check similarity between two Databases 9i & 10g after imp in 10g

    Dear all,
    Source
    =======
    OS server     ==>     HP-UX
    Oracle version     ==>     Oracle 9.2.0.8
    DB Name          ==>     MSST
    DB total users     ==>     320
    Full export in     ==>     /u02/export/Jan09.dmp
    Tablespaces     ==>     SC, SC_I, SA, SA_I, PP, PP_I, AC, AC_I, SD
    Destination
    ============
    OS server          ==>     HP-UX
    DB Name               ==>     CHDB
    Existg DB users          ==>     20
    Oracle version          ==>     Oracle 10.2.0.4
    copied 9i dump file in     ==>     /u03/export
    Tablespaces created same as Oracle 9i i.e;          
    Tablespaces     ==>     SC, SC_I, SA, SA_I, PP, PP_I, AC, AC_I, SD
    I had run full import on Destination server i.e; Oracle 10g & following is the command i used:
    imp system/pwd@conn_string file=/u03/export/Jan09.dmp log=/u03/export/Jan09_imp.log full=y ignore=y statistics=none
    *=== Imported successfully with few errors like ====*
    IMP-00017: following statement failed with ORACLE error 2299:
    "ALTER TABLE "EMP_PROMOTIONS_ORD" ADD CONSTRAINT "EMP_PROMOTIONS_ORD_UK" UN"
    "IQUE ("EMP_NO", "RANK_NO_FOLLOW") USING INDEX PCTFREE 10 INITRANS 2 MAXTRAN"
    "S 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "PP" "
    "LOGGING ENABLE "
    IMP-00003: ORACLE error 2299 encountered
    ORA-02299: cannot validate (PP.EMP_PROMOTIONS_ORD_UK) - duplicate keys found
    ORA-02299: cannot validate (PP.EMP_PROMOTIONS_ORD_UK) - duplicate keys found
    . . importing table "EMP_PROMOTION_DETAILS" 13333 rows imported
    . . importing table "EMP_PROMOTION_MAST" 725 rows imported
    . . importing table "EMP_PUNISHMENT" 271 rows imported
    . . importing table "EMP_REPORT_BOOKS" 60528 rows imported
    . . importing table "EMP_SALARY_HISTORIES" 120871 rows imported
    . . importing table "EMP_SALARY_HISTORIES_TEMP" 77044 rows imported
    . . importing table "EMP_TRANSACTIONS" 96536 rows imported
    IMP-00017: following statement failed with ORACLE error 2299:
    "ALTER TABLE "EMP_TRANSACTIONS" ADD CONSTRAINT "TRANS_UK" UNIQUE ("EMP_NO","
    " "DIR_NO", "DIR_DATE", "TRN_CODE") USING INDEX PCTFREE 10 INITRANS 2 MAXTRA"
    "NS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "PP_"
    "I" NOLOGGING ENABLE "
    IMP-00003: ORACLE error 2299 encountered
    ORA-02299: cannot validate (PP.TRANS_UK) - duplicate keys found
    Now my question is
    ===================
    How to check everything is same/similar like Oracle 9i database ( source ), for example ( i used this technique ):
    Can anyone tell me how to check similarity between two Databases 9i & 10g after import in 10g.
    MSST_DB>SHOW USER
    MSST_DB>SA
    MSST_DB>select object_type, count(*) from user_objects group by objects;
    OBJECT_TYPE     COUNT(*)
    DATABASE LINK     2
    FUNCTION     23
    INDEX          1795
    LOB          6
    PACKAGE          8
    PACKAGE BODY     8
    PROCEDURE     30
    SEQUENCE     67
    SYNONYM          60
    TABLE          644
    TRIGGER          3
    VIEW          20
    CHDB_DB>SHOW USER
    CHDB_DB>SA
    CHDB_DB>select object_type, count(*) from user_objects group by objects;
    OBJECT_TYPE     COUNT(*)
    INDEX          1794
    PROCEDURE     30
    TABLE          644
    TRIGGER          3
    VIEW          20
    FUNCTION     23
    SYNONYM          60
    PACKAGE BODY     8
    SEQUENCE     67
    PACKAGE          8
    LOB          6
    Edited by: VIKHARAHMED on Jan 10, 2012 3:02 AM

    [url http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_export.htm#sthref67]Guide.

  • Connecting Two database

    I have two Database. One the master databse is Oracle 7.3 and another Oracle 8.06. Now i want to update a field in Oracle 8.06 from Oracle 7.3. These updation also has to be done for the new records created. How i can do.

    May be using create database link!

Maybe you are looking for

  • [HP 2000-bf69WM] DOwngrading back to Windows 7 from Windows 8, drivers?

    I am done with Windows 8. The needle in the coffin is UEFI and dual booting linux. Is there another laptop model I can pull Win7(64bit) drivers from?  I know my model does not have Win7 drivers directly available from HP but I see some people are get

  • [SOLVED] Static IP/assigning router IP per box

    I am a bit confused about static IP and router IP even after reading some guides from searching. What I would like to do if possible is, I have one server and 2 desktops (one arch one win7) and I would like to assign one 192.168.1.10? IP per each. So

  • Editing XML and writing to a file.

    jus made some changes to an xml using the below code DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse("cric.xml");           Element elem = doc.getDocumentElemen

  • Problems buying the Photography Package through Amazon

    I tried to take advantage of Amazon's Black Friday promotion on the $9.99 photography package but have encountered nothing but roadblocks: 1) I ordered it through Amazon and got a confirmation/welcome email from Amazon 2) 30 minutes later, I got a se

  • Tables where BEx query variants are saved (BI 7.0)

    Hi Experts, I'm looking for the BI tables where BEx 7.0 saves query variants, but I don't find nothing. In BW 3.5 there were Table RSRVARIANT, but in BI 7.0? Could someone help me? Thanks in advanced Fede