postgresql12.16备份还原命令
时间: 2023-12-02 09:43:07 浏览: 107
以下是postgresql12.16备份还原命令的示例:
1. 备份数据库:
```shell
pg_dump -h 12.16.2.41 -p 5432 -U postgres --dbname="tenant_101" -t pl_dictionary_bak20200729 -f "/home/pgbackupfiles/pl_dictionary_bak20200729.sql"
```
该命令将连接到主机为12.16.2.41,端口为5432的postgresql数据库,并备份名为“tenant_101”的数据库中的表“pl_dictionary_bak20200729”,并将备份文件保存在“/home/pgbackupfiles/pl_dictionary_bak20200729.sql”中。
2. 还原数据库:
```shell
psql -U postgres -d tenant_101 -h 12.16.2.41 -p 5432 < /home/software/apdb/pl_dictionary_bak20200729.sql
```
该命令将连接到主机为12.16.2.41,端口为5432的postgresql数据库,并将名为“tenant_101”的数据库还原为“/home/software/apdb/pl_dictionary_bak20200729.sql”中的备份文件。
阅读全文
相关推荐
















