Lin Hong's TECH Blog! 刀不磨要生锈,人不学习要落后 - Thinking ahead

Oracle 19c ORA-65179 Tips

2021-08-17

Oracle 19c ORA-65179 Tips

Since the default behavior of dropping a PDB is to keep data files on the server if you don’t indicate any further.

You should unplug the PDB first before actually dropping it or drop including datafiles.

SYS@cdb1> !oerr ora 65179
65179, 00000, "cannot keep datafiles for a pluggable database that is not unplugged"
// *Cause:  An attempt was made to drop a pluggable database without
//          specifying the INCLUDING DATAFILES clause, and the pluggable 
//          database has not been unplugged.
// *Action: Unplug the pluggable database before dropping the pluggable 
//          database or use the INCLUDING DATAFILES clause in the 
//          DROP PLUGGABLE DATABASE statement.
//

SYS@cdb1> 

Solution 01: drop including datafiles

SYS@cdb1> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         4 PDB2                           MOUNTED
SYS@cdb1> drop pluggable database pdb2;
drop pluggable database pdb2
*
ERROR at line 1:
ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged


SYS@cdb1> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         4 PDB2                           MOUNTED
SYS@cdb1> 
SYS@cdb1> drop pluggable database pdb2 including datafiles;

Pluggable database dropped.

SYS@cdb1> 

Solution 02: unplug and drop

SYS@cdb1> create pluggable database pdb2 admin user pdbadmin identified by oracle;

Pluggable database created.

SYS@cdb1> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         5 PDB2                           MOUNTED
SYS@cdb1> drop pluggable database pdb2;
drop pluggable database pdb2
*
ERROR at line 1:
ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged


SYS@cdb1> alter pluggable database pdb2 unplug into '/u02/oradata/cdb1_pdb2.pdb';

Pluggable database altered.

SYS@cdb1> drop pluggable database pdb2;

Pluggable database dropped.

SYS@cdb1> !ls -tlr /u02/oradata/cdb1_pdb2.pdb
-rw-r--r-- 1 oracle oinstall 108483673 Aug 17 14:12 /u02/oradata/cdb1_pdb2.pdb

SYS@cdb1> 

trace log:

2021-08-17T14:09:26.406213+08:00
drop pluggable database pdb2
ORA-65179 signalled during: drop pluggable database pdb2...
2021-08-17T14:10:04.305592+08:00
alter pluggable database pdb2 unplug into '/u02/oradata/cdb1_pdb2.pdb'
2021-08-17T14:10:05.410965+08:00
PDB2(5):Autotune of undo retention is turned on. 
2021-08-17T14:10:05.513184+08:00
PDB2(5):Endian type of dictionary set to little
PDB2(5):Undo initialization recovery: Parallel FPTR complete: start:24189443 end:24189450 diff:7 ms (0.0 seconds)
PDB2(5):Undo initialization recovery: err:0 start: 24189443 end: 24189450 diff: 7 ms (0.0 seconds)
2021-08-17T14:10:07.015784+08:00
PDB2(5):[5541] Successfully onlined Undo Tablespace 2.
PDB2(5):Undo initialization online undo segments: err:0 start: 24189450 end: 24190102 diff: 652 ms (0.7 seconds)
PDB2(5):Undo initialization finished serial:0 start:24189443 end:24190142 diff:699 ms (0.7 seconds)
PDB2(5):Database Characterset for PDB2 is AL32UTF8
2021-08-17T14:10:13.355085+08:00
PDB2(5): AUDSYS.AUD$UNIFIED (SQL_TEXT) - CLOB populated
PDB2(5):JIT: pid 5541 requesting stop
PDB2(5):Closing sequence subsystem (24196595145).
PDB2(5):Buffer Cache flush started: 5
2021-08-17T14:10:14.464031+08:00
PDB2(5):Buffer Cache flush finished: 5
2021-08-17T14:10:16.003916+08:00
PDB2(5):Autotune of undo retention is turned on. 
2021-08-17T14:10:16.011196+08:00
PDB2(5):Endian type of dictionary set to little
PDB2(5):Undo initialization finished serial:0 start:24199489 end:24199489 diff:0 ms (0.0 seconds)
PDB2(5):Database Characterset for PDB2 is AL32UTF8
2021-08-17T14:10:17.606821+08:00
PDB2(5): AUDSYS.AUD$UNIFIED (SQL_TEXT) - CLOB populated
2021-08-17T14:12:04.161087+08:00
PDB2(5):JIT: pid 5541 requesting stop
PDB2(5):Buffer Cache flush started: 5
PDB2(5):Buffer Cache flush finished: 5
Completed: alter pluggable database pdb2 unplug into '/u02/oradata/cdb1_pdb2.pdb'
2021-08-17T14:15:30.603156+08:00
drop pluggable database pdb2
2021-08-17T14:15:30.908374+08:00
Deleted Oracle managed file /u02/oradata/CDB1/C9BC1FC038C215A5E0530F02000AE90E/datafile/o1_mf_temp_jkpnlwdr_.dbf
2021-08-17T14:15:30.909795+08:00
Stopped service pdb2
Completed: drop pluggable database pdb2

Have a good work&life! 2021/08 via LinHong


Similar Posts

Comments