UBUNTU:Oracle SQL Developer无法连接到本地数据库,OCI库无法加载



对于我的项目,我dockerise Oracle

我已经在Windows和OSX (Intel)上做过了,没有任何问题。

星期一,我(终于)得到了一台Linux笔记本电脑(Ubuntu)。

我正面临一个问题,当试图连接SQL开发人员到Oracle实例(localhost:1596/ORCLCDB)

我可以连接到数据库与SQL+但我必须加上以下说明sqlnet中的DISABLE_OOB=ON。即时客户端Ora (21_6).

我在日志中有以下FATAL NI connect错误

2022-07-13T05:28:23.016681071Z Fatal NI connect error 12170, connecting to:
2022-07-13T05:28:23.016688189Z  (ADDRESS=(PROTOCOL=tcp)(HOST=172.19.0.1)(PORT=39328))
2022-07-13T05:28:23.016693632Z 
2022-07-13T05:28:23.016698433Z   VERSION INFORMATION:
2022-07-13T05:28:23.016703279Z  TNS for Linux: Version 21.0.0.0.0 - Production
2022-07-13T05:28:23.016708617Z  Oracle Bequeath NT Protocol Adapter for Linux: Version 21.0.0.0.0 - Production
2022-07-13T05:28:23.016714084Z  TCP/IP NT Protocol Adapter for Linux: Version 21.0.0.0.0 - Production
2022-07-13T05:28:23.016719419Z   Version 21.3.0.0.0
2022-07-13T05:28:23.016724426Z   Time: 13-JUL-2022 05:28:22
2022-07-13T05:28:23.016729415Z   Tracing not turned on. Process Id = 1694
2022-07-13T05:28:23.016734226Z   Tns error struct:
2022-07-13T05:28:23.016739288Z     ns main err code: 12535
2022-07-13T05:28:23.016743996Z     
2022-07-13T05:28:23.016749310Z TNS-12535: TNS:operation timed out
2022-07-13T05:28:23.016755291Z     ns secondary err code: 12606
2022-07-13T05:28:23.016761390Z     nt main err code: 0
2022-07-13T05:28:23.016766428Z     nt secondary err code: 0
2022-07-13T05:28:23.016771329Z     nt OS err code: 0
2022-07-13T05:28:23.016776144Z 2022-07-13T05:28:22.914379+00:00
2022-07-13T05:28:23.016780964Z opiodr aborting process unknown ospid (1694) as a result of ORA-609
2022-07-13T05:28:23.016785848Z 2022-07-13T05:28:22.914772+00:00
2022-07-13T05:28:23.016790717Z Errors in file /opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/ORCLCDB_ora_1694.trc:
2022-07-13T05:28:23.016796032Z ORA-00609: could not attach to incoming connection
2022-07-13T05:28:23.016801170Z ORA-12170: TNS:Connect timeout occurred

所以我试图指示SQLDeveloper使用instant_client,但它不起作用

Testing the Instant Client located at /opt/oracle/instantclient_21_6
Testing client directory ... OK
Testing loading Oracle JDBC driver ... OK
Testing checking Oracle JDBC driver version ... OK
Driver version: 21.6.0.0.0
Testing testing native OCI library load ... Failed:
Error loading the native OCI library
The native OCI driver could not be loaded. The system propertyjava.library.path contains the entries from the environment variable LD_LIBRARY_PATH. Check it to verify that
the expected native library directory /opt/oracle/instantclient_21_6 is present and precedes any other client installations.
java.library.path = /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib

欢迎任何帮助。

在Linux上,我喜欢使用SQLDeveloper的命令行版本,即sqlcl(这是SQLDeveloper,但作为命令行)。如果这符合您的需要,那么执行:

查询sql:

mkdir -p ~/bin
cd ~/bin
wget https://download.oracle.com/otn_software/java/sqldeveloper/sqlcl-latest.zip
unzip sqlcl-latest.zip

启动容器并连接它:

docker run -d --name my_oraclexe_container 
-p 1521:1521
-p 5500:5500
-e ORACLE_PWD=mypwd
container-registry.oracle.com/database/express:21.3.0-xe
export JAVA_TOOL_OPTIONS="-Doracle.net.disableOob=true"
# Interactive session
~/bin/sqlcl/bin/sql SYS/mypwd@localhost:1521 as sysdba

在这里,运行脚本命令:

~/bin/sqlcl/bin/sql SYS/mypwd@localhost:1521 as sysdba <<- _EOF_
-- SQL Oracle
SET ENCODING ISO-8859-15;
SELECT 'Connection is successful' from dual;
QUIT
_EOF_

相关内容

  • 没有找到相关文章