DETACH DATABASE
On this page
Note
Prior to using this command, the enable_
engine variable must be set to ON
(the default value).allow_
engine variable must be set to ON
(the default is OFF
).
Takes an unlimited storage database offline.
It removes the reference to the detached database from the cluster.ATTACH
command needs to specify the location where to attach from.
Check here for the permissions required to use this command.
Syntax
DETACH DATABASE remote_
Arguments
milestone_ name
A quoted string that is the milestone to detach the database at.
Remarks
-
If
FORCE
is specified, the following applies:-
The database is dropped from the SingleStore cluster.
All data in the detached database that is stored locally in the cluster is deleted (and not uploaded to remote storage). However, FORCE
does not remove the corresponding database files from the remote object store; you should remove these files manually, if desired.
-
-
If
FORCE
is not specified, the following apply:-
A milestone (a restore point) is created.
The CREATE MILESTONE command is run implicitly. -
While the milestone is being created, SingleStore uploads the remote database's local cluster data to remote storage that 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_ MILESTONES and 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 reattach can be done optionally at a milestone or a point in time, and with the same or a different database name. -
This command cannot be run on system databases.
-
Refer to the Permission Matrix for the required permission.
Example
DETACH DATABASE db AT MILESTONE "m";
Last modified: February 23, 2024