> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Attach Database

> Point Enterprise at an existing database in object storage with ATTACH DATABASE, without copying data.

**Applies to:** Embedded ❌, Enterprise ✅

If your LanceDB Embedded database already lives in object storage --
Embedded reads and writes tables on S3, GCS or Azure as well as local
disk -- you can move to Enterprise by attaching that same location,
rather than copying any data. A database on local disk has no such path:
`ATTACH DATABASE` only accepts an object-storage URI or a path relative
to Enterprise's own storage root, never a local filesystem path. Move it
to object storage first if it is not there already.

## Prerequisites

A [storage integration](https://docs.lancedb.com/sql/ddl/storage-integration.md) covering the
database's location must already exist. `ATTACH DATABASE` never names an
integration explicitly -- Enterprise automatically binds the most
specific integration whose `STORAGE_PREFIX` covers the location you
attach.

```sql SQL icon="database" theme={"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}}
CREATE STORAGE INTEGRATION raw
    STORAGE_PROVIDER = 'S3'
    STORAGE_PREFIX = 's3://customer-data/embedded-db/'
    STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::123456789012:role/lancedb-access'
```

## Attach the database

```sql SQL icon="database" theme={"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}}
ATTACH DATABASE analytics WITH (location = 's3://customer-data/embedded-db/')
```

See [Database](https://docs.lancedb.com/sql/ddl/database.md#attach) for the full `ATTACH DATABASE`
syntax, including GCS and Azure locations (Azure requires an
account-qualified URI), `IF NOT EXISTS`, and quoted names.

## What changes, and what doesn't

Attaching makes the location a database LanceDB Enterprise manages the
same way as one it created itself: Enterprise writes its own tracking
metadata into that location to bring it under management, enabling
capabilities Embedded never had there -- every table becomes reachable
through Enterprise's SQL and SDK surface immediately, with Enterprise's
authorization, Secrets, Functions, and
[background maintenance](https://docs.lancedb.com/basics/jobs.md) now available to
it. Attaching does not rewrite, move, or re-encode any table's own data.

[`DROP DATABASE`](https://docs.lancedb.com/sql/ddl/database#drop) on an attached database
unregisters it and releases the storage-integration reference, without
deleting the underlying data -- the location can be reattached at any
time.

## What to read next

> [card] [Storage Integration](https://docs.lancedb.com/sql/ddl/storage-integration.md)
>
> Configure the credential an attach depends on, for S3, GCS, or Azure.

> [card] [Database](https://docs.lancedb.com/sql/ddl/database.md)
>
> Full ATTACH, CREATE, DESCRIBE and DROP DATABASE syntax.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.