postgresql数据库备份与还原
来源:互联网 发布:免费虚拟主机空间php 编辑:程序博客网 时间:2024/05/27 16:43
备份postgres表结构和数据:
进入用户名为postgres的数据库:su - postgres
pg_dump -h 59.65.233.201 -p 5432 -U postgres –F t -f /home/postgres/postgres.tar
注:-h指数据库服务器的主机名
-p 端口号,postgresql数据库默认5432
-U postgresql数据库用户名
-F 备份文件的格式--format=c|d|t|p output file format (custom, directory, tar, plain text)
-f --file=FILENAME output file or directory name
需要注意,导出的备份文件的目录必须是postgres用户可以访问的,否则会出现could not open TOC file "/home/pg_data_2-23.tar" for output: Permission denied没有权限访问的问题
还原postgres表机构和数据:pg_restore –U postgres -d postgres /home/postgres/postgres.tar
-d 数据库名
-U 数据库用户名
这两个不一样
“/home/postgres/postgres.sql”为sql文件存放位置全路径,可根据具体情况改 0 0
- postgresql数据库备份与还原
- Postgresql的dump数据库备份与还原
- postgresql 数据库的备份与还原
- Postgresql:命令备份与还原
- PostgreSQL的备份与还原
- PostgreSQL 备份与还原操作
- 备份与还原数据库
- 数据库备份与还原
- 数据库备份与还原
- 数据库备份与还原
- 数据库备份与还原
- 数据库备份与还原
- 数据库备份与还原
- 数据库备份与还原!
- 数据库备份与还原
- 数据库备份与还原
- postgresql数据库的备份和还原
- postgresql的备份与还原命令
- 自定义一个MessageBox
- nw.js node-webkit系列(1)简单介绍及应用
- memcache和memcached区别
- android LruCache内存缓存源码解析
- 关于SQLite与SQLServer的区别
- postgresql数据库备份与还原
- linux驱动—— ioctl中的cmd和_IO() , _IOR() , IOW() ,_IOWR() 以及_IOC_NR()的关系
- .net MVC 自定义异常错误页需要注意的地方
- 二叉树转双向链表+BFS+中序遍历
- 禁用springboot中对mongodb的autoConfiguration
- STM32串口通信中使用printf发送数据配置方法(开发环境 Keil RVMDK)
- tomcat server options 在哪里?
- UIVIewController自定义切换效果
- 下拉菜单之CSS实现