恢复仪表板备份
Learn how to restore your dashboard backup to a new Supabase project
在你开始之前 #
🌐 Before you begin
仪表板备份只适用于仍使用逻辑备份的旧项目。使用物理备份的项目应按照使用 CLI 进行备份和恢复中的步骤操作。
🌐 Dashboard backups are only available for older projects that still use logical backups. Projects that use physical backups should follow steps in Backup and Restore using the CLI.
需要记住的事情 #
🌐 Things to keep in mind
这里有一些内容不会直接存储在你的数据库中,你需要在新项目中重新创建或设置它们:
🌐 Here are some things that are not stored directly in your database and will require you to re-create or setup on the new project:
- 边缘函数
- 认证设置和 API 密钥
- 实时设置
- 数据库扩展和设置
- 只读副本
恢复备份 #
🌐 Restore backup
在你的项目仪表板上,点击连接。
默认使用 会话池 连接字符串。如果你的 ISP 支持 IPv6 或者你启用了 IPv4 附加功能,就使用直接连接字符串。
会话池连接字符串:
1postgresql://postgres.[PROJECT-REF]:[YOUR-PASSWORD]@aws-0-us-east-1.pooler.supabase.com:5432/postgres直接连接字符串:
1postgresql://postgres.[PROJECT-REF]:[YOUR-PASSWORD]@db.[PROJECT-REF].supabase.com:5432/postgres数据库密码重置生效可能需要几分钟,特别是如果进行了多次密码重置的话。
在数据库设置中重置密码。
用数据库密码替换连接字符串中的[YOUR-PASSWORD]。
获取已下载备份文件的相对文件路径。
如果在与下载的备份相同的目录中进行恢复,文件路径看起来会像这样:
./backup_name.backup
The backup file will be gzipped with a .gz extension. You will need to unzip the file to look like this:
backup_name.backup
1psql -d [CONNECTION_STRING] -f /file/pathReplace [CONNECTION_STRING] with connection string from Steps 1 & 2.
Replace /file/path with the file path from Step 3.
Run the command with the replaced values to restore the backup to your new project.
Migrate storage objects to new project's S3 storage#
After restoring the backup, the buckets and files metadata will show up in the dashboard of the new project. However, the storage files stored in the S3 buckets would not be present.
Use the following Google Colab script provided below to migrate your downloaded storage objects to your new project's S3 buckets.
This method requires uploading to Google Colab and then to the S3 buckets. This could add significant upload time if there are large storage objects.
Common errors with the backup restore process#
"object already exists" "constraint x for relation y already exists" "Many other variations of errors"
These errors are expected when restoring to a new Supabase project. The backup from the dashboard is a full dump which contains the CREATE commands for all schemas. This is by design as the full dump allows you to rebuild the entire database from scratch even outside of Supabase.
One side effect of this method is that a new Supabase project has these commands already applied to schemas like storage and auth. The errors from this are not an issue because it skips to the next command to run. Another side effect of this is that all triggers will run during the restoration process which is not ideal but generally is not a problem.
There are circumstances where this method can fail and if it does, you should reach out to Supabase support for help.
"psql: error: connection to server at "aws-0-us-east-1.pooler.supabase.com" (44.216.29.125), port 5432 failed: received invalid response to GSSAPI negotiation:"
You are possibly using psql and Postgres version 15 or lower. Completely remove the Postgres installation and install the latest version as per the instructions above to resolve this issue.
"psql: error: connection to server at "aws-0-us-east-1.pooler.supabase.com" (44.216.29.125), port 5432 failed: error received from server in SCRAM exchange: Wrong password"
If the database password was reset, it may take a few minutes for it to reflect. Try again after a few minutes if you did a password reset.