12c Multitenant: How to Connect to PDBs with Same Name in Different CDBs (Doc ID 2123106.1)

19c还可以: set ORACLE_PDB_SID=pdb1

12c Multitenant: How to Connect to PDBs with Same Name in Different CDBs (Doc ID 2123106.1)

You have  duplicated 2 auxiliary database instances from a single target CDB container database.
Both instances reside on the same server and are registered against the same listener.

How can I connect to a specific PDB with the same name but configured in different CDBs?

 

You'll find that a single PDB service is registered under 2 instances.  This is how LSNRCTL services
might look:

Services Summary...

The command completed successfully
 Service "PDB_1" has 2 instance(s).  <==Pluggable database created in each container database

Instance "cdb_1", status READY, has 1 handler(s) for this service...     <==Container database1
Handler(s):      "DEDICATED" established:63112 refused:0 state:ready         

Instance "cdb_2", status READY, has 1 handler(s) for this service...     <==Container database2
Handler(s):      "DEDICATED" established:349293 refused:0 state:ready       


 

SOLUTION



If you want to connect to a PDB service in a specific CDB instance, you can specify the INSTANCE_NAME in the
TNS connect string.  Set INSTANCE_NAME to  point to the specific container database name.  

Note that in our example, the SERVICE_NAME matches the PDB name.  The INSTANCE_NAME in each TNS connect
string is set to each CDB instance name.

PDB_1=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = yourhosthere)(PORT = 1521))
        (CONNECT_DATA =
           (SERVER = DEDICATED)
           (SERVICE_NAME = PDB_1) (INSTANCE_NAME = cdb_1)
        )
    )

PDB_2=
   (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = yourhosthere)(PORT = 1521))
         (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = PDB_1) (INSTANCE_NAME = cdb_2)
       )
    )

https://www.orafaq.com/node/2823

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值