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

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?
Who is Participating?
manzoor_dbaConnect With a Mentor Commented:
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..


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.
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

slightwv (䄆 Netminder) Commented:
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;
sakthikumarAuthor Commented:
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?
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.
manzoor_dbaConnect With a Mentor Commented:
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

Devinder Singh VirdiLead Oracle DBA TeamCommented:
>>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');
slightwv (䄆 Netminder)Connect With a Mentor Commented:
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';
sakthikumarAuthor Commented:
I really like the response, Thanks, problem resolved.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.