DB6.ENTERPRISE.COM connects to PROD2.ENTERPRISE.COM
Suggests that the db_name (or db_unique_name) hasn't been set to DB6, looks like it's still at PROD2.
Main Topics
Browse All TopicsI use DATABASE LINKS on my reporting database, against each of several other Oracle 8i databases. All of the database links are working fine... except one.
Many of the databases, including the reporting database, and the offending database, are on the same server.
I rebuild each database link, logging on to my database REPORTING.enterprise.com, an running the following set of queries:
ALTER SESSION SET global_names = FALSE ;
ALTER DATABASE RENAME global_name TO anything.ENTERPRISE.COM ;
DROP PUBLIC DATABASE LINK DB6.ENTERPRISE.COM ;
ALTER DATABASE RENAME global_name TO REPORTING.ENTERPRISE.COM ;
CREATE public DATABASE LINK DB6.ENTERPRISE.COM CONNECT TO myuser IDENTIFIED BY mypwd USING 'DB6.ENTERPRISE.COM' ;
ALTER SESSION SET global_names = TRUE;
When I go to run a query against the database links, this is what I get:
select * from currency@DB5.enterprise.co
3 row(s) retrieved
select * from currency@DB6.enterprise.co
[1]: (Error): ORA-02085: database link DB6.ENTERPRISE.COM connects to PROD2.ENTERPRISE.COM
Now... it's true that the database DB6 was created from an export of PROD2... but so was DB5. Why would one of them fail, while the others succeed? And the DatabaseLink to the original production database PROD2 works just fine. What would make the link to one of the databases (created from an export of that production machine) fail, while the links to other databases (created from exports of that same production machine) work just fine?
Any ideas?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
- DB6 tnspings just fine
- I can log into DB6 directly and execute queries just fine
- When I log into my REPORTING database and drop the DatabaseLink and try to connect, it throws an error that says it doesn't exist (of course), and I can recreate the DatabaseLink with globalnames = true, just fine... but then, when I query against the DatabaseLink, it goes back to giving me the error that says it's pointing to the other database.
When set global_names = false on my REPORTING database, I can query using the DatabaseLink to DB6 just fine! But the moment I turn global_names back to true, I start getting the error that it's pointing to the wrong database again.
Business Accounts
Answer for Membership
by: kazman300Posted on 2008-09-22 at 08:48:39ID: 22541086
What is the db_name and db_unique_name of the DB6 database?
sqlplus / as sysdba
show parameter db_