nohup pg_restore --host "127.0.0.1" --port "5432" --username "postgres" --no-password --dbname "{dbname}" --verbose --clean "$backuppath/{dbname}$cur_date.bak"
#指定表 pg_dump -d Auth_DCIM -U postgres -t auth_tenant -a > /home/backup2.sql
#指定库 pg_dump -d Auth_DCIM -U postgres -a > /home/backup2.sql
#设置环境变量
export PGPASSWORD="sA123456"
pg_dump -U postgres -d Auth_DCIM -v | gzip > /home/backup.gz
gunzip -c backup.gz | psql -U postgres -d TEST
本文详细介绍使用nohup命令进行PostgreSQL数据库的备份过程,包括指定主机、端口、用户名、数据库名及备份路径等参数的具体应用。同时,演示了如何通过pg_dump命令进行数据库及指定表的备份,并设置了环境变量PGPASSWORD来简化密码输入流程。

1392

被折叠的 条评论
为什么被折叠?



