Public dblink working in one user not working for other user of the same DB.

Posted on 2011-09-20
Last Modified: 2012-05-12
I have a public DB link, which is working in one user and not working in another user,
am getting invalid username/password logon denied.
What could be the reason?
Question by:sakthikumar
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3

Expert Comment

ID: 36566242
Does the DBLINK contain the credentials to validate on the remote database?

If not, the local user must be validate on both databases, but the second user may not have an account on the second database and/or different crentials between them.

Accepted Solution

manzoor_dba earned 333 total points
ID: 36566448
Hi Sathikumar,
Pls check the below points:-
  1. Is the User exists in the remote database.
  2. If the user exists then check whether the user is using the same password in both the current   and the remote database, if the password is different between both the db then its not possible.. you need to connect using a connect to using clause..


LVL 74

Expert Comment

ID: 36566467
does the other user also have a private link of the same name?  If so, the private link will be used instead of the public link
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36566470
Is there a local dblink for the user that isn't working?

The local one should take precedence over the public one if it exists.

select * from user_db_links;

Author Comment

ID: 36566866
There is only one dblink, and that is public,
the user which can access is present in the remote DB and having the same pwd.
the user which cannot access is not present in the remote DB.

Now, what is the solution?

Expert Comment

ID: 36566912
The solution depends on your application and the purpose of the DBLINK.
If you wish both local users to access the same schema on the remote database, you will need to include the credentials in the DBLINK or query to logon credentials.
If you want them to access different schemas, you will need to create a second user on the remote database to match the second user on the local database.

Assisted Solution

manzoor_dba earned 333 total points
ID: 36567992
Hi Sakthikumar,

As you said , if you want to use the current dblink you need to create a user with same password in the remote database and then you can grant the privileges to the user on the remote db.


You have schema A and schea B in local db, where A is able to access db link and B is not able to access then create the schema b in the Remote db and grant privileges of other schema (here A)  to the Schema B then you can query as below

select * from A.tablename@dblink

LVL 15

Expert Comment

by:Devinder Singh Virdi
ID: 36568118
>>There is only one dblink, and that is public,
>>the user which can access is present in the remote DB and having the same pwd.
>>the user which cannot access is not present in the remote DB.

Is this correct:-
1. Database DB1 has public dblink say DB_LINK, pointing to database DB2 for user USER_1.
2. Database DB1 has two users say USER_1, USER_2
3. USER_1 can access DB_LINK and is not getting any error.
4. USER_2 is getting an error?

Also check
select object_name, object_type from all_objects where object_name in ('YOUR_TABLE', 'DB_LINK_NAME');
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 167 total points
ID: 36568176
I believe the issue here is there wasn't a username or password provided when the link was created:

create public database link mylink using 'remotedb';

This will try to connect to the remote database as the username currently logged in.

Since that user doesn't exists in the remote database you get the error.

The solution is either create the user in the remote databsae or identify the username to connect with when you created the link:

create public database link mylink connect to username identified by password using 'remotedb';

Author Closing Comment

ID: 36571349
I really like the response, Thanks, problem resolved.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This post first appeared at Oracleinaction  ( Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Via a live example, show how to take different types of Oracle backups using RMAN.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question