8.1.7 connectivity using database link

I can't get my database link to work. It fails with ORA-12154: TNS:count not resolve service name
I have set up an entry in tnsnames that allows me to successfully tnsping the target database and I can connect via SQL*Plus using user/password@service_name.
I have successfully created a fixed user database link. The database link has the same name as the service name, although global_names is false in both Oracle instances.
Here's the tnsnames entry:
service_name =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 000.000.000.000) -- can't reveal the IP address
(Port = 1521))
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 000.000.000.000) -- can't reveal the IP address
(Port = 1576))
(CONNECT_DATA = (SID = sid)))
and here's the database link definition:
create database link service_name
connect to user identified by password
using 'service_name';
Am I missing something???

Is this tnsnames.ora that you sent is from the server or from your computer ? Because you need to set up an entry in the tnsnames from the server where the database link is created.

Similar Messages

  • TNS-12666 error occures when using database link

    When I am trying to use database link
    defined in my database the following error occures:
    TNS-12666 Dedicated server: outbound transport protocol different from inbound.
    In documentation is stated to resolve such an error to
    specify the same protocol in the SQL*Net connect string or alias for the outbound connection as that used for the inbound connection.
    I have in tnsnames.ora defined network service name
    by which I can connect to such a database by SQL*Plus
    without any problems, why can I not do such a thing
    via database link?
    Thanks a lot for advise, ...

    Could you change the following entry in your 'sqlnet.ora' file and try?
    SQLNET.AUTHENTICATION_SERVICES = (NONE)

  • How to Execute a Remote Procedure in Portal using Database Link

    Hi,
    I followed the instructions to create a Portal form for a remote procedure. But I am encountering the following error. Can someone advise what may be the cause?
    Failed to execute - Missing string(create_package_body) language(us) domain (wwv) sub_domain (wwv_builder) (WWV-04300)
    ORA-04020: deadlock detected while trying to lock object PUBLIC.PORTLET_SCHEMA (WWV-11230)
    Failed to parse as PORTAL - (WWV-08300)
    PURPOSE
    How to execute a remote procedure in Portal using Database Link.
    DESCRIPTION
    This procedure assumes that you have two databases, one of which is remote, and Portal is configured in the other.
    Remote Database A:
    ==================
    1) Create a procedure as follows: Create or Replace PROCEDURE SCOTT.ADD_TWO_VALUES ( v_one IN NUMBER, v_two IN NUMBER, v_result OUT NUMBER) as begin v_result :=v_one+v_two; end; 2) Grant execute privileges to PUBLIC on the procedure.
    Database B (where Portal is configured): ========================================
    1) Create a public database link and choose to connect as a specific user (say SYSTEM). By default, in an Oracle 8i database, the "global_names" parameter in initSID.ora (or init.ora) file is set to "true". This Global Naming parameter enforces that a dblink has the same name as the database it connects to. Therefore, if the remote global database (A) name is "ora8.acme.com" then the database link should also be named as "ora8.acme.com".
    2) Create a synonym for the procedure in Database A. Make sure you fully qualify the procedure name in the remote database (like SCOTT.ADD_TWO_VALUES).
    3) Create a dynamic page to execute the procedure. The ORACLE tags in the dynamic page will look similar to the following: <ORACLE> DECLARE v_total NUMBER; BEGIN ADD_TWO_VALUES(:v_one,:v_two, v_total); htp.p('The total is => '); htp.p('<input type="TEXT" VALUE='||v_total||'>'); htp.para; htp.anchor('http://<machine.domain:port#>/pls/portal30/SCOTT.DYN_ADD_TWO_VALUES.show_parms', 'Re-Execute Procedure'); END; </ORACLE>
    4) Portal does not have an option to create a form based on a synonym. Therefore, if you want to create a form instead of a dynamic page, create a wrapper procedure and then create a form based on this procedure. For example: Create or Replace PROCEDURE PORTAL30.ADD_TWO_VALUES_PR ( v_one IN NUMBER, v_two IN NUMBER, v_total OUT NUMBER) as begin add_two_values(v_one, v_two, v_total); end;
    5) Grant execute privileges to PUBLIC on the procedure.

    hello...
    any input will welcomed... Thanks..

  • Adding user to the oracle database using database link - is it possible?

    Hi, i wolud like to manage my databases using one client. I easilly operate on my distriubuted tables but i have problem with creating users in distribiuted database. Is it possible to create users in distributed database using database links? or it have to be done locally using some stored procedures or sth similar?

    The SQL syntax of the CREATE USER statement doesn't support DB links, the only way to do it would be with stored procedures. There might be an Oracle SP for that or for generic remote execution of SQL, but I'm not familiar with such.

  • How to use database link in from6i?

    I can use database link in sql plus,but i can't use it in forms6i,why? thanks

    Don't know why.
    What I always do is create a synonym on the local database which points (through the db link) to the object on the other database.
    Regards,
    Meine

  • Timeout when using database link connecting to a remote database

    Hi,
    I have another strange problem. I have two computers A and B. Both have an Oracle database server instance. I manage the one in B (which is my local computer) but not the one in A (which is a computer where I have a user account and an Oracle account but I don't own or manage).
    I tried to establish a database link on the database in B pointing to the one in A. This works.
    When I try the opposite, that is, establish a database link on the database in A pointing to the one in B I cannot get it work. I can create the database link but then when I try to use it (e.g., by submitting a "SELECT") it blocks for a long time and finally returns "ORA-12535: TNS:operation timed out". I tried to execute telnet from A to B using the port of the Oracle database server in B and it seems that the connection is established. I tried something similar with tnsping but this does not work, as I get again the timeout. I tried deactivating the firewall on my computer B, but it does not work either (besides, the telnet passes through even if I have the firewall activated).
    Any idea?
    My TNSPING looks like this:
    tnsping '(DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <the-target-ip>)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = XE)
    I also tried with:
    tnsping '(ADDRESS = (PROTOCOL = TCP)(HOST = <the-target-ip>)(PORT = 1521))';
    I'm lost... Any ideas are very much appreciated.
    Thanks!

    From A to B and from B to A can you ping ... post the output surrounded by tags for formatting.
    Do the same thing for TNSPING.
    What do these computers have in the way of firewalls and antivirus products installed and how are they configured?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Using database link to connect to two databases

    Hi guys,
    Here's my question. I need to give a contractor Select rights on tables located in two schemas located on two different servers. One server is dev and one is prod. Let's say we have schema user: EMPLOYEE on dev and schema user: DEPARTMENT on prod. The outside contractor needs select rights on all tables in DEPARTMENT schema but only needs select on a few tables ( 4 to be exact) from EMPLOYEE schema.
    My initial train of thougth is: CREATE a user named: TEST (random name of course, just used for an example) for contractor on prod. Give user TEST select rights on all tables in DEPARTMENT schema.
    Create database link to dev server so user TEST can access EMPLOYEE schema.
    How do i go about limiting the user TEST via the database link to only view the 4 tables from EMPLOYEE instead of all teh tables?
    Should I also consider doing this scenario in reverse? Creating user TEST on dev, giving TEST rights to the 4 tables in EMPLOYEE, then creating the database link to connect to department schema on prod database??
    Any help will be appreciated. Thanks in advance.

    zephyr223 wrote:
    Hi guys,
    Here's my question. I need to give a contractor Select rights on tables located in two schemas located on two different servers. One server is dev and one is prod. Let's say we have schema user: EMPLOYEE on dev and schema user: DEPARTMENT on prod. The outside contractor needs select rights on all tables in DEPARTMENT schema but only needs select on a few tables ( 4 to be exact) from EMPLOYEE schema.
    My initial train of thougth is: CREATE a user named: TEST (random name of course, just used for an example) for contractor on prod. Give user TEST select rights on all tables in DEPARTMENT schema.
    Create database link to dev server so user TEST can access EMPLOYEE schema.
    How do i go about limiting the user TEST via the database link to only view the 4 tables from EMPLOYEE instead of all teh tables? Only grant them access to those four tables from EMPLOYEE. You have to explicitly grant privileges anyways, and since there is no GRANT SELECT ON <SCHEMA> ability it should not be that difficult.
    Should I also consider doing this scenario in reverse? Creating user TEST on dev, giving TEST rights to the 4 tables in EMPLOYEE, then creating the database link to connect to department schema on prod database?? Are you creating database links as the EMPLOYEE and DEPARTMENT users? If so, I would caution against that. Create a "current user" database link for TEST. I think you can manage privileges better that way.
    HTH!
    HTH!

  • Use Database link connect to SQL Server

    I have a database link from Oracle to SQL Server using user cdit and this user connects to database "northwind".How can i get data from another database use this database link?

    Just add the @<<db link name>> to the table name in your SELECT
    SELECT *
      FROM <<table name>>@<<db link name>>Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Using database-link in view to get around ORA-01031 error

    I have been granted select rights on a users table. I am therefore able to select from his table. If however I try create a view against his table I run into the ORA-01031 problem. I have worked around this problem by creating a database-link to myself and then adding that to the view creation and it works. What are the downsides of using the database-link in this way?

    The only down side I have been able to identify is that a extra session is created and that the CPU has a little extra work due to the LOOP BACK that takes place. I need to ensure the network is not unnessesarly used and therefore will need to ensure that 127.0.0.1 (local host) is used in the database connection discription. e.g.
    create database link my_db_link connect to scott identified by tiger using '(description=(address=(protocol=tcp)(host=127.0.0.1) (Port = 1521) ) (connect_data= (sid=ora10g)))';

  • How can i get data from another database SQL Server use database link from

    I have a database link from Oracle connect to SQL Server database with user cdit connect default database NorthWind.How can I get data from another database(this database in this SQL Server use this database link)?

    hi,
    u should see following documentation:
    Oracle9i Heterogeneous Connectivity Administrator's Guide
    Release 1 (9.0.1)
    Part Number A88789_01
    in it u just go to chapter no. 4 (using the gateway),,u'll find ur answer there.
    regards
    umar

  • How to fetch,update,insert the data using database link on diff. servers

    I am using two oracle server.
    1st) Oracle 9i ( Server1 )
    2nd) Oracle 10g ( Server2 )
    3) Forms 6i
    I have created a database link on Server 1 for connecting to Server 2.
    I written a piece of code which will be executed in Forms 6i and is connected to Server1.
    The piece of code brings the data from SErver2 via cursor and I try to insert / update the relevant records
    in my Server1 database users.
    The Insert/Update runs sucessfully but at the time of commit I get the following errors
    in Forms ORA-01041:internal error. hostdef does not exist.
    Then it forcefully rollback the data and come out of the application.
    contact :email-id : [email protected]

    Suggest you test your code from sqlplus before running from forms.
    Start by testing a simple "select sysdate from dual@<database link>;" then test select from application_table@<database link> then test the insert/update code. After it works from sqlplus, then try it from forms.

  • Unable to access remote database object using database link

    Hi all,
    I have created a database link to a remote server
    SQL> create database link remote_link connect to lax_dba identified by lax_dba using 'abc.corp.com';
    database link created
    when i am trying to access any table of lax_dba
    sql> select * from laxtab@remote_link;
    i am getting this Ora error
    ORA-12514: TNS:listener does not currently know of service requested in connect
    I need your help please to solve this issue
    Thanks n Regards
    Laxman

    The database server where you defined the link (not your PC) has resolved 'abc.corp.com' to a server/port/service combination using its tnsnames.ora, sqlnet.ora and possibly ldap.ora settings. You can try
    tnsping abc.corp.comon the server (as ReubenC suggested) to see what it's attempting to connect to. (It's important to do this on the database server and not on your PC as they will have different tns settings etc.)
    It has then found the server and found a listener running on it (so you're getting close), but that remote listener doesn't recognise the service you're asking for. It might be something like the '.com' suffix.

  • Insert using database link

    Now connected to database B :
    INSERT INTO abc_hesids
              (     abc_key,
                   hesid,
                   date_added,
                   date_updated,
                   dob,
                   sex,
                   newnhsno,
                   homeadd,
                   procode3,
                   lopatid
              SELECT     'X',
                        0,
                        sysdate,
                        sysdate,
                        HES_Common.f_string_field('X', 1),
                        HES_Common.f_string_field('X', 2),
                        HES_Common.f_string_field('X', 3),
                        HES_Common.f_string_field('X', 4),
                        HES_Common.f_string_field('X', 5),
                        HES_Common.f_string_field('X', 6)
              FROM dual
    The above INSERT has been reduced down to bare minimum with the following error occurring :
    HES_Common.f_string_field('X', 1),
    ERROR at line 18:
    ORA-02069: global_names parameter must be set to TRUE for this operation
    SQL>
    The abc_hesids table exists in database A and this insert is running in database B. A database link exists such that abc_hesids is a synonym for the table of the same name in database A.
    I want Oracle to insert into the table in database A but use the package HES_Common in database B. I think this is possible but have not done this sort of thing for a while. Note : the package HES_Common exists in both databases A and B
    Any ideas on how to get Oracle to use the local version of the package - do I have to get the DBA to change global_names to TRUE ??

    ORA-02069 global_names parameter must be set to TRUE for this operation
    Cause: A remote mapping of the statement is required but cannot be achieved because GLOBAL_NAMES should be set to TRUE for it to be achieved.
    Action: Issue ALTER SESSION SET GLOBAL_NAMES = TRUE if possible.

  • Problem with using database link from oracle 7 to oracle 9i

    Hi To Every One
    I have two oracle database oracle 7.3.4.0.1 and oracle 9i 9.2.0.1.0.
    and the tns alias to connect to oracle 9i database is oracle9i and tns
    alias to oracle 7 database is oracle7.I have no problem in connect to
    these database using these tns aliases from either database.The tns
    alias for oracle 7 is available in tnsnames.ora file of oracle9i and
    tns alias for oracle 9i is available in tnsnames.ora file of oracle 7.
    So there is no connection problem from each other.Connection is
    working fine for each other but the problem with database links is
    like this
    Problem:
    when i create database link from oracle9i user or public database link
    from oracle9i for oracle7 user like this
    SQL ORACLE9I >CREATE DATABASE LINK ORACLE7 CONNECT TO <ORACLE7USER>
    IDENTIFIED BY <PASSWORD> USING 'ORACLE7';
    OR
    SQL ORACLE9I >CREATE PUBLIC DATABASE LINK ORACLE7 CONNECT TO <ORACLE7USER>
    IDENTIFIED BY <PASSWORD> USING 'ORACLE7';
    The links get created sucessfully but when i write command like
    SQL ORACLE9I> DESC <ORACLE7USER_NAME>.<ORACLE7USER_TABLENAME>@ORACLE7
    I RECEIVE A ORACLE ERROR LIKE
    ORA-12663 SERVICE REQUIRED BY CLIENT IS NOT AVAILABLE ON THE SERVER.
    OR IF MY COMMAND IS LIKE
    SQL ORACLE9I> SELECT <FEILD_NAME> FROM
    <ORACLE7USER_NAME>.<ORACLE7USER_TABLENAME>@ORACLE7;
    I RECEIVE AN ORACLE ERROR LIKE
    ORA-01002 FETCH OUT OF SEQUENCE.
    ORA-02063: preceding line from ORACLE7
    BUT IF I CREATE A LINK FROM ORACLE7 USER FOR ORACLE9I USER
    IT WORKS FINE.
    PLZ HELP ME WHAT IS THE PROBLEM THAT THE LINK FOR ORACLE 7 IS NOT WORKING WHEN
    IT IS BEING CREATED FROM ORACLE9I.
    Thank u.

    Oracle 9.2.0 does not support connectivity to Oracle 7. The newest version that will support this is 9.0.1.

  • Problems in using database link

    Hi all,
    I have problems in using the following created database link:
    Name: fzanalyze
    User: fzanalyze
    PWD: xxx
    Host: fz.domain.com
    I get the following error message, if I try to start this select:
    select * from tab@fzanalyze;
    FEHLER in Zeile 1:
    ORA-12154: TNS:Couldn't resolve service name
    The problem, the TNS is correct, because I copied the hoststring from the tnsnames.ora. Also I can connect to the database by using the given hostname as follows:
    connect fzanalyze/[email protected]
    connected
    What could be the problem, the I get the tns-Error, although I can connect normal to the database??
    Thanks for helping
    Dana

    Dana,
    Unlike Kamal, I don't use SQLNET anymore (isn't it obsolete from 8i+?), so I don't have any sqlnet.ora on my client or server.
    I'm not really a sysop, so no clever thoughts behind the following ideas, I just use these for development purposes at home:
    IP range at home = 192.168.x.x segment (another router server connects to the internet)
    Oracle server computer name = dbserver.seinpost.nl (local address = 192.168.1.110)
    instance entry in $TNS_ADMIN/listener.ora @ server:
        (SID_DESC =
          (GLOBAL_DBNAME = inst04.seinpost.nl)
          (ORACLE_HOME = /u01/app/oracle/product/10.1.0/db_1)
          (SID_NAME = inst04)
        )instance entry in $TNS_ADMIN/tnsnames.ora @ server:
    INST04.SEINPOST.NL =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver.seinpost.nl)(PORT = 1521))
        (CONNECT_DATA =
          (SERVICE_NAME = inst04.seinpost.nl)
      )instance entry in tnsnames.ora @ client:
    INST04 =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS =
            (PROTOCOL = TCP)
              (HOST = 192.168.1.110)
                (PORT = 1521)
        (CONNECT_DATA =
          (SERVICE_NAME = inst04.seinpost.nl)
      )So again, no sqlnet.ora and as you can see only on my client I use local IP addresses to prevent my client for searching the internet for the non-existing dbserver.seinpost.nl address
    Hope this helps,
    Michiel

Maybe you are looking for