12C 启用客户端通过SID 连接PDB,防止ORA-12545

12C 通过SID 连接PDB 报ora-12545

通过在监听listener.ora 加上配置: USE_SID_AS_SERVICE_listener name=ON

在重新配置TNS:

测试连接:

参考文档:文档 ID 1644355.1

APPLIES TO:Oracle Net Services - Version 12.1.0.1 and later

Information in this document applies to any platform.

SYMPTOMS

Client connection string uses SID to connect to TEST database .For example :

net12c =
  (DESCRIPTION =
    (ADDRESS=(protocol = tcp)(HOST=test.oracle.com)(port = 1521))
    (CONNECT_DATA=(SERVER=DEDICATED)(SID = TEST))
)

The TEST database is changed to a pluggable database and client connection fais with ORA-12505.

C:\Users\test>sqlplus sys/[email protected] as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Apr 16 18:15:25 2014
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
ERROR:
ORA-12505: TNS:listener does not currently know of SID given in connect
descriptor

CHANGES

The TEST database is now a PDB. Connections to a pluggable database use service name .

CAUSE

PDB is not an instance, so using SID in the connection string will not work unless the following listener.ora file
setting is in place:  USE_SID_AS_SERVICE_listener name=ON

When the database is an Oracle Database 12c container database, the client must specify a service name in order to connect to it.

Listener status shows TEST as only a service :

Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.oracle.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
Services Summary...
Service "CDB1" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "CDB1XDB" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service.
Service "TEST" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this service...
The command completed successfully

SOLUTION

Use USE_SID_AS_SERVICE_listener_name=on in listener.ora and restart the listener . This will enable the system identifier (SID) in the connect descriptor to be interpreted as a service name when a user attempts a database connection. Database clients with earlier releases of Oracle Database that have hard-coded connect descriptors can use this parameter to connect to a container or pluggable database.

Example of usage in listener.ora:

LISTENER= 
   (DESCRIPTION=
    (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
  )

USE_SID_AS_SERVICE_LISTENER=ON

The connection will work after this change:

C:\Users\test>sqlplus sys/[email protected] as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Apr 16 18:28:40 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions
SQL>

OR

- Modify client connection string to use the actual PDB service name in the SID field :

TNSNet12c =
  (DESCRIPTION =
    (ADDRESS=(protocol = tcp)(HOST=test.oracle.com)(port = 1521))
    (CONNECT_DATA=(SERVER=DEDICATED)(SID = TEST))
  )

The listener will interpret the value for SID=TEST as SERVICE_NAME=TEST and allow the connection.

<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">

来自为知笔记(Wiz)

原文地址:https://www.cnblogs.com/cqdba/p/2816d957f7fe0e1eaddab830b9274b14.html

时间: 2024-10-03 19:27:37

12C 启用客户端通过SID 连接PDB,防止ORA-12545的相关文章

Oracle 12c 多租户家族(12c 18c 19c)如何在 PDB 中添加 HR 模式

Oracle 12c 多租户家族(12c [12.2.0.1].18c [12.2.0.2].19c [12.2.0.3])如何在 PDB 中添加模式:19c (19.3) 手工添加示例 HR 用户 Oracle 12c 如何在 PDB 中添加 SCOTT 模式(手工方式) Oracle 12c 如何在 PDB 中添加 SCOTT 模式(数据泵方式) 目录 1. 配置TNSNAMES.ora 2. 连接PDB 3. 执行脚本 1. 配置TNSNAMES.ora 略,请参考 12c 手工方式和 1

Oracle 12c JDBC方式连接PDB数据库

1.配置监听 这里假定CDB数据库名为ORCL,PDB在CDB下面名称为PDBORCLlistener.ora添加(#后面为注释,不要添加进去) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ORCL) (SID_NAME = ORCL) #这里是SID名 ) (SID_DESC = (GLOBAL_DBNAME = PDBORCL)#这里是PDB数据库名 (SID_NAME = ORCL) #这里是SID名 ) ) t

oracle 12c jdbc连接pdb报错的问题

有同学发来消息说,oracle数据库使用jdbc连接会后报ora-12505错误. 下意识地回复说查看jdbc连接串中的数据库sid/服务名是否写错了. 对方反馈说没错.然后让他以下面的方式连接是可以正常连接的: sqlplus scott/[email protected]:1521/pdborcl 然后让他把jdbc的格式改成如下所示后连接成功! Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhos

oracle 12c连接pdb

12c中,如何连接pluggable database: 使用默认的service连接pdb,创建pdb之后,在监听中自动添加已pdb为名的service: 用户在cluster中创建service,用户使用srvctl命令创建一个service并且关系到pdb上: 使用命令alter session set container=pdb: 使用Enterprise Manager Express.  1. 使用默认service连接pdb: 当创建pdb之后,使用lsnrctl status命令

Oracle 12C 创建用户连接pdb

测试环境: C:\ora12c\product\12.1.0\dbhome_1\BIN>sqlplus.exe /nolog SQL*Plus: Release 12.1.0.1.0 Production on 星期二 9月 20 03:50:23 2016 Copyright (c) 1982, 2013, Oracle. All rights reserved. SQL> conn /as sysdba 已连接. SQL> show pdbs; CON_ID CON_NAME OPE

12c通过service 连接pdb

<roidb01:cdb1:/home/oracle>$lsnrctl service LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-MAR-2018 06:52:45 Copyright (c) 1991, 2014, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl)(PORT=1521)))

Tcp服务端判断客户端是否断开连接

今天搞tcp链接弄了一天,前面创建socket,绑定,监听等主要分清自己的参数,udp还是tcp的.好不容易调通了,然后就是一个需求,当客户端主动断开连接时,服务端也要断开连接,这样一下次客户端请求链接的时候才能成功链接. 然后就开始找各种方法.其中简单的是看recv()返回为0,表明断开了链接,但是recv函数始终返回SOCKET_ERROR,找不到原因............ 参考的方法: 下面来罗列一下判断远端已经断开的方法: 法一: 当recv()返回值小于等于0时,socket连接断开

Android客户端通过Socket连接服务器

Android客户端通过Socket连接服务器. Android互联网项目中,绝大部分都有连接远程服务器的需求,连接的方式有多种,可以是TCP的方式,当然也可以通过Socket的方式. 相对于TCP的方式,Socket的方式略显的较为原始,对于客户端来说,复杂度反而比TCP的方式还要高一些,毕竟TCP的连接有现成的框架可以使用, 比如Spring等. 而使用socket方式这些工作完全需要客户端来做,也增加了客户端的工作量,不过凡事有利弊,通过socket的方式,流量上 相对于TCP等的方式更加

客户端一个http连接包含两个方向,一个是这个http连接的输入,另一个是这个http连接的输出。

1.客户端一个http连接包含两个方向,一个是这个http连接的输入,另一个是这个http连接的输出. 利用httpclient进行ip地址和端口号连接后,http的输出端作为http请求参数设置.http输出端用于http请求设置. http输入端,用于接收服务端传回来的数据. 其中有个关键的http.openConencetion()方法来启动连接.和httpConn.getInputStream()用于接收服务器端返回的数据. 1.客户端获取json字符串 public class Htt