Categories:

System functions (System Information)

SYSTEM$VALIDATE_ACCOUNT_DELETION

Returns every condition that blocks dropping an account. The function is read-only: it doesn’t drop the account or change any objects.

An organization administrator can call this function for the account they plan to drop. The result lists every blocker in one response, including blockers you can remove and blockers that require Snowflake Support.

See also:

DROP ACCOUNT

Syntax

SYSTEM$VALIDATE_ACCOUNT_DELETION( '<account_name>' )

Arguments

account_name

Name of the account to check. Specify the account name, not the account locator. For example, if the account identifier is myorg-account123, specify account123.

Returns

Returns a JSON object:

KeyData typeDescription
accountSTRINGName of the account that was checked.
blockedBOOLEANtrue when one or more conditions block DROP ACCOUNT. false when the account can be dropped.
errorsARRAYObjects that describe each blocker. See the following table.

Each object in the errors array contains the following keys:

KeyData typeDescription
codeSTRINGError code. See Error codes.
messageSTRINGError message. The message can include the names or types of the objects that block the drop. A long list of names can be truncated.

Error codes

If DROP ACCOUNT fails, use the error code to find what to remove or who to contact before you retry the command. The condition column summarizes why the drop is blocked. The message value in the function output can be more specific and can name the blocking objects.

Error codeConditionResolution
003772Cannot drop account with active listings, please drop all listings in the account then retry, might need to retire marketplace listings first.ALTER LISTING, DROP LISTING
003773Cannot drop account with shares attached to listings, please drop all listings attached to the shares then retry, might need to retire marketplace listings first.DROP LISTING, DROP SHARE
004001Cannot drop account owning organization profiles with associated listings. To unblock dropping this account, drop the associated listings first or reach out to Support for additional help.DROP ORGANIZATION PROFILE
003830The account has secondary connections.DROP CONNECTION
003831The account has a primary connection with secondary connections.DROP CONNECTION, ALTER CONNECTION
003832The account has primary and secondary connections.DROP CONNECTION, ALTER CONNECTION
003155The account hosts a global database or a replication group.DROP REPLICATION GROUP, DROP FAILOVER GROUP, ALTER FAILOVER GROUP
060173Organization users or organization user groups still exist.DROP ORGANIZATION USER GROUP, DROP ORGANIZATION USER
511836A backup is under a legal hold.ALTER BACKUP SET
060014Drop account is not supported for Organization Accounts. Please contact support if you wish to drop this Organization account.Snowflake Support
060182The organization has an outstanding billing balance.Snowflake Support
003746The organization is locked for maintenance.Snowflake Support

Access control requirements

Only an organization administrator can call this function.

Usage notes

The function doesn’t drop the account. After you remove the blockers, run DROP ACCOUNT.

Examples

The following example checks whether the account ACCOUNT1 can be dropped. The account is blocked by active listings and a replication group:

CALL SYSTEM$VALIDATE_ACCOUNT_DELETION('ACCOUNT1');

Output:

{
  "account": "ACCOUNT1",
  "blocked": true,
  "errors": [
    {
      "code": "003772",
      "message": "Cannot drop account with active listings, please drop all listings in the account then retry, might need to retire marketplace listings first. Active listing: LISTING_1"
    },
    {
      "code": "003773",
      "message": "Cannot drop account with shares attached to listings, please drop all listings attached to the shares then retry, might need to retire marketplace listings first. Active listing: LISTING_1"
    },
    {
      "code": "003155",
      "message": "Account is currently hosting replication objects of the following types: Replication group. Please drop these objects and retry."
    }
  ]
}