Search Shortcut cmd + k | ctrl + k
Imagine the following situation – you started DuckDB in in-memory mode but would like to persist the state of your database to disk.
To achieve this, attach to a new disk-based database and use the COPY FROM DATABASE ... TO command:
ATTACH 'my_database.db';
COPY FROM DATABASE memory TO my_database;
DETACH my_database;
Ensure that the disk-based database file does not exist before attaching to it.
© 2026 DuckDB Foundation, Amsterdam NL