使用 DBLINK 时 Oracle 出错

发布于 2024-10-28 13:50:45 字数 1061 浏览 4 评论 0原文

我正在使用jboss5.1.x,EJB3.0,JPA3。

我正在尝试从通过 dblink 连接到另一个数据库的视图中执行“选择”查询。

源数据库是Oracle 9,目标数据库是Oracle 8

我收到此错误:

15:27:06,625 WARN [JDBCExceptionReporter] SQL Error: 24777, SQLState: 99999

15:27:06,625 ERROR [JDBCExceptionReporter] ORA-24777: use of non-migratable database link not allowed

在了解使用 XA 时无法使用 dblink 后,我找到了此错误的解决方案。因此,我设法通过更改 dblink 脚本来创建共享数据库链接来解决问题,如下所示:

 CREATE SHARED DATABASE LINK CONNECT TO IDENTIFIED BY AUTHENTICATED BY IDENTIFIED BY USING 

在此测试环境中一切正常。

现在,我已将应用程序迁移到生产环境,其中源数据库是 Oracle 11,而目标数据库仍然是 Oracle 8

我用的伎俩这次不起作用,我找不到解决办法。这是我收到的新异常:

    Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
    at ....Caused by: java.sql.SQLException: ORA-01012: not logged on
    ORA-02063: preceding line from TO_VANTIVE

谢谢你的帮助,

雷,

I am Using jboss5.1.x, EJB3.0 ,JPA3.

I am trying to do 'select' query from view which is connected via dblink to another database.

source database is Oracle 9, destination dabatase is Oracle 8.

I am getting this error:

15:27:06,625 WARN [JDBCExceptionReporter] SQL Error: 24777, SQLState: 99999

15:27:06,625 ERROR [JDBCExceptionReporter] ORA-24777: use of non-migratable database link not allowed

I found solution to this error after I understood that I cant use dblink while using XA. So I managed to solved by changing the dblink script to create shared database link as follow:

 CREATE SHARED DATABASE LINK CONNECT TO IDENTIFIED BY AUTHENTICATED BY IDENTIFIED BY USING 

everything worked fine in this test environment.

Now I've moved my application to production environment, where the source database is Oracle 11 while the destination is still Oracle 8.

The trick that I used didnt work this time and I couldnt find a solution. This is the new exception I am getting:

    Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
    at ....Caused by: java.sql.SQLException: ORA-01012: not logged on
    ORA-02063: preceding line from TO_VANTIVE

Thanks for your help,

ray,

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

无力看清 2024-11-04 13:50:45
ORA-01012: not logged on

似乎表明您没有正确配置新链接,因为数据库现在是 11g,它可能具有区分大小写的密码,这将是首先要检查的事情。

如果远程模式具有区分大小写的密码,请在创建链接中的密码两边加上引号。因此

CREATE SHARED DATABASE LINK
CONNECT TO bob IDENTIFIED  BY "MyNewPasswd1"
AUTHENTICATED BY jim IDENTIFIED BY "JimsPass23" USING 'DB01';
ORA-01012: not logged on

seems to suggest that you haven't configured the new link correctly and since the database is now 11g which may have case sensitive passwords that would be the first thing to check.

Put quotes around the password in the CREATE LINK if the remote schema(s) have case sensitive passwords. Thus

CREATE SHARED DATABASE LINK
CONNECT TO bob IDENTIFIED  BY "MyNewPasswd1"
AUTHENTICATED BY jim IDENTIFIED BY "JimsPass23" USING 'DB01';
后知后觉 2024-11-04 13:50:45

我们在 Weblogic 上也有同样的问题,解决方案是利用非 XA oracle JDBC 驱动程序。

We have the same problem with Weblogic, and the solution is to utilize the non XA oracle JDBC driver.

笛声青案梦长安 2024-11-04 13:50:45

我在使用 Oracle 11g (ORA-24777) 时遇到了同样的问题。我已经在单个表(在我的架构中)和视图(由数据库链接创建)之间执行了联接。我已经在 XA 模式下在 JBoss 数据源上执行了所有操作。

为了让它正常工作,我必须 更改我的 dblink 视图的模式。在这种情况下,使用精确的 AUTHENTICATED BY 子句非常重要,以避免出现“ORA-01012:未登录”。

I was experiencing the same problem here with a Oracle 11g (ORA-24777). I've performed a join between a single table (in my schema) and a view (created by a database link). I've executed the all over a JBoss datasource in XA mode.

In order to get it to work well, I had to change the mode of my dblink view. In this case, is very important to have a precise AUTHENTICATED BY clause to avoid getting "ORA-01012: not logged" on.

蘸点软妹酱 2024-11-04 13:50:45

请确保您使用的数据库链接是公共和共享的,如果数据库链接不是公共和共享的,则会抛出异常 ORA-24777:不允许使用不可迁移的数据库链接。但是,如果您尝试直接在数据库上运行相同的查询而不使用任何 Java 或 XA 事务,它将正常工作。

Please make sure the DB link you are using is Public and Shared, if the DB link is not Public and Shared it will throw an Exception ORA-24777: use of non-migratable database link not allowed. But if you try to run the same query directly on DB with out using any Java or XA transaction it will work fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文