COPY FROM DATABASE (OVERWRITE)
The COPY FROM DATABASE ... (OVERWRITE)
statement will make the target_db contain exactly the same data as source_db via zero-copy cloning, effectively overwriting it.
This command will wait on any ongoing write transactions on the target database to complete, and prevent new ones from starting while it is in progress.
note
The syntax is supported in MotherDuck only, as it operates on a MotherDuck metadata level.
Zero-copy clone
This command operates purely at the MotherDuck metadata layer, so it is a zero-copy clone. The operation is almost instantaneous and does not duplicate any underlying data.
Syntax
COPY FROM DATABASE <source_database> (OVERWRITE) [ TO <target_database> ]
Parameters
<source_database>
: The name or path of the source database to copy from, can be either a MotherDuck database or a share.<target_database>
: The name or path of the target database to create, must be a MotherDuck database that the user owns.