使用DB链接的同义词执行过程

发布于 2025-01-22 09:08:37 字数 1569 浏览 1 评论 0原文

我在DB链接上执行过程有问题

,我有三个数据库:

db1,db2和db3

  • db1是源数据库,其中该过程
  • db2是“网关”数据库
  • db3是数据库,来自DB1的数据库是从DB1执行的。 的db链接

db2 db1:

create user DB1EXECUTOR identified by "password";
grant connect, create session to DB1EXECUTOR;
grant execute on DB1SOURCE.PROCEDURE1 to DB1EXECUTOR;

db2:

create user DB3_TO_DB1_CONNECTOR identified by "password";
grant connect, create session, create synonym, create database link to DB3_TO_DB1_CONNECTOR;

=====using DB3_TO_DB1_CONNECTOR user:=====
create database link DB2_TO_DB1_DBLINK connect to DB1EXECUTOR identified by "password" using 'DB1';
create synonym PROCEDURE1 for PROCEDURE1@DB2_TO_DB1_DBLINK;

db3

create user DB3APP identified by "password";
grant connect, create session, create synonym, create database link to DB3APP;

=====using DB3APP user:=====
create database link DB3_TO_DB2_DBLINK connect to DB3_TO_DB1_CONNECTOR identified by "password" using 'DB2';
create synonym PROCEDURE1 for PROCEDURE1@DB3_TO_DB2_DBLINK;

:最后,当我尝试通过db2从db链接执行db1的过程1时,一切都很好:

=====using DB2 database and DB3_TO_DB1_CONNECTOR user:=====
execute PROCEDURE1

ok

但是,当我尝试通过db3从db3上执行相同的过程时,这不是工作...

=====using DB3 database and DB3APP user:=====
execute PROCEDURE1

...
PLS-00352: Unable access to another database "DB2_TO_DB1_DBLINK"
...
PLS-00201: identifier "PROCEDURE1" must be declared
...

这里怎么了? 我不忽略为什么我可以从db2执行Procemure1,而不是从DB3 ...

I have a problem with executing procedure over the DB link

I have three databases:

DB1, DB2, and DB3

  • DB1 is the source database where is the procedure
  • DB2 is the "gateway" database
  • DB3 is the database from which procedure from DB1 is executing over the db link from DB2

DB1:

create user DB1EXECUTOR identified by "password";
grant connect, create session to DB1EXECUTOR;
grant execute on DB1SOURCE.PROCEDURE1 to DB1EXECUTOR;

DB2:

create user DB3_TO_DB1_CONNECTOR identified by "password";
grant connect, create session, create synonym, create database link to DB3_TO_DB1_CONNECTOR;

=====using DB3_TO_DB1_CONNECTOR user:=====
create database link DB2_TO_DB1_DBLINK connect to DB1EXECUTOR identified by "password" using 'DB1';
create synonym PROCEDURE1 for PROCEDURE1@DB2_TO_DB1_DBLINK;

DB3:

create user DB3APP identified by "password";
grant connect, create session, create synonym, create database link to DB3APP;

=====using DB3APP user:=====
create database link DB3_TO_DB2_DBLINK connect to DB3_TO_DB1_CONNECTOR identified by "password" using 'DB2';
create synonym PROCEDURE1 for PROCEDURE1@DB3_TO_DB2_DBLINK;

Finally, when I try to execute PROCEDURE1 from DB1 over db link from DB2, then everything is good:

=====using DB2 database and DB3_TO_DB1_CONNECTOR user:=====
execute PROCEDURE1

ok

but when I try to execute this same procedure over db link from DB3, then this not working...

=====using DB3 database and DB3APP user:=====
execute PROCEDURE1

...
PLS-00352: Unable access to another database "DB2_TO_DB1_DBLINK"
...
PLS-00201: identifier "PROCEDURE1" must be declared
...

What's wrong here?
I don't understant why I can execute PROCEDURE1 from DB2 but not from DB3...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文