• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 799
  • Last Modified:

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?
0
sakthikumar
Asked:
sakthikumar
  • 2
  • 2
  • 2
  • +3
3 Solutions
 
JacobfwCommented:
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.
0
 
manzoor_dbaCommented:
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..
Thanks..
 

 

0
 
sdstuberCommented:
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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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;
0
 
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?
0
 
JacobfwCommented:
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.
0
 
manzoor_dbaCommented:
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.

Eg.

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

0
 
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');
0
 
slightwv (䄆 Netminder) 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';
0
 
sakthikumarAuthor Commented:
I really like the response, Thanks, problem resolved.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now