Database Link Name

Hello All
I got a problem with making a database link.
When I execute this query
CREATE PUBLIC DATABASE LINK DBNAME
CONNECT TO database IDENTIFIED BY name
USING 'DBNAME.europe.company.com';
I am using other names because its private information
But when I look at the table dba_db_links I see this
OWNER | DB_LINK | USERNAME | HOST
PUBLIC | DBNAME.europe.company.com | name | DBNAME.europe.company.com
So the DB_Link name is changed. And this causes a problem with my asp website. I get the fault message
ORA-02085: database link DBNAME.europe.company.com connects to DBNAME
Cause: a database link connected to a database with a different name. The connection is rejected.
So does anyone knows what is wrong about my Query or how I can change the DB_Link name.
Thanks for the support,
Remco

It could be that DBNAME.europe.company.com
must be the exact name of the database on the target site. I think it depends on the listener configuration. You might also have to check for GLOBAL_NAMES parameter on the target database.
A better forum to ask this question would be the General-Database forum, where all the DBAs are hiding. ;)

Similar Messages

  • Passing plsql parm to a sql statement in the procedure  database link name

    Would like to pass a parm that is the database link name to a stored procedure.  I defined this as below. var1 is the name of the db link that I would like to pass
    create or replace procedure   proc1  (var1 in varchar2) as
    cursor c1 is
    select num,name,city from emp@var1;
    However, this is getting a plsql error in the above code   as bad bind variable, db link name expected.
    Is there a method to pass a variable within a stored proc into a SQL statement that has a cursor ..
    thanks

    Hi,
    Database links have to be hard-coded.  If you really need to specify the database link at run-time, then you need Dyanmic SQL.
    Why do you need to do this?   How many databases are involved?  Do you have new database links all the time?  The more you can say about your business requirements, the more helpful we can be.
    Are there only a couple of possible database links?  If so,  you might consider hard-coding each of them, and branching to the appropriate one in your code.
    is the real variable here the environment (Development, Test, Production) that you're in?  For example, do you need to use one database link in Development, a different one in Test, and a third in Production, but you don't want to change the code when you move from one environment to another?  If so, you can try conditional comilation.

  • ORA-04054 : using variable substitution for the database link name

    Hi,
    I need to use variable substitution for the database link name.
    Here is my command :
    declare
    GET VARCHAR2(50);
    begin
    select OIA_GET_DESIGNATION into GET from INFODRI.OMA_IN_ARTICLES;
    for rec in (select * from [email protected]_GET_DESIGNATION)
    LOOP
    dbms_output.put_line('TEN_CODE vaut : '||rec.ten_code);
    END LOOP;
    exception
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERREUR ORACLE DETECTEE : '||rec.OIR_CUR);
    DBMS_OUTPUT.PUT_LINE('Message Erreur : '||SUBSTR(SQLERRM,1,245));
    :crd := -1;
    end;
    When I run this programm, I receive the error :
    ORA-04054: database link REC.OIA_GET_DESIGNATION does not exist
    When I replace :
    for rec in (select * from [email protected]_GET_DESIGNATION)
    by :
    for rec in (execute immediate 'select * from tensions@'||rec.OIA_GET_DESIGNATION)
    I receive the error :
    PLS-00103 : Encountered the symbol "IMMEDIATE" while parsing.
    What can I do to resolv my problem ?
    Regards,
    Rachel

    What is the name of the DB Link and the name of the object you are selecting
    from?
    I find it easier to create a view on the remote object then use that in selects.
    e.g,
    Link Name = MyLink
    Object_name = Addr_Loc
    create or replace VIEW Rem_Addr_Loc AS
    select * from addr_loc@mylink;
    In the code I then use the view
    begin
      for C_Rec in (select * from Rem_Addr_loc)
      loop
         dbms_output.put_line('Rec: '|| C_Rec.Col1);
      end loop;
    end;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Database link name does not work with JDBC.

    Hi,
    I am new to Oracle database. I run a query from a Java class and after waiting around 20 minutes then it returns "ORA-04021 timeout occurred while waiting to lock DBMS_LOCK" error. The query is:
    select r2.EXTERNAL_ID, d.EXTERNAL_ID AS ISIMPORTED from (select external_id from results r1
    where r1.*run_id = ?* and not exists
    (select id from results@cdata where external_id = r1.external_id and run_id = r1.run_id)
    order by r1.external_id) r2 left join dummymaindata d on r2.external_id =d.external_id;
    In this query I use a database link to access another database. The strange thing is at least for me, if I use "@cdata" it always gets stuck for at least 20 minutes and end with an exception "ORA-04021 timeout occurred while waiting to lock DBMS_LOCK" but if I use any combination of the database link name instead of the "@cdata" for example "@CDATA", "@Cdata", "@cDaTA", "@CdaTa" etc., it works fine without any exception.
    This starnge behavior is only with this query for using the database link name while with any other query it does not matter that how I do write the db link name.
    Kindly answer.
    Arshad..

    Hi,
    1) What is your Oracle, JDBC driver, target Oracle (to which you are connecting through DB link) versions?
    2) Are you using DBMS_LOCK somewhere in the code? PL/SQL procedures on the source/target servers?
    3) Can you construct a complete reproducible test case?

  • Error creating Streams example - ORA-01729: database link name expected

    Running 11gR1. Example from doc, "4 Single-Database Capture and Apply Example"
    the database name is "11G3". when I run the Step 3 statement below, I get the error below. What am I doing wrong? Thanks!
    DECLARE
    iscn NUMBER; -- Variable to hold instantiation SCN value
    BEGIN
    iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER();
    DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(
    source_object_name => 'hr.employees',
    source_database_name => '11G3',
    instantiation_scn => iscn);
    END;
    Error at line 1
    ORA-01729: database link name expected
    ORA-06512: at "SYS.DBMS_LOGREP_UTIL", line 742
    ORA-06512: at "SYS.DBMS_APPLY_ADM", line 726
    ORA-06512: at line 5

    The manual stated to be GLOBAL_NAMES compliant which means DBLINK=target DB_NAME and SID cannot start with a figure. I strongly suggest to pay a careful look to manuals as Streams has a lot of others tricks under the hat awaiting for you.

  • Persistent Layer Error Message: ORA-01729 database link name expected

    Hi,
    I've done a series of loads from DB2 into Oracle, initially importing the database objects from DB2 and Oracle, then creating the mappings, deploying and executing. It all worked and I had no problems. For some reason now whenever I tried to import a new Database Object (table) from the DB2 I enter the password, test it and it successfully connects but then I get the error message on a popup box:
    SQL Exception
    Persistent Layer Error: SQL Exception
    Class Name: CacheMediator
    Method Name: getSQLResult
    Persistent Layer Error Message: ORA-01729 database link name expected
    If I create a new location for the same database it works and I can import new objects. The only difference I can think from the initial imports is that I’ve moved the repository from one server to another. Might be the case where some information got corrupted in the metadata.
    Has anyone seen this kind of problem before? Can you please help me out with this issue?
    Thanks in advance for your help.
    Regards,
    Leo

    I found it.When I look at the db links there is something missing.When I correct it everything works fine.

  • Database Link name altered automatically

    Hi everybody,
    I'm facing here some strange behavior when I'm trying to create a database link. Here's the statement for creating the database link:
    CREATE DATABASE LINK "DEVELOP" CONNECT TO "XXX" IDENTIFIED BY XXX USING 'develop';
    After starting Oracle's SQL Developer it turns out that the link is successfully created.
    BUT it's not named 'DEVELOP' as expected! Instead the link is named 'DEVELOP.100.10.82.181'
    This leads to problems with a DataPump-Job because of an "invalid argument" (I suppose in this case the wrong link name)
    How can I avoid this behavior? Or is it possible to alter the name? So far I did not found a solution or comprehendible explanation.
    Any help will be highly appreciated.
    Kind regards
    Alex

    Robert Geier wrote:
    Database version ?
    select db_link from dba_db_links;
    Try removing some of the quotes.@Robert: removing the quotes did not solve the problem.
    Operating System: Mac OS X 10.5.8
    SQL> SELECT * from v$version;
    BANNER
    Oracle Database 10g Release 10.2.0.4.0 - Production
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for MacOS X Server: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> select db_link from dba_db_links;
    DB_LINK
    DEVELOP.100.10.82.181
    SQL> SELECT * FROM GLOBAL_NAME;
    GLOBAL_NAME
    CORPUS.100.10.82.181
    SQL> SHOW PARAMETER global;
    NAME TYPE VALUE
    global_context_pool_size string
    global_names boolean FALSE
    Thanks again
    Edited by: user9253174 on 03.03.2010 01:41

  • Databases link name required without  global_name

    Hi,
    My global_name is "ORCL.REGRESS.RDBMS.DEV.US.ORACLE.COM" when i create any database link the name create like "U_NET_LINK.REGRESS.RDBMS.DEV.US.ORACLE.COM"
    How i eliminate global_name without edit my initora file using SQL .
    Regards
    Faheem

    You need to check parameter global_names
    alter system set global_names=true scope=both;
    System altered.http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams077.htm#CHDGEHBB
    Also what's your DB_NAME and DB_DOMAIN set at?
    Your global name looks rather erratic.

  • ODI dataloading Fails With ORA-01729: database link name expected

    Hi All,
              can any one provide me the solution for this error..
    thanks,
    Yogi.

    The correct syntax for denoting a table in a remote database follows:
    username.table_name@ database_name

  • Database link in forms is different that actual database name

    I am using a database link in Oracle Forms 6i, however, the database link name for the referenced database is not the same as the actual databse service/instance name.
    It does not work, and I suppose its something to do with the global names feature which is true in the source database it is in a replication group.
    I would like to know whether the dblink name which I am using in oracle forms, does it have to have the same name as an entry in the tnsnames.ora file, or can be substituted thgrough any so-calld alias from within oracle forms?
    Windows 2k Ad svr, Oracle Forms 6i, DB 9.2.0.1

    I recently upgraded my development environment from Forms 10.1.2.0.2 to Forms 10.1.2.3 and am experiencing the same problem -- not able to COMPILE a form that references a database link. The error is: "Error 352 at line 99, column 3 Unable to access another database 'LINKNAME'". This occurs on an UPDATE statement within PL/SQL code in a form trigger that used to compile and work fine.
    I tried the database link in SQL Plus and the link is working fine.
    Database environment is 10g 10.2.0.3 on Windows Server 2003.
    Is anyone able to do this?

  • Execute procedure over database link

    Hi,
    I''m working on a package where you can select the required database, paste some query and with clicking on a button it will execute and create an explain plan for this query.
    Therefore i've create a procedure on each database that put's the explain plan in the PLAN_TABLE.
    To do this i need to execute this prodecure from the package. I use the following code:
    DBA_OWNER.DB_PCD_EXPLAIN_PLAN@DBA_LINK_533.WORLD(p_query);
    This is working fine as this database link allready exists to the required database. But i want to make the database link name variable. I've allready created the dynamic database link:
    l_link varchar2(20) := 'DBA_LINK';
    l_link_nr number(4) := dbms_random.value(0,1000);
    l_db varchar2(20) := l_link||'_'||l_link_nr;
    l_statement varchar2(4000);
    begin
    l_statement := 'create database link '||l_db||' connect to **** identified by ***** using '''||p_database||'.WORLD''';
    execute immediate l_statement ;
    So now i have the dynamic databaselink that is created each time i call the package.
    now i want to use this databaselink to call the procedure. this is where it goes wrong.
    The code i'm using:
    DBA_OWNER.DB_PCD_EXPLAIN_PLAN@l_db(p_query);
    is not acceoted when i build the package.
    The follwoing error message is showed.
    PACKAGE BODY DBA_OWNER.PCK_EXPLAIN_PLAN
    On line: 66
    PLS-00352: Unable to access another database 'L_DB'
    Does someone know how to use this variable to execute the procedure on the remote db?

    Any procedures you call have to be accessible at compile time, so the database link must also exist at compile time.
    You can get around this by putting your procedure call to DB_PCD_EXPLAIN_PLAN inside dynamic SQL, the same as you are doing to create the database link. Dynamic SQL is not checked until runtime.
    Think about the risk if this procedure is exploited. You are creating a way for someone to run arbitrary code in an any database in your environment, with presumably a highly-privileged ID, if it can run an explain plan against any schema in any target database.
    This is exposing some significant security issues. Read up on SQL injection, and have someone else review the code for security issues before deploying this.

  • PL/SQL :ORA-04052 with Database link

    i have created a database link in my producation database as following
    CREATE PUBLIC DATABASE LINK <NAME>
    CONNECT TO <USER>
    IDENTIFIED BY <P/W>
    USING <CONNECT STRING OF TARGET DATABASE
    oracle version 9.0.2.8
    OS : Windows 2003 EE R2 SP2
    Using oracle failsafe 3.3.4 with windows cluster
    Problem Description :
    whenever i run my pl/sql procecdure to pull the data from the target database i get the following error
    ERROR at line 3
    ORA-06550:line 3 column 2
    PL/SQL : ORA-04052: error occured when looking up remote object _<SCHEMA>.<TABLE>@<DATABASE LINKE NAME>_
    ORA-00604 : ERROR occured at recursive SQL level 1
    ORA-03106 : fatal tow-task communication protocol error
    ORA-02063: preceding line from <DATABASE LINK NAME>
    I have tested the same way in the test environment the same oracle version as well the OS but without oracle failsafe and windows cluster
    the script goes smoothly with out any errors.
    i have google and checked the OTN for all available solutions but still nothing its not getting throw
    i will be very thankful for your replys and solutions
    any farther clarification i am ready
    thanks in advance

    Hi,
    This forum is for issues connecting to non-Oracle databases. As the problem is using PL/SQL to connect to another Oracle database then it would be better to post a thread in the PL/SQL forum -
    PL/SQL
    If you are trying to connect to a non-Oracle database then please give us the details of which non-Oracle database and the software you are trying to use to connect.
    Regards,
    Mike

  • 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

  • Using database links in a plsql page process

    I am trying to use a database link in a pl/sql page process.
    It works fine when I use the link name in the plsql like this:
    BEGIN
    SELECT 
    CARD_ID
    into  
    :P12_HDR_CARD_NUMBER 
    from     [email protected];
    But the link name will be coming from a page item (P12_DBLINK) populated as follows:
    select db_link d, db_link r from user_db_links; 
    I have tried the following and it's not working:
    DECLARE
    l_link VARCHAR2(30);
    BEGIN
    l_link :=  :P12_DBLINK;
    SELECT 
    CARD_ID
    into  
    :P12_HDR_CARD_NUMBER 
    from     fusion.EXM_CC_COMPANY_ACCOUNTS@l_link;
    this gives me:
    ORA-04052: error occurred when looking up remote object FUSION.EXM_CC_COMPANY_ACCOUNTS@L_LINK.WORLD ORA-00604: error occurred at recursive SQL level 3 ORA-02019: connection description for remote database not found
    I thought that maybe the link name was getting appended with .WORLD automatically but the link name already has .WORLD at the end. I tried stripping that off first but the error is the same.
    Is there some synatx for this that will work for this? Will I need to use dynamic sql?
    Any suggestions are most appreciated.
    thanks,
    john

    Hi John,
    check the following example to use the execute immediate statement for your purpose
    sql - Variable for Database Link Name - Stack Overflow
    let me know if this answers your query in the current thread

  • The Database Link is not active

    try to be more clear, i'm in lack of ideas in this problem.
    I am following guide Oracle Database 2 Day + Data Replication and Integration Guide.
    I defined global_names parameter of remote database as true.In the step of "creation database link" i am getting error.(oracle enterprise manager 11g-->schema-->database links-->create)
    When i query on remote database(select * from global_name), I got orcl.
    So,In "Name" and "Net service name" field i specified orcl.Check radio button "Fixed user." and Username and password of remote database, and i got message "Database Link STRMADMIN.ORCL has been created successfully."
    But when i clicked on database link Name i got error, saying that
    "The Database Link is not active.ORA-02084: database name is missing a component "
    (Both dbs are oracle 11g.)
    Please reply.

    I think I am confused, "what should be Name and Net Service Name" while creating database link in context of "Database Replication." when global_names parameter is true in both database. I read somewhere "If the value of the GLOBAL_NAMES initialization parameter is TRUE, then the database link must have the same name as the database to which it connects." so what should database link name " should it be remote database name? db_domain?( or outtput of select * from global_name).......
    my tnsnames.ora on source db is
    ORCL.a.ernet.in =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = a.b.c.d)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORCL.a.ernet.in)
    when i connect user of remote database(a.b.c.d) from sqlpuls then it is connected.
    command which i give : sqlplus remoteUser/[email protected]

Maybe you are looking for