直接连接到可插拔数据库

时间:2015-12-03 15:46:06

标签: oracle

如何直接连接到可插拔数据库? 我试过这个。

sqlplus scott/tiger@pdborcl;

但我得到 ORA-12154:TNS:无法解析指定的连接标识符

之后我尝试添加localhost。

sqlplus scott/tiger@localhost/pdborcl;

然后我得到了

ORA-12514:TNS:侦听器当前不知道连接描述符中请求的服务

但当我以系统连接时,我可以轻松连接使用。

sqlplus scott/tiger@pdborcl;

请帮帮我,我真的想一次又一次地摆脱系统登录。

#TNSNAMES.ora文件

# tnsnames.ora Network Configuration File: C:\app\OracleHome\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

PDBORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdborcl)
    )
  )

SQLNET

# sqlnet.ora Network Configuration File: C:\app\OracleHome\product\12.1.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file wont exist and without the native 
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

tnsping pdborcl

enter image description here

0 个答案:

没有答案