实例级别的导出和导入
\c postgres
create table a(id int);
insert into a values(1);
insert into a values(2);
select * from a;
create database mydb;
\c mydb
create table b(id int);
insert into b values(3);
insert into b values(4);
select * from b;
\q
exit
mkdir /pgccc/backup
chown -R postgres:postgres /pgccc/backup
ll /pgccc/backup
su - postgres
pg_dumpall -p 5432 > /pgccc/backup/alldata.backup
ll /pgccc/backup
psql -p 5432
\c postgres
drop table a;
select * from a;
\c mydb
drop table b;
select * from b;
\q
psql -p 5432 -f /pgccc/backup/alldata.backup postgres
psql -p 5432
\c postgres
select * from a;
\c mydb
select * from b;