近日,我们有个环境在数据加载到oracle的时候出现ora-39782异常,版本是11.2。经google,几乎没有什么先例,因为我们是使用oci直接写的,可见现在还使用oci接口并不多,也或者我们的库比较奇葩。
ORA-39780: Direct path context operations are not allowed after the context is aborted or finished
Cause: The specified direct path context was aborted or finished.
Action: Do not pass a direct path context that has ended to any direct path functions.
ORA-39781: Direct path stream loads are not allowed after another context loading the same table has ended
Cause: Attempt to load a stream in one context after another loading the same table has ended.
Action: Close all contexts before trying to create another that loads the same table as a previous context in the same session.
ORA-39782: Direct path prepare is not allowed after another context loading the same table has ended
Cause: Direct path prepare called after a context loading the same table has ended. --初步看,跟direct load有关,可能是sqlldr也可能是append模式,这底层应该都是oci调用,前者确定,后者??。
Action: Close all contexts before trying to create another that loads the same table as a previous context in the same session.
ORA-39783: Invalid direct path transaction active
Cause: Direct path operations were not performed in the transaction started by the first OCIDirPathPrepare call.
Action: Ensure the correct transaction is active prior to calling Direct Path API operations.
ORA-39784: This direct path operation is not allowed while another is in progress
Cause: Another direct path operation was active.
Action: Complete any direct path operations in progress before attempting this operation.
使用sqlldr并发加载表,如下:
[oracle@hs-test-10-20-30-17 sqlldr_test]$ sh sqlldr_append_parallel_direct_test.sh SQL*Loader: Release 11.2.0.4.0 - Production on Mon Aug 6 16:14:18 2018 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. SQL*Loader-951: Error calling once/load initialization ORA-00604: error occurred at recursive SQL level 1 ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
一边append、一边sqlldr,也是上述错误,说明问题不在并发上。
进一步分析了ora-39782上下几个错误,尤其是ora-39783,推测应该是第一个OCIDirPathPrepare调用加载了表之后,又去调用了一次导致这个异常。将问题反馈给了库开发者,等待解决。
参考:
https://docs.oracle.com/cd/E11882_01/server.112/e17766/e38001.htm