Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

DROP DATABASE

Focus mode
DROP DATABASE - Amazon Redshift

Drops a database.

You can't run DROP DATABASE within a transaction block (BEGIN ... END). For more information about transactions, see Serializable isolation.

Syntax

DROP DATABASE database_name

Parameters

database_name

Name of the database to be dropped. You can't drop the dev, padb_harvest, template0, template1, or sys:internal databases, and you can't drop the current database.

To drop an external database, drop the external schema. For more information, see DROP SCHEMA.

DROP DATABASE usage notes

When using the DROP DATABASE statement, consider the following:

  • In general, we recommend that you don't drop a database that contains an AWS Data Exchange datashare using the DROP DATABASE statement. If you do, the AWS accounts that have access to the datashare lose access. Performing this type of alteration can breach data product terms in AWS Data Exchange.

    The following example shows an error when a database that contains an AWS Data Exchange datashare is dropped.

    DROP DATABASE test_db; ERROR: Drop of database test_db that contains ADX-managed datashare(s) requires session variable datashare_break_glass_session_var to be set to value 'ce8d280c10ad41'

    To allow dropping the database, set the following variable and run the DROP DATABASE statement again.

    SET datashare_break_glass_session_var to 'ce8d280c10ad41';
    DROP DATABASE test_db;

    In this case, Amazon Redshift generates a random one-time value to set the session variable to allow DROP DATABASE for a database that contains an AWS Data Exchange datashare.

Examples

The following example drops a database named TICKIT_TEST:

drop database tickit_test;
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.