Oracle 数据库 12c 连接
Oracle Database 12c Connection
我已经设置了 Oracle 数据库,但我遇到了以下连接问题:
sqlplus CISADM/CISADM@<IP>:1521/PSRM
sqlplus CISADM@PSRM
通过以上两个选项,我成功连接到了数据库。虽然,当我尝试连接时:
sqlplus CISADM@<IP>:1521/PSRM
我收到以下错误:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
我可以使用 IP 或主机名执行 ping,成功地使用 IP 和主机名进行 tnsping。
我的 tnsnames.ora 文件:
PSRM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PSRM)
)
)
我的 sqlnet.ora 文件:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
我正在从客户端 PC 连接到位于 VM 中的数据库。以上文件来自客户端
来自托管数据库的 VM 的文件:
tnsnames.ora:
PSRM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PSRM)
)
)
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
有什么想法吗?
你应该运行像这样:
sqlplus CISADM@\"<IP>:1521/PSRM\"
重要提示:服务器开头和结尾的\"
:port/service是语法的一部分。
我已经设置了 Oracle 数据库,但我遇到了以下连接问题:
sqlplus CISADM/CISADM@<IP>:1521/PSRM
sqlplus CISADM@PSRM
通过以上两个选项,我成功连接到了数据库。虽然,当我尝试连接时:
sqlplus CISADM@<IP>:1521/PSRM
我收到以下错误:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
我可以使用 IP 或主机名执行 ping,成功地使用 IP 和主机名进行 tnsping。
我的 tnsnames.ora 文件:
PSRM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PSRM)
)
)
我的 sqlnet.ora 文件:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
我正在从客户端 PC 连接到位于 VM 中的数据库。以上文件来自客户端
来自托管数据库的 VM 的文件:
tnsnames.ora:
PSRM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PSRM)
)
)
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
有什么想法吗?
你应该运行像这样:
sqlplus CISADM@\"<IP>:1521/PSRM\"
重要提示:服务器开头和结尾的\"
:port/service是语法的一部分。