Help Center/ GaussDB/ Developer Guide(Centralized_V2.0-8.x)/ SQL Reference/ SQL Syntax/ D/ DROP PLUGGABLE DATABASE INCLUDING DATAFILES
Updated on 2025-05-29 GMT+08:00

DROP PLUGGABLE DATABASE INCLUDING DATAFILES

Description

Drops PDB objects and all database objects and data in the PDB.

Precautions

  • This command can be used only when the GUC parameter enable_mtd is set to on.
  • This command can be performed only in the non-PDB. This command cannot be executed in M-compatible databases.
  • The operation user must be the PDB owner (see the pg_database.datdba system catalog) or have the SYSADMIN permission.
  • Before deleting, run the ALTER PLUGGABLE DATABASE statement to stop the PDB.
  • The template PDB (template_pdb) cannot be deleted using this statement.
  • When a PDB is deleted, the resource plan directive object joined with the PDB is not deleted.

Syntax

DROP PLUGGABLE DATABASE pdb_name INCLUDING DATAFILES;

Parameters

  • pdb_name

    Specifies the name of the PDB to be dropped.

Examples

  • Dropping a PDB
    -- If the PDB is in the open state, it cannot be dropped; the PDB must be closed first.
    gaussdb=# alter pluggable database my_pdb close immediate;
    ALTER PLUGGABLE DATABASE
    
    -- Connect to the postgres database as a system administrator and drop the closed PDB.
    gaussdb=# drop pluggable database my_pdb including datafiles;
    DROP PLUGGABLE DATABASE