Oracle 19c通过cdb的service name连接后为pdb库
现在数据库版本为19.19,库名为oemdb,有1个容器数据库pdb为empdbrepos,如下:
[oracle@oem13c ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 19 09:34:51 2024 Version 19.19.0.0.0 ...... 09:34:51 SYS@oemdb(248)> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 EMPDBREPOS READ WRITE NO
监听情况如下:
[oracle@oem13c ~]$ lsnrctl status ...... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oem13c)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "c0a3075e31cc7844e053578145648608" has 1 instance(s). Instance "oemdb", status READY, has 1 handler(s) for this service... Service "c0a3a42eaa152a1ae053578145645baf" has 1 instance(s). Instance "oemdb", status READY, has 1 handler(s) for this service... Service "empdbrepos" has 1 instance(s). Instance "oemdb", status READY, has 1 handler(s) for this service... Service "oemdb" has 1 instance(s). Instance "oemdb", status READY, has 1 handler(s) for this service... Service "oemdbXDB" has 1 instance(s). Instance "oemdb", status READY, has 1 handler(s) for this service... The command completed successfully
现在通过cdb的service name来连接,但是却是连接到了empdbrepos的pdb上。
[oracle@oem13c ~]$ sqlplus sys/password@oem13c/oemdb as sysdba ...... 09:44:15 SYS@oem13c/oemdb(245)> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 3 EMPDBREPOS READ WRITE NO
经过一番捣鼓后发现,如果在数据库启动的时候设置了环境变量ORACLE_PDB_SID=empdbrepos来启动,则会出现此种情况。防。
现在取消环境变量ORACLE_PDB_SID,重启库后再次连接,(只摘取部分信息)
[oracle@oem13c ~]$ echo $ORACLE_PDB_SID empdbrepos [oracle@oem13c ~]$ unset ORACLE_PDB_SID [oracle@oem13c ~]$ echo $ORACLE_PDB_SID [oracle@oem13c ~]$ sqlplus / as sysdba 09:47:42 SYS@oemdb(252)> shutdown immediate; 09:48:21 SYS@oemdb(252)> startup; 09:49:10 SYS@oemdb(252)> exit [oracle@oem13c ~]$ sqlplus sys/password@oem13c/oemdb as sysdba 09:49:23 SYS@oem13c/oemdb(22)> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 EMPDBREPOS READ WRITE NO
https://www.cnblogs.com/PiscesCanon/p/18419888
标签:cdb,service,09,oem13c,oracle,oemdb,----------,pdb From: https://www.cnblogs.com/PiscesCanon/p/18419888