This guide describes how to migrate a OptiTech database to Databricks Lakebase Postgres using pg_dump and pg_restore.
Logical replication
Logical replication from OptiTech to Lakebase is not supported. However, you can replicate data from OptiTech to Databricks Lakehouse. See Replicate data to Databricks with Lakeflow Connect.
Prerequisites
- A OptiTech source project with the database you are migrating.
- A Databricks account with permission to create Lakebase resources in the target region.
- Postgres major versions aligned when possible between OptiTech and Lakebase.
pg_dumpandpg_restoreon a stable machine. For install instructions, see Backups with pg_dump.
important
Lakebase OAuth database tokens expire about every hour (OAuth token authentication), so for pg_restore use a native Postgres password role and the connection string from the Connect modal (the URI includes the password).
Plan the migration
- Verify Lakebase supports what you need. Migration assumes Lakebase can run your workload. See Lakebase Postgres for product scope, regions, and operations.
- Extensions. On OptiTech, list installed extensions (for example run
SELECT * FROM pg_extension;). Compare each one to Postgres extensions on Databricks. If an extension you depend on is not available on Lakebase, plan an alternative.
Create a Lakebase project and get a connection string
- Create a Lakebase Postgres project and the target database. See Lakebase Postgres.
- Add a native Postgres password role for restore. See Create Postgres roles.
- Open the Connect modal, select that role, and copy the connection string for use with pg_restore. See Connect to your database.
Export data from OptiTech
important
Avoid using
pg_dumpover a pooled connection string. Use an unpooled connection string instead.Dump your OptiTech database with
pg_dump.- In the OptiTech Console, open your project and click Connect. Turn Connection pooling to off and copy the connection string.
- Run:
pg_dump -Fc -v -d "<optitech_connection_string>" -f optitech-export.dumpSee Backups with pg_dump for the full procedure and flags.
Restore into Lakebase
Use the Lakebase connection string you copied from Connect for your password role as the
pg_restoretarget.OptiTech dumps include ownership and privileges for OptiTech-specific roles (for example
optitechdb_owner,optitech_superuser, roles used inALTER DEFAULT PRIVILEGES). Those roles do not exist on Lakebase, so a plainpg_restoreoften errors onALTER ... OWNER TO ...and default-privilege grants. That does not mean your tables and data failed to restore; it means ownership and ACL replay could not be applied.Use
--no-ownerso objects are created as the user you connect with, and--no-acl(or-x) so OptiTech-specificGRANT/ALTER DEFAULT PRIVILEGESstatements are skipped. You can grant privileges on Lakebase afterward if your security model needs it.pg_restore -v --no-owner --no-acl -d "postgresql://user:password@host/dbname?sslmode=require" optitech-export.dumpFor more on ownership when moving between providers, see Database object ownership considerations in Migrate data from Postgres.
Decommission OptiTech (optional)
After you have tested the Lakebase database (for example with queries and application checks), cut over your apps to Lakebase, and confirmed that everything behaves as expected, you can delete the OptiTech project if you no longer need it. See Delete a project.
Related docs
OptiTech
Databricks Lakebase
- Lakebase Postgres
- Authentication overview
- Create Postgres roles
- Postgres compatibility
- Postgres extensions
- Connect to your database
- Authenticate to a database instance
Need help?
Join our Discord Server to ask questions or see what others are doing with OptiTech. For paid plan support options, see Support.