探究 Oracle PDB Application Container (四)

2022-08-19 21:13:38 浏览数 (1)

编者按:

本文作者系大连健哥,POSTGRESQL、ORACLE 数据库资深从业人员、IT 技术的深度爱好者。相信科学改变人类、技术创造未来。个人主页:https://www.cnblogs.com/gaojian/,经其本人授权发布。

【免责声明】本号文章仅代表个人观点,与任何公司无关。

探究 Oracle PDB Application Container (三)

说一说,如何解决附加的 PDB。

目前这个方法,还没有找到合理的解释:

执行

代码语言:javascript复制
ALTER PLUGGABLE DATABASE APPLICATION ref_app SET COMPATIBILITY VERSION '1.1' ;

就可以删除掉这个奇怪的 PDB,也是很神奇了。

(这是我重新执行了前文探究 Oracle PDB Application Container (三)的动作,获得了 新的PDB后的测试结果)

代码语言:javascript复制
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 PDB193                         MOUNTED
         4 APPCON1                        READ WRITE NO
         6 APPPDB1                        READ WRITE NO
         8 F4127053456_3_1                READ WRITE NO
SQL>
 
SQL> alter session set container=appcon1;
 
Session altered.
 
SQL> ALTER PLUGGABLE DATABASE APPLICATION ref_app SET COMPATIBILITY VERSION '1.1';
 
Pluggable database altered.
 
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 PDB193                         MOUNTED
         4 APPCON1                        READ WRITE NO
         6 APPPDB1                        READ WRITE NO
 
<<<<<<<<<<< 上面的 F4127053456_3_1 PDB,消失不见了!
 
SQL>
SQL> alter session set container=appcon1;
 
Session altered.
 
SQL>
SQL> COLUMN app_name FORMAT A20
COLUMN app_version FORMAT A10
 
SELECT app_name,
       app_version,
       app_status
FROM   dba_applications
WHERE  app_name = 'REF_APP';
 
APP_NAME             APP_VERSIO APP_STATUS
-------------------- ---------- ------------
REF_APP              1.1        NORMAL
 
SQL>

这个PDB 的数据文件也消失不见了。

代码语言:javascript复制
SQL> select con_id, name from v$datafile order by con_id;
 
    CON_ID
----------
NAME
--------------------------------------------------------------------------------
         4
/refresh/home/cpdest/DB193CDB/BF761DFF522F4797E0538828410AB8E8/datafile/o1_mf_re
f_app__j6xxvvs0_.dbf
 
         4
/refresh/home/cpdest/DB193CDB/BF761DFF522F4797E0538828410AB8E8/datafile/o1_mf_un
dotbs1_j6xxvcws_.dbf
 
         4
 
    CON_ID
----------
NAME
--------------------------------------------------------------------------------
/refresh/home/cpdest/DB193CDB/BF761DFF522F4797E0538828410AB8E8/datafile/o1_mf_sy
saux_j6xxvcwq_.dbf
 
         4
/refresh/home/cpdest/DB193CDB/BF761DFF522F4797E0538828410AB8E8/datafile/o1_mf_sy
stem_j6xxvcwm_.dbf
 
         6
/refresh/home/cpdest/DB193CDB/BF761DFF52324797E0538828410AB8E8/datafile/o1_mf_un
 
    CON_ID
----------
NAME
--------------------------------------------------------------------------------
dotbs1_j6xxvnwt_.dbf
 
         6
/refresh/home/cpdest/DB193CDB/BF761DFF52324797E0538828410AB8E8/datafile/o1_mf_sy
saux_j6xxvnws_.dbf
 
         6
/refresh/home/cpdest/DB193CDB/BF761DFF52324797E0538828410AB8E8/datafile/o1_mf_re
f_app__j6xxyygl_.dbf
 
    CON_ID
----------
NAME
--------------------------------------------------------------------------------
 
         6
/refresh/home/cpdest/DB193CDB/BF761DFF52324797E0538828410AB8E8/datafile/o1_mf_sy
stem_j6xxvnwr_.dbf
 
8 rows selected.

SQL>

0 人点赞