Code Snippet

Just another Code Snippet site

[Oracle] Drop missing tablespace file

Shutdown DB :

shutdown abort

Start mounting ;

startup mount

Drop all missing files (1 by 1) :

ALTER DATABASE DATAFILE '/path/to/missing/file.dbf' OFFLINE DROP;

Restart DB :

alter database open

, , ,


2 thoughts on “[Oracle] Drop missing tablespace file

  • if the file is at PDB level (and not at CDB level)

    Connect to CDB (unset ORACLE_PDB_SID env var)

    SHUTDOWN ABORT
    STARTUP MOUNT

    # Switch to PDB
    ALTER SESSION SET CONTAINER=<MY_PDB>;

    # Remove file
    ALTER PLUGGABLE DATABASE <MY_PDB> DATAFILE ‘<MY_MISSING_FILE>.dbf’ OFFLINE DROP;

    # Return to CDB
    ALTER SESSION SET container = cdb$root;

    # Open CDB
    ALTER DATABASE OPEN;

    # Open PDB (if not automatically done)
    ALTER PLUGGABLE DATABASE <MY_PDB> OPEN;

Leave a Reply to OLIVIER COMBE Cancel reply

Your email address will not be published. Required fields are marked *