更新时间:2022-11-02 22:26:46
要备份数据库,可以使用pg_dump.exe
:
转到Postgres bin文件夹.例如:
Go to Postgres bin folder. For example:
cd "C:\Program Files\PostgreSQL\9.6\bin"
输入命令以转储数据库.例如:
Enter the command to dump your database. For example:
pg_dump.exe -U postgres -d MediaData -f D:\Backup\<backup-file-name>.sql
为您的postgres用户输入密码
Type password for your postgres user
要还原数据库,可以使用psql.exe
. (请注意,以下摘录自Alexandr Omelchenko的有用答案,由于我不清楚的原因,该答案已被删除.)
转到Postgres bin文件夹.例如:
Go to Postgres bin folder. For example:
cd "C:\ProgramFiles\PostgreSQL\9.5\bin"
输入命令以还原数据库.例如:
Enter the command to restore your database. For example:
psql.exe -U postgres -d MediaData -f D:\Backup\<backup-file-name>.sql
为您的postgres用户输入密码
Type password for your postgres user