1、pdb刪除說明
oracle
一、控制文件自動清理刪除的pdb信息ide
二、關於該pdb的歸檔和備份不會自動刪除須要在rman中刪除spa
2、參數說明it
一、keep datafiles 默認值。class
即便指定該選項,該 pdb 的臨時文件也會被刪除容器
指定該選項表示該 pdb 被 unpluggedfile
二、including datafilesselect
從磁盤上移除該pdb的的相關文件權限
若是 pdb 建立時用的 snapshot copy 子句,則必須指定 including datafiles 丟棄該 pdbim
3、執行該命令的前提條件
一、pdb 必須 close immediate,即必須關閉
二、執行該命令的當前用戶必須具備 SYSDBA、或者 SYSOPER 權限
三、確保當前容器是 root 容器
四、確保 pdb 已經被 close immediate
4、刪除過程
一、切換到root容器
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
6 MYPDB3 READ WRITE NO
SQL> conn / as sysdba
Connected.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB1 READ WRITE NO
4 MYPDB2 READ WRITE NO
5 YOUPDB MOUNTED
6 MYPDB3 READ WRITE NO
SQL> show con_name;
CON_NAME
------------------------------
CDB$ROOT
二、關閉要刪除的pdb(mypdb3)
SQL> alter pluggable database mypdb3 close immediate;
Pluggable database altered.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB1 READ WRITE NO
4 MYPDB2 READ WRITE NO
5 YOUPDB MOUNTED
6 MYPDB3 MOUNTED
三、刪除mypdb3
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB1 READ WRITE NO
4 MYPDB2 READ WRITE NO
5 YOUPDB MOUNTED
6 MYPDB3 MOUNTED
SQL> drop pluggable database mypdb3 including datafiles;
Pluggable database dropped.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB1 READ WRITE NO
4 MYPDB2 READ WRITE NO
5 YOUPDB MOUNTED
SQL> select name from v$datafile;
/opt/oracle/oradata/mycdb/system01.dbf
/opt/oracle/oradata/mycdb/sysaux01.dbf
/opt/oracle/oradata/mycdb/undotbs01.dbf
/opt/oracle/oradata/mycdb/pdbseed/system01.dbf
/opt/oracle/oradata/mycdb/pdbseed/sysaux01.dbf
/opt/oracle/oradata/mycdb/users01.dbf
/opt/oracle/oradata/mycdb/pdbseed/undotbs01.dbf
/opt/oracle/oradata/mycdb/mypdb1/system01.dbf
/opt/oracle/oradata/mycdb/mypdb1/sysaux01.dbf
/opt/oracle/oradata/mycdb/mypdb1/undotbs01.dbf
/opt/oracle/oradata/mycdb/mypdb1/users01.dbf
......
SQL> host ls -l /opt/oracle/oradata/mycdb/mypdb3
total 0