PostgreSQL13逻辑备份pg_dump
环境参数:
linux版本:CentOS7.6
PG版本:13.5
前期准备
postgres=
CREATE DATABASE
postgres=
You are now connected to database "wcbtest1" as user "postgres".
wcbtest1=
CREATE TABLE
wcbtest1=
INSERT 0 1
wcbtest1=
INSERT 0 1
wcbtest1=
INSERT 0 1
逻辑备份:
[root@wcbpg /]
Last login: Wed Dec 15 16:12:53 CST 2021 on pts/4
-bash-4.2$ pg_dump wcbtest1 --insert > wcbtest1.sql
-bash-4.2$ ls -l
total 4
drwx------ 4 postgres postgres 51 Nov 28 23:37 13
-rw-r--r-- 1 postgres postgres 904 Dec 15 16:13 wcbtest1.sql
通过SQL恢复
postgres=
CREATE DATABASE
postgres=
wcbtest2=
1 | zhangsan
2 | lisi
3 | wangwu
|