为什么我的 sqlplus 字符串连接仅适用于 /service_name 而不适用于 :service_name
Why my sqlplus string connection only works with /service_name and not with :service_name
我正在尝试使用 sqlplus 连接我的数据库,使用分号传递服务,但不起作用,只能使用斜杠。
[root@38324e46bdc6 bin]# sqlplus ECM/ECM@//172.18.0.5:1521:ORACLEDB.localdomain
SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 21 16:18:50 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
但是,这样:
[root@38324e46bdc6 bin]# sqlplus ECM/ECM@172.18.0.5:1521/ORACLEDB.localdomain
SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 21 16:10:21 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Fri Dec 21 2018 16:09:44 +00:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
这是我的听众:
[oracle@3fa66b9377b9 /]$ lsnrctl status listener
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 21-DEC-2018 17:31:21
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 18-DEC-2018 18:02:23
Uptime 2 days 23 hr. 28 min. 57 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORACLEDB/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/3fa66b9377b9/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=3fa66b9377b9)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.2.0/dbhome_1/admin/ORACLEDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "7d50b1bde0ed0114e053050012ac954b.localdomain" has 1 instance(s).
Instance "ORACLEDB", status READY, has 1 handler(s) for this service...
Service "ORACLEDB.localdomain" has 1 instance(s).
Instance "ORACLEDB", status READY, has 1 handler(s) for this service...
Service "ORACLEDBXDB.localdomain" has 1 instance(s).
Instance "ORACLEDB", status READY, has 1 handler(s) for this service...
Service "orclpdb1.localdomain" has 1 instance(s).
Instance "ORACLEDB", status READY, has 1 handler(s) for this service...
The command completed successfully
问题是我需要使用分号并且能够以这种方式连接:
sqlplus ECM/ECM@//172.18.0.5:1521:ORACLEDB.localdomain
因为项目稍后解析 xml 文件并像 port:host:sid 一样连接,我无法更改元数据以使用 /sid 。
有人可以帮我吗?
嗯,我发现了问题。
基本上,jdbc 连接器使用 USER/PASSWORD@HOST:SID 并且 sqlplus 是 PASSWORD/USER@HOST/SERVICE.
谢谢!
我正在尝试使用 sqlplus 连接我的数据库,使用分号传递服务,但不起作用,只能使用斜杠。
[root@38324e46bdc6 bin]# sqlplus ECM/ECM@//172.18.0.5:1521:ORACLEDB.localdomain
SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 21 16:18:50 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
但是,这样:
[root@38324e46bdc6 bin]# sqlplus ECM/ECM@172.18.0.5:1521/ORACLEDB.localdomain
SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 21 16:10:21 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Fri Dec 21 2018 16:09:44 +00:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
这是我的听众:
[oracle@3fa66b9377b9 /]$ lsnrctl status listener
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 21-DEC-2018 17:31:21
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 18-DEC-2018 18:02:23
Uptime 2 days 23 hr. 28 min. 57 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORACLEDB/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/3fa66b9377b9/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=3fa66b9377b9)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.2.0/dbhome_1/admin/ORACLEDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "7d50b1bde0ed0114e053050012ac954b.localdomain" has 1 instance(s).
Instance "ORACLEDB", status READY, has 1 handler(s) for this service...
Service "ORACLEDB.localdomain" has 1 instance(s).
Instance "ORACLEDB", status READY, has 1 handler(s) for this service...
Service "ORACLEDBXDB.localdomain" has 1 instance(s).
Instance "ORACLEDB", status READY, has 1 handler(s) for this service...
Service "orclpdb1.localdomain" has 1 instance(s).
Instance "ORACLEDB", status READY, has 1 handler(s) for this service...
The command completed successfully
问题是我需要使用分号并且能够以这种方式连接:
sqlplus ECM/ECM@//172.18.0.5:1521:ORACLEDB.localdomain
因为项目稍后解析 xml 文件并像 port:host:sid 一样连接,我无法更改元数据以使用 /sid 。 有人可以帮我吗?
嗯,我发现了问题。 基本上,jdbc 连接器使用 USER/PASSWORD@HOST:SID 并且 sqlplus 是 PASSWORD/USER@HOST/SERVICE.
谢谢!