Reputation:
I'm working a migration project requiring an import of several Oracle
database schema onto an existing database. This requirement has brought about an interesting conflict where I now have two dblinks
with the same name:
dblink
which uses account A
to access the Foobar
databasedblink
to the same Foobar
database which uses account B
for its accessGlobal Names
is set to true so I cannot change the names of these dblinks
.
I've already figured out through trial and error that when signed into schema that owns the private dblink
that the following:
SELECT *
FROM table@foobar;
will refer to the private dblink
and not the public one. But for situations where I require the account B
privileges, I cannot figure out how to explicitly refer to the public dblink
.
Does anyone know of syntax I can use to refer to the public @foobar
?
Upvotes: 4
Views: 2552
Reputation: 727
From Oracle documentation.
Oracle first searches for a private database link in your own schema with the same name as the database link in the statement. Then, if necessary, it searches for a public database link with the same name.
I don't think this can be changed in any way. Not that I know of or found in documentation. You could create public synonym but that will work only if you need to access with B
specific objects. Synonym can't be created for whole database link.
Wouldn't it be easier to turn global names
to False
on session level and create new link to B
with otherwise invalid link name. If you change global names
on session level only that session will be allowed to use new link.
Upvotes: 1