Oracle 12c 开始支持 PLUGGABLE DATABASE,并且提供了一个方法在CDB和PDB之间切换。
1. 使用 show pdbs 可以确认当前有哪些PDB?
[sql] view plaincopy- SQL> show pdbs
- CON_ID CON_NAME OPEN MODE RESTRICTED
- ---------- ------------------------------ ---------- ----------
- 2 PDB$SEED READ ONLY NO
- 3 TESTP1 MOUNTED
- SQL>
上图中 PDB$SEED 并不是一个 PDB 而是一个 PDB的模板,状态始终是 READ ONLY。TESTP1 是一个PDB。
2. 切换到 TESTP1。
[sql] view plaincopy
- SQL> alter session set container=TESTP1;
- Session altered.
- SQL> show pdbs;
- CON_ID CON_NAME OPEN MODE RESTRICTED
- ---------- ------------------------------ ---------- ----------
- 3 TESTP1 MOUNTED
- SQL>
3. 切回到 CDB。
[sql] view plaincopy
- SQL> alter session set container=CDB$ROOT;
- Session altered.
- SQL> show pdbs
- CON_ID CON_NAME OPEN MODE RESTRICTED
- ---------- ------------------------------ ---------- ----------
- 2 PDB$SEED READ ONLY NO
- 3 TESTP1 MOUNTED
- SQL>
标签:12,show,----------,SQL,oracle,TESTP1,PDB,CON From: https://www.cnblogs.com/redarmy/p/17663900.html