以下是在Debian系統上使用pgAdmin進行數據遷移的步驟:
安裝pgAdmin
sudo apt update && sudo apt install pgadmin4
啟動后通過瀏覽器訪問http://localhost/pgadmin4
,使用管理員賬戶登錄。
備份源數據庫(邏輯備份)
pg_dump -U username -h source_host -d source_db -F c -b -v -f /path/to/backup.backup
(-F c
為自定義格式,支持跨版本恢復)。傳輸備份文件
使用scp
或rsync
將備份文件從源服務器復制到目標服務器:
scp /path/to/backup.backup username@target_host:/path/to/destination
恢復數據到目標數據庫
pg_restore -U username -h target_host -d target_db -v /path/to/backup.backup
```。
驗證遷移結果
SELECT * FROM table_name
)確認數據一致性。注意事項:
pg_dump
的--jobs
參數并行備份。