DETACH DATABASE
On this page
Note
Prior to using this command, the enable_ engine variable must be set to ON (the default value).
Takes an unlimited storage database offline.
Refer to the Permission Matrix for the required permissions.
Syntax
DETACH DATABASE remote_database_name [AT MILESTONE "milestone_name" | FORCE | KILL]Arguments
milestone_ name
A quoted string that specifies the milestone from which to detach the database.
FORCE
The FORCE argument allows you to terminate ongoing uploads to remote storage and forcibly detach the database.
The FORCE option is applicable only for clusters using unlimited storage and is intended primarily for emergency recovery.
When the FORCE argument is not included, all outstanding changes are uploaded into remote storage before detaching.
When the FORCE argument is included, SingleStore immediately stops all ongoing uploads and detaches the database.
To reattach the database, use the ATTACH DATABASE command.
KILL
The KILL argument is less disruptive than FORCE, but serves a similar purpose.KILL argument to terminate the active query or workload and then proceed with detaching the database.
Unlike FORCE, the KILL argument only stops currently running queries and ensures that all data is uploaded to remote storage before the database is detached.
Remarks
-
If
FORCEis not specified, the following apply:-
A milestone (restore point) is implicitly created via the CREATE MILESTONE command.
-
While the milestone is being created, SingleStore uploads the remote database's local cluster data to remote storage which has not yet been synced.
-
If
milestone_is not specified, a name containing the current timestamp is automatically generated.name
-
-
Once a database is detached, information about that database and its milestones is no longer visible in the
MV_views such as* MV_andMILESTONES MV_.BOTTOMLESS_ DATABASE The information is available again once the database is reattached. -
After detaching a database, you can reattach the database using ATTACH DATABASE.
The database can be reattached at a milestone or a specified point in time, using either the same database name or the one specified. -
The
BACKUP DATABASEcommand cannot be run on a detached database.To run the BACKUP DATABASEcommand, all the partitions of a database must be either in theonlineorreplicatingstate. -
This command cannot be run on system databases.
-
Refer to the Permission Matrix for the required permissions.
Examples
DETACH DATABASE db AT MILESTONE "m";DETACH DATABASE db KILL;
Last modified: November 20, 2025