postgresql13 for window 安装及备份还原数据

  • 下载 win x86-64
    https://www.enterprisedb.com/download-postgresql-binaries
  • 初始化
    C:\install\postgres\pgsql\bin\initdb.exe -D C:\install\postgres\pgsql\data -E UTF8
  • 启动服务
    C:\install\postgres\pgsql\bin\pg_ctl -D C:\install\postgres\pgsql\data -l logfile.log start
  • 查看进程是否启动
    netstat -aon | findstr 5432
  • 登入
    C:\install\postgres\pgsql\bin\psql.exe postgres
  • 查看所有数据库
    \l
  • 修改连接参数及work大小

  • 打开 C:\install\postgres\pgsql\data\postgresql.auto.conf

  • 添加
   # Do not edit this file manually!

   # It will be overwritten by the ALTER SYSTEM command.

   listen_addresses='*'

   max_connections=1000
   statement_timeout=1800000
   idle_in_transaction_session_timeout=600000

   max_parallel_workers=8
   max_parallel_workers_per_gather=6
  • 注意: *修改配置参数后简易重启数据库

  • 命令
    C:\install\postgres\pgsql\bin\pg_dumpall > D:\db\backup\pg_all_test.sql

  • 命令
    C:\install\postgres\pgsql\bin\psql -f D:\db\backup\pg_all_test.sql postgres

  • 停止
    C:\install\postgres\pgsql\bin\pg_ctl -D C:\install\postgres\pgsql\data -l logfile.log stop

  • 启动
    C:\install\postgres\pgsql\bin\pg_ctl -D C:\install\postgres\pgsql\data -l logfile.log start
  • 重载
    C:\install\postgres\pgsql\bin\pg_ctl -D C:\install\postgres\pgsql\data -l logfile.log reload

Original: https://www.cnblogs.com/funnyzpc/p/14062959.html
Author: funnyZpC
Title: postgresql13 for window 安装及备份还原数据

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/562392/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球