Results 1 to 13 of 13
  1. #1
    Join Date
    Oct 2004
    Posts
    25

    Unanswered: DB link doesn't work

    Hi people,
    I created a DB link like this:

    create public database link linkName connect to user identified by pwd using 'DBName'

    where linkName e DBName are the same.
    Now, if i try to do a query like this:

    select * from user.tableName@DBName

    it gives me the error "TNS: could not resolve service name".
    But the DBName is correct, and it's included in tnsnames.ora... what's wrong?

    Thanks in advance

  2. #2
    Join Date
    Mar 2004
    Location
    Warsaw / Poland
    Posts
    73
    Maybe you should write
    Code:
    select * from user.tableName@linkName
    instead of
    Code:
    select * from user.tableName@DBName

  3. #3
    Join Date
    Feb 2004
    Posts
    37
    Please check with your dba if the tnsnames.ora and listener.ora files have the remote database name (you are trying to connect) on the host that has the database on which you created the dblink

  4. #4
    Join Date
    Oct 2004
    Posts
    25
    Quote Originally Posted by HrabiaGrzegorz
    Maybe you should write
    Code:
    select * from user.tableName@linkName
    instead of
    Code:
    select * from user.tableName@DBName
    But linkName and DBName are the same!
    By the way, I tried to change, but ther error is still here.

  5. #5
    Join Date
    Oct 2004
    Posts
    25
    Quote Originally Posted by gomes009
    Please check with your dba if the tnsnames.ora and listener.ora files have the remote database name (you are trying to connect) on the host that has the database on which you created the dblink
    tnsnames.ora have the correct database name.
    I can connect correctly to that database.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,296
    DBNAME or SERVICEname??

    you want the servicename used in your tns.ora
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  7. #7
    Join Date
    Oct 2004
    Posts
    25
    Quote Originally Posted by The_Duck
    DBNAME or SERVICEname??

    you want the servicename used in your tns.ora
    In tnsnames.ora the servicename is the same of the dbname.
    Are they case sensitive?
    It can be a problem of permission? (different Oracle users)

  8. #8
    Join Date
    Dec 2004
    Location
    vienna, at
    Posts
    27
    hi

    have you an entry in the sqlnet.ora:

    names.default_domain = ????

    if you have one you have to make you have to change your
    tns entry into:

    dbname.????
    phh

  9. #9
    Join Date
    Oct 2004
    Posts
    25
    Quote Originally Posted by phh
    hi

    have you an entry in the sqlnet.ora:

    names.default_domain = ????

    if you have one you have to make you have to change your
    tns entry into:

    dbname.????
    Hi,
    YES, I have names.default_domain.

    How should I change this syntax? -->
    create public database link linkName connect to user identified by pwd using 'DBName'

    select * from user.tableName@DBName


    Thank you

  10. #10
    Join Date
    Dec 2004
    Location
    vienna, at
    Posts
    27
    you have to make an entry in tnsnames.ora

    dbname.default_domain
    ....

    and create the db_link

    create public database link linkName connect to user identified by pwd using 'tnsBName.default_domain'

    select * from user.tableName@linkName
    phh

  11. #11
    Join Date
    Dec 2004
    Location
    vienna, at
    Posts
    27
    sorry!

    should be

    Code:
    using 'tns:dbname.domain'
    phh

  12. #12
    Join Date
    Oct 2004
    Posts
    25
    Same error...
    Thanks anyway.

    P.S. please notice that DB link to others DB work perfectly... so I suppose it's a problem of THAT database...

  13. #13
    Join Date
    Oct 2004
    Posts
    25
    But I have to create a synonym of the table on the other database?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •